private void OnPowerStatusChanged(object data) { if (!(data is bool buildingEnabled)) { return; } conduitConsumer.alwaysConsume = buildingEnabled && energyConsumer.IsPowered; conduitDispenser.alwaysDispense = buildingEnabled && operational.GetFlag(LogicOperationalController.LogicOperationalFlag); }
private static string ResolveInfoStatusItemString(string format_str, object data) { LogicOperationalController logicOperationalController = (LogicOperationalController)data; Operational component = logicOperationalController.GetComponent <Operational>(); return((!component.GetFlag(logicOperationalFlag)) ? BUILDING.STATUSITEMS.LOGIC.LOGIC_CONTROLLED_DISABLED : BUILDING.STATUSITEMS.LOGIC.LOGIC_CONTROLLED_ENABLED); }
protected virtual void UpdateWorkingState(object data) { bool flag = false; bool flag2 = false; TechInstance activeResearch = Research.Instance.GetActiveResearch(); if (activeResearch != null) { flag = true; if (activeResearch.tech.costsByResearchTypeID.ContainsKey(research_point_type_id) && Research.Instance.Get(activeResearch.tech).progressInventory.PointsByTypeID[research_point_type_id] < activeResearch.tech.costsByResearchTypeID[research_point_type_id]) { flag2 = true; } } if (operational.GetFlag(EnergyConsumer.PoweredFlag) && !IsAllResearchComplete()) { if (flag) { GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoResearchSelected, false); if (!flag2 && !ResearchComponentCompleted()) { GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoResearchSelected, false); GetComponent <KSelectable>().AddStatusItem(Db.Get().BuildingStatusItems.NoApplicableResearchSelected, null); } else { GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoApplicableResearchSelected, false); } } else { GetComponent <KSelectable>().AddStatusItem(Db.Get().BuildingStatusItems.NoResearchSelected, null); GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoApplicableResearchSelected, false); } } else { GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoResearchSelected, false); GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoApplicableResearchSelected, false); } operational.SetFlag(ResearchSelectedFlag, flag && flag2); if ((!flag || !flag2) && (bool)base.worker) { StopWork(base.worker, true); } }
public bool is_enabled() { return((enabled_button == null || enabled_button.IsEnabled) && operational.GetFlag(LogicOperationalController.LogicOperationalFlag)); }
private void OnConduitDispenserUpdateStart(object o) { var logicOperationalFlag = (Operational.Flag)_logicOperationalFlagGetter.GetValue(_logicOperationalController); _conduitDispenser.alwaysDispense = _buildingEnabledButton.IsEnabled && operational.GetFlag(logicOperationalFlag); }