/// <summary> /// Removes harvesting device from ship /// </summary> public void RemoveHarvestingDevice() { if (HarvestingDeviceSlot.IsMounted()) { RemoveWeaponFromSlotAndFromShip(HarvestingDeviceSlot); } }
/// <summary> /// Returns mounted harvesting device /// </summary> /// <returns></returns> public MyHarvestingDevice GetMountedHarvestingDevice() { if (HarvestingDeviceSlot.IsMounted()) { return(HarvestingDeviceSlot.MountedWeapon as MyHarvestingDevice); } return(null); }
/// <summary> /// Adds harvesting device /// </summary> /// <param name="weapon">Harvesting device</param> /// <param name="weaponObjectBuilder">Harvesting device's object builder</param> private void AddHarvestingDevice(MyHarvestingDevice harvestingDevice, MyMwcObjectBuilder_SmallShip_Weapon harsvestingDeviceObjectBuilder) { if (HarvestingDeviceSlot.IsMounted()) { RemoveWeaponFromSlotAndFromShip(HarvestingDeviceSlot); } AddWeaponToSlot(HarvestingDeviceSlot, harvestingDevice, harsvestingDeviceObjectBuilder); }
/// <summary> /// Close all weapons /// </summary> public void Close() { //foreach (MySmallShipGunBase gun in GetMountedWeaponstWithHarvesterAndDrill()) //{ // gun.Close(); //} foreach (MyWeaponSlot weaponSlot in WeaponSlots) { if (weaponSlot != null) { weaponSlot.OnWeaponDismouting -= m_weaponDismounting; weaponSlot.OnWeaponMounting -= m_weaponMounting; weaponSlot.Close(); } } WeaponSlots.Clear(); WeaponSlots = null; DrillSlot.OnWeaponDismouting -= m_weaponDismounting; DrillSlot.OnWeaponMounting -= m_weaponMounting; DrillSlot.Close(); DrillSlot = null; HarvestingDeviceSlot.OnWeaponDismouting -= m_weaponDismounting; HarvestingDeviceSlot.OnWeaponMounting -= m_weaponMounting; HarvestingDeviceSlot.Close(); HarvestingDeviceSlot = null; m_allMountedWeapons.Clear(); m_allMountedWeapons = null; AmmoAssignments.Close(); AmmoAssignments = null; AmmoInventoryItems.Close(); AmmoAssignments = null; Ship.Inventory.OnInventoryContentChange -= OnInventoryContentChange; Ship = null; m_helperInventoryItems.Clear(); m_helperInventoryItems = null; m_isClosed = true; }