// Add new ship to the list public static MySmallShip Add(string displayName, MyMwcObjectBuilder_Ship objectBuilder) { MySmallShip newShip = m_hologramShips.Allocate(); if (newShip != null) { newShip.Init(displayName, objectBuilder); if (newShip.Physics.Enabled) newShip.Physics.Enabled = false; /* newShip.Physics.Type = MyConstants.RIGIDBODY_TYPE_DEFAULT; newShip.Physics.CollisionLayer = MyConstants.COLLISION_LAYER_UNCOLLIDABLE; */ newShip.IsHologram = true; // we dont want the hologram to have a light newShip.RemoveLight(); newShip.RemoveSubObjectLights(); newShip.Config.Engine.Level = 1; newShip.Config.ReflectorLight.Level = 1; newShip.GetReflectorProperties().CurrentBillboardLength = 40; newShip.GetReflectorProperties().CurrentBillboardThickness = 6; newShip.CastShadows = false; } return newShip; }
public virtual void Init(string hudLabelText, MyMwcObjectBuilder_Ship shipObjectBuilder) { Debug.Assert(shipObjectBuilder != null); this.Faction = shipObjectBuilder.Faction; if (shipObjectBuilder.Inventory != null) { Inventory.Init(shipObjectBuilder.Inventory); } else { OnInventoryContentChange(Inventory); } }
public virtual bool IsSameAs(MyMwcObjectBuilder_Ship e) { MyMwcObjectBuilder_SmallShip ent = e as MyMwcObjectBuilder_SmallShip; if (ShipType != ent.ShipType) { return(false); } if (Weapons != ent.Weapons) { return(false); } if (ShipMaxHealth != ent.ShipMaxHealth) { return(false); } if (ShipHealthRatio != ent.ShipHealthRatio) { return(false); } if (ArmorHealth != ent.ArmorHealth) { return(false); } if (Oxygen != ent.Oxygen) { return(false); } if (Fuel != ent.Fuel) { return(false); } if (ReflectorLight != ent.ReflectorLight) { return(false); } if (ReflectorLongRange != ent.ReflectorLongRange) { return(false); } return(true); }
public override void Init(string displayName, MyMwcObjectBuilder_Ship shipObjectBuilder) { MyMwcObjectBuilder_SmallShip smallShipObjectBuilder = shipObjectBuilder as MyMwcObjectBuilder_SmallShip; Debug.Assert(smallShipObjectBuilder != null); m_unifiedWeaponCues = new MySoundCue?[MyAudio.GetNumberOfSounds()]; MaxArmorHealth = 100.0f; bool isPlayerShip = smallShipObjectBuilder is MyMwcObjectBuilder_SmallShip_Player; if (isPlayerShip) { Save = false; // Do not save player ships m_waypointTicks = 0; } OwnerId = smallShipObjectBuilder.OwnerId; RouteMemory = new MyPositionMemory(MySmallShipConstants.POSITION_MEMORY_SIZE, 1); Name = shipObjectBuilder.Name; //set leveling matrix default m_levelingMatrix = Matrix.Identity; m_engineSoundOn = true; StringBuilder hudLabel = null; if (displayName != null) { hudLabel = new StringBuilder(displayName); } InitShip(hudLabel, smallShipObjectBuilder, null); MyModelDummy dummy; if (GetModelLod0().Dummies.TryGetValue("destruction", out dummy)) { m_damageEffectLocalMatrix = dummy.Matrix; } if (shipObjectBuilder.Inventory == null) { shipObjectBuilder.Inventory = new MyMwcObjectBuilder_Inventory(new List<MyMwcObjectBuilder_InventoryItem>(), m_shipTypeProperties.GamePlay.CargoCapacity); } shipObjectBuilder.Inventory.MaxItems = m_shipTypeProperties.GamePlay.CargoCapacity; if (isPlayerShip) { if (MyGameplayCheats.IsCheatEnabled(MyGameplayCheatsEnum.INCREASE_CARGO_CAPACITY)) { shipObjectBuilder.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS; } //shipObjectBuilder.Inventory.UnlimitedCapacity = MyGameplayCheats.IsCheatEnabled(MyGameplayCheatsEnum.UNLIMITED_CARGO_CAPACITY); } base.Init(displayName, shipObjectBuilder); if (isPlayerShip) { Inventory.InventorySynchronizer = new MyInventorySynchronizer(Inventory, MyPlayerShipInventorySynchronizerHelper.MustBePlayerShipInventorySynchronized); } System.Diagnostics.Debug.Assert(Faction != 0); m_targetEntityHistory.Clear(); m_pilotDeathTime = 0; m_lastLootTime = 0; m_isExploded = false; m_lastTimeDeployedDrone = MyConstants.FAREST_TIME_IN_PAST; RenderObjects[0].ShadowCastUpdateInterval = 600; MyGuiScreenInventoryManagerForGame.OpeningInventoryScreen += OpeningInventoryScreen; MyGuiScreenInventoryManagerForGame.InventoryScreenClosed += InventoryScreenClosed; AfterburnerStatus = 1.0f; AfterburnerEnabled = true; IsDummy = smallShipObjectBuilder.IsDummy; m_friendlyFireDamageTimer = 0; AIPriority = smallShipObjectBuilder.AIPriority; UpdateMaxFuel(); UpdateMaxOxygen(); }
public override bool IsSameAs(MyMwcObjectBuilder_Ship bot) { return(base.IsSameAs(bot)); }
public virtual bool IsSameAs(MyMwcObjectBuilder_Ship e) { MyMwcObjectBuilder_SmallShip ent = e as MyMwcObjectBuilder_SmallShip; if(ShipType != ent.ShipType) return false; if (Weapons != ent.Weapons) return false; if (ShipMaxHealth != ent.ShipMaxHealth) return false; if (ShipHealthRatio != ent.ShipHealthRatio) return false; if (ArmorHealth != ent.ArmorHealth) return false; if (Oxygen != ent.Oxygen) return false; if (Fuel != ent.Fuel) return false; if (ReflectorLight != ent.ReflectorLight) return false; if (ReflectorLongRange != ent.ReflectorLongRange) return false; return true; }
public override bool IsSameAs(MyMwcObjectBuilder_Ship bot) { return base.IsSameAs(bot); }