private void OnEquipmentAdded(string slot, InventoryItem item) { QuickLogger.Debug($"ModuleContainerOnAddItem Item Name {item.item.name}"); if (item.item.GetTechType() == TechTypeHelper.BatteryAttachmentTechType()) { _mono.AddAttachment(DeepDrillModules.Battery); _powerModuleAttached = true; } else if (item.item.GetTechType() == TechTypeHelper.SolarAttachmentTechType()) { _mono.AddAttachment(DeepDrillModules.Solar); _powerModuleAttached = true; } else if (item.item.GetTechType() == TechTypeHelper.FocusAttachmentTechType()) { _mono.AddAttachment(DeepDrillModules.Focus); } else if (item.item.GetTechType() == TechTypeHelper.DrillerMK1TechType()) { _mono.OreGenerator.SetOresPerDay(QPatch.Configuration.Mk1OrePerDay); _upgradeAttached = true; } else if (item.item.GetTechType() == TechTypeHelper.DrillerMK2TechType()) { _mono.OreGenerator.SetOresPerDay(QPatch.Configuration.Mk2OrePerDay); _upgradeAttached = true; } else if (item.item.GetTechType() == TechTypeHelper.DrillerMK3TechType()) { _mono.OreGenerator.SetOresPerDay(QPatch.Configuration.Mk3OrePerDay); _upgradeAttached = true; } }
private void OnEquipmentRemoved(string slot, InventoryItem item) { if (item.item.GetTechType() == TechTypeHelper.BatteryAttachmentTechType()) { _powerModuleAttached = false; } else if (item.item.GetTechType() == TechTypeHelper.SolarAttachmentTechType()) { _powerModuleAttached = false; } else if (item.item.GetTechType() == TechTypeHelper.DrillerMK1TechType() || item.item.GetTechType() == TechTypeHelper.DrillerMK2TechType() || item.item.GetTechType() == TechTypeHelper.DrillerMK3TechType()) { _mono.OreGenerator.SetOresPerDay(QPatch.Configuration.DrillOrePerDay); _upgradeAttached = false; } _mono.RemoveAttachment(TechTypeHelper.GetDeepModule(item.item.GetTechType())); }
internal DeepDrillModules GetPowerModule() { var module = DeepDrillModules.None; for (int i = 0; i < EquipmentConfiguration.SlotIDs.Length; i++) { if (_equipment.GetTechTypeInSlot(EquipmentConfiguration.SlotIDs[i]) == TechTypeHelper.BatteryAttachmentTechType()) { module = DeepDrillModules.Battery; break; } if (_equipment.GetTechTypeInSlot(EquipmentConfiguration.SlotIDs[i]) == TechTypeHelper.SolarAttachmentTechType()) { module = DeepDrillModules.Solar; break; } } return(module); }
internal bool HasSolarModule() { bool result = false; for (int i = 0; i < EquipmentConfiguration.SlotIDs.Length; i++) { if (_equipment.GetTechTypeInSlot(EquipmentConfiguration.SlotIDs[i]) != TechTypeHelper.SolarAttachmentTechType()) { continue; } result = true; break; } return(result); }
private bool IsAllowedToAdd(Pickupable pickupable, bool verbose) { if (pickupable.gameObject.GetComponent <FCSTechFabricatorTag>() != null) { if (pickupable.GetTechType() == TechTypeHelper.BatteryAttachmentTechType() || pickupable.GetTechType() == TechTypeHelper.SolarAttachmentTechType()) { if (_powerModuleAttached) { QuickLogger.Message(FCSDeepDrillerBuildable.OnePowerAttachmentAllowed(), true); return(false); } } else if (pickupable.GetTechType() == TechTypeHelper.DrillerMK1TechType() || pickupable.GetTechType() == TechTypeHelper.DrillerMK2TechType() || pickupable.GetTechType() == TechTypeHelper.DrillerMK3TechType()) { if (_upgradeAttached) { QuickLogger.Message(FCSDeepDrillerBuildable.OneUpgradeAllowed(), true); return(false); } } return(true); } QuickLogger.Message(FCSDeepDrillerBuildable.DDAttachmentsOnly(), true); return(false); }
internal bool HasPowerModule(out DeepDrillModules module) { bool result = false; module = DeepDrillModules.None; for (int i = 0; i < EquipmentConfiguration.SlotIDs.Length; i++) { if (_equipment.GetTechTypeInSlot(EquipmentConfiguration.SlotIDs[i]) == TechTypeHelper.BatteryAttachmentTechType()) { module = DeepDrillModules.Battery; result = true; break; } if (_equipment.GetTechTypeInSlot(EquipmentConfiguration.SlotIDs[i]) == TechTypeHelper.SolarAttachmentTechType()) { module = DeepDrillModules.Solar; result = true; break; } } if (!result) { _mono.ComponentManager.HideAllPowerAttachments(); } return(result); }