public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <BuildingComplete>().isManuallyOperated = true; Prioritizable.AddRef(go); Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 1000f; storage.showInUI = true; ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = INPUT_MATERIAL; manualDeliveryKG.refillMass = 150f; manualDeliveryKG.capacity = 750f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.ResearchFetch.IdHash; ResearchCenter researchCenter = go.AddOrGet <ResearchCenter>(); researchCenter.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_research_center_kanim") }; researchCenter.research_point_type_id = "alpha"; researchCenter.inputMaterial = INPUT_MATERIAL; researchCenter.mass_per_point = 50f; ElementConverter elementConverter = go.AddOrGet <ElementConverter>(); elementConverter.consumedElements = new ElementConverter.ConsumedElement[1] { new ElementConverter.ConsumedElement(INPUT_MATERIAL, 1.16f) }; elementConverter.showDescriptors = false; go.AddOrGetDef <PoweredController.Def>(); }
static bool Prefix(ResearchCenter __instance, ref float __result) { if (IsEndlessWorking(__instance)) { __result = __instance.worker.GetComponent <AttributeLevels>().GetPercentComplete("Learning"); return(false); } return(true); }
public Wishbone(ShipModel model) : base(model) { WeaponsBay weaponsBay = new WeaponsBay(this, Guid.NewGuid()); NavigationRoom navigation = new NavigationRoom(this, Guid.NewGuid()); DroneBay droneBay = new DroneBay(this, Guid.NewGuid()); MaintenanceBay maintenanceBay = new MaintenanceBay(this, Guid.NewGuid()); ScavengeBay scavengeBay = new ScavengeBay(this, Guid.NewGuid()); SensorRoom sensorRoom = new SensorRoom(this, Guid.NewGuid()); ShieldBay shieldBay = new ShieldBay(this, Guid.NewGuid()); ResearchCenter researchCenter = new ResearchCenter(this, Guid.NewGuid()); }
private void RefreshDisplayState(object data = null) { if (!((UnityEngine.Object)SelectTool.Instance.selected == (UnityEngine.Object)null)) { ResearchCenter component = SelectTool.Instance.selected.GetComponent <ResearchCenter>(); if (!((UnityEngine.Object)component == (UnityEngine.Object)null)) { researchButtonIcon.sprite = Research.Instance.researchTypes.GetResearchType(component.research_point_type_id).sprite; TechInstance activeResearch = Research.Instance.GetActiveResearch(); if (activeResearch == null) { DescriptionText.text = "<b>" + UI.UISIDESCREENS.RESEARCHSIDESCREEN.NOSELECTEDRESEARCH + "</b>"; } else { string str = string.Empty; if (!activeResearch.tech.costsByResearchTypeID.ContainsKey(component.research_point_type_id) || activeResearch.tech.costsByResearchTypeID[component.research_point_type_id] <= 0f) { str += "<color=#7f7f7f>"; } str = str + "<b>" + activeResearch.tech.Name + "</b>"; if (!activeResearch.tech.costsByResearchTypeID.ContainsKey(component.research_point_type_id) || activeResearch.tech.costsByResearchTypeID[component.research_point_type_id] <= 0f) { str += "</color>"; } foreach (KeyValuePair <string, float> item in activeResearch.tech.costsByResearchTypeID) { if (item.Value != 0f) { bool flag = item.Key == component.research_point_type_id; str += "\n "; str += "<b>"; if (!flag) { str += "<color=#7f7f7f>"; } string text = str; str = text + "- " + Research.Instance.researchTypes.GetResearchType(item.Key).name + ": " + activeResearch.progressInventory.PointsByTypeID[item.Key] + "/" + activeResearch.tech.costsByResearchTypeID[item.Key]; if (!flag) { str += "</color>"; } str += "</b>"; } } DescriptionText.text = str; } } } }
public static void Prefix(ref float mass_consumed, ref ResearchCenter __instance) { if (!Settings.Instance.Laboratory.IncludeRoom) { return; } if (__instance == null) { return; } if (RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeLaboratoryData.RoomId) && Settings.Instance.Laboratory.Bonus.HasValue) { mass_consumed *= (1 + Settings.Instance.Laboratory.Bonus.Value); } }
public static void Postfix(ResearchCenter __instance) { TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); } } }
public static void Postfix(ResearchCenter __instance) { GVD.VersionAlert(false); /* * Works vor vanilla * */ TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); } } /* * Works vor DLC * * TechInstance activeResearch = Research.Instance.GetActiveResearch(); * Tech tech = activeResearch.tech; * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); * * if (req.ContinuousCheck) * if (!req.ReqUnlocked()) * { * __instance.StopWork(__instance.worker, true); * ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue<ResearchScreen>(); * if (researchScreen == null) * return; * researchScreen.CancelResearch(); * Research.Instance.SetActiveResearch(null, true); * Debug.Log("ResearchRequirements: research canceled"); * } */ }
protected override void OnSpawn() { base.OnSpawn(); if (globalPointInventory == null) { globalPointInventory = new ResearchPointInventory(); } Subscribe(-1523247426, OnRolesUpdatedDelegate); Components.ResearchCenters.OnAdd += CheckResearchBuildings; Components.ResearchCenters.OnRemove += CheckResearchBuildings; foreach (KPrefabID prefab in Assets.Prefabs) { ResearchCenter component = prefab.GetComponent <ResearchCenter>(); if ((Object)component != (Object)null) { researchCenterPrefabs.Add(component); } } }
public static void Postfix(ResearchCenter __instance) { //throw new System.NotImplementedException("ResearchCenter_OnWorkTick_Patch - not implemented for DLC"); /* * Works vor vanilla * * TechInstance activeResearch = Research.Instance.GetActiveResearch(); * Tech tech = activeResearch.tech; * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); * * if (req.ContinuousCheck) * if(!req.ReqUnlocked()) * { * __instance.StopWork(__instance.worker, true); * ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen; * researchScreen.CancelResearch(); * Research.Instance.SetActiveResearch(null, true); * } */ GVD.VersionAlert(true); TechInstance activeResearch = Research.Instance.GetActiveResearch(); Tech tech = activeResearch.tech; TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id); if (req.ContinuousCheck) { if (!req.ReqUnlocked()) { __instance.StopWork(__instance.worker, true); ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue <ResearchScreen>(); if (researchScreen == null) { return; } researchScreen.CancelResearch(); Research.Instance.SetActiveResearch(null, true); Debug.Log("ResearchRequirements: research canceled"); } } }
static class CreateChore_Patch { static void Postfix(ResearchCenter __instance, Chore __result) => ModifyChore(__instance, __result, IsEndlessWorking); }
static class Sim_Patch { static void Postfix(ResearchCenter __instance, Chore ___chore) => RemoveDupe(__instance, ___chore, IsEndlessWorking); }
static class PreventResearchPoints_Patch { static bool Prefix(ResearchCenter __instance) => !IsEndlessWorking(__instance); }