public void Sim200ms(float dt) { if ((UnityEngine.Object)operational != (UnityEngine.Object)null && !operational.IsOperational) { operational.SetActive(false, false); } else { UpdateState(dt); } }
public void Sim200ms(float dt) { if (operational != null && !operational.IsOperational) { operational.SetActive(false); } else { UpdateState(dt); } }
protected override void OnStartWork(Worker worker) { base.OnStartWork(worker); if ((Object)operational != (Object)null) { operational.SetActive(true, false); } worker.Trigger(-1283701846, this); worker.GetComponent <Effects>().Add(effectName, false); isDoneSleeping = false; }
public void SetConnectionStatus(CircuitManager.ConnectionStatus status) { connectionStatus = status; if (status == CircuitManager.ConnectionStatus.NotConnected) { operational.SetActive(false, false); } else { operational.SetActive(operational.IsOperational && JoulesAvailable > 0f, false); } }
protected override void OnSpawn() { operational.SetActive(operational.IsOperational, false); GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0f); filteredStorage.FilterChanged(); temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, GetComponent <Storage>()); UpdateLogicCircuit(); Subscribe(-592767678, OnOperationalChangedDelegate); Subscribe(-905833192, OnCopySettingsDelegate); Subscribe(-1697596308, UpdateLogicCircuitCBDelegate); Subscribe(-592767678, UpdateLogicCircuitCBDelegate); }
protected override void OnSpawn() { operational.SetActive(operational.IsOperational, false); GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0f); filteredStorage.FilterChanged(); temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, base.GetComponent <Storage>()); UpdateLogicCircuit(); Subscribe((int)GameHashes.OperationalChanged, new Action <object>(OnOperationalChanged)); Subscribe((int)GameHashes.CopySettings, new Action <object>(OnCopySettings)); Subscribe(-1697596308, new Action <object>(UpdateLogicCircuitCB)); Subscribe(-592767678, new Action <object>(UpdateLogicCircuitCB)); }
protected override void OnSpawn() { operational.SetActive(operational.IsOperational, false); GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0.0f); anim = GetComponent <KBatchedAnimController>(); filteredStorage.FilterChanged(); UpdateLogicCircuit(null); OnStorageChanged(null); Subscribe(-592767678, OnOperationalChangedDelegate); Subscribe(-905833192, OnCopySettingsDelegate); Subscribe(-1697596308, UpdateLogicCircuitDelegate); Subscribe(-592767678, UpdateLogicCircuitDelegate); Subscribe(-1697596308, OnStorageChangedDelegate); }
protected override void OnStartWork(Worker worker) { SetWorkTime(float.PositiveInfinity); var suit = worker.GetComponent <MinionIdentity>().GetEquipment().GetAssignable(Db.Get().AssignableSlots.Suit); if (suit != null) { suitTank = suit.GetComponent <SuitTank>(); jetSuitTank = suit.GetComponent <JetSuitTank>(); leadSuitTank = suit.GetComponent <LeadSuitTank>(); } operational.SetActive(true, false); elapsedTime = 0; }
protected override void OnSpawn() { base.OnSpawn(); operational.SetActive(operational.IsOperational, false); var building = GetComponent <Building>(); outputCell = building.GetUtilityOutputCell(); Conduit.GetFlowManager(Type).AddConduitUpdater(ConduitUpdate); mySlider = (ISingleSliderControl)this; OnFilterChanged(ElementLoader.FindElementByHash(FilteredElement).tag); filterable.onFilterChanged += new Action <Tag>(OnFilterChanged); GetComponent <KSelectable>().SetStatusItem(Db.Get().StatusItemCategories.Main, filterStatusItem, this); }
private void UpdateActive() { if (!Equals(null) && !((Object)this == (Object)null) && !base.gameObject.Equals(null) && !((Object)base.gameObject == (Object)null)) { operational.SetActive(operational.IsOperational && (Object)occupyingObject != (Object)null, false); } }
private void ConduitUpdate(float dt) { if (!_operational.IsOperational) { return; } var flowManager = SolidConduit.GetFlowManager(); if (!flowManager.HasConduit(_inputCell) || !flowManager.HasConduit(_outputCell) || !flowManager.IsConduitFull(_inputCell) || !flowManager.IsConduitEmpty(_outputCell)) { return; } var pickupable = flowManager.RemovePickupable(_inputCell); if (!(bool)pickupable) { return; } flowManager.AddPickupable(_outputCell, pickupable); _operational.SetActive(false); }
private void SetActive(bool active) { if (operational.IsOperational) { operational.SetActive(active, false); } }
protected override void OnSpawn() { Operational component = GetComponent <Operational>(); component.SetActive(component.IsOperational, false); filteredStorage.FilterChanged(); }
public void Sim1000ms(float dt) { if (operational.IsOperational) { RefreshDiggableCell(); operational.SetActive(HasDigCell, false); } }
public void Sim1000ms(float dt) { elapsedTime += dt; if (elapsedTime >= 1f) { pumpable = UpdateOperational(); elapsedTime = 0f; } if (operational.IsOperational && pumpable) { operational.SetActive(true, false); } else { selectable.RemoveStatusItem(Db.Get().BuildingStatusItems.PumpingLiquidOrGas, false); operational.SetActive(false, false); } }
public void Sim1000ms(float dt) { elapsedTime += dt; if (elapsedTime >= OPERATIONAL_UPDATE_INTERVAL) { // Once a second, check for pumpable materials pumpable = UpdateOperational(); elapsedTime = 0f; } if (operational.IsOperational && pumpable) { operational.SetActive(true, false); } else { operational.SetActive(false, false); } }
private void OnConduitConsumerUpdateEnd(object o) { if (!(o is Storage storage)) { return; } _endMass = storage.MassStored(); operational.SetActive(_startMass < _endMass); }
public void Sim200ms(float dt) { elapsedTime += dt; if (elapsedTime >= OperationalUpdateInterval) { pumpable = UpdatePumpOperational(); ventable = UpdateVentOperational(); elapsedTime = 0.0f; } // perform pumping DoFan(); if (operational.IsOperational && pumpable && ventable) { operational.SetActive(true, false); } else { operational.SetActive(false, false); } }
public void Sim200ms(float dt) { GetCoolantMassAndHeatCapacity(out float totalCoolantMass, out float totalCoolantHeatCapacity); UpdateHasFuelStatus(); UpdateCoolantStatus(totalCoolantMass); UpdateFusionStatus(); operational.SetActive(operational.IsOperational && hasFuel && hasCoolant); }
protected override void OnSpawn() { KBatchedAnimController component = GetComponent <KBatchedAnimController>(); component.TintColour = new Color(0.5f, 0.5f, 1.0f, 1.0f); string name = component.name + ".gun"; arm_go = new GameObject(name); arm_go.SetActive(value: false); arm_go.transform.parent = component.transform; looping_sounds = arm_go.AddComponent <LoopingSounds>(); rotateSound = GlobalAssets.GetSound(rotateSound); KPrefabID kPrefabID = arm_go.AddComponent <KPrefabID>(); kPrefabID.PrefabTag = new Tag(name); arm_anim_ctrl = arm_go.AddComponent <KBatchedAnimController>(); arm_anim_ctrl.AnimFiles = new KAnimFile[1] { component.AnimFiles[0] }; arm_anim_ctrl.initialAnim = "gun"; arm_anim_ctrl.isMovable = true; arm_anim_ctrl.sceneLayer = Grid.SceneLayer.TransferArm; arm_anim_ctrl.TintColour = new Color(0.5f, 0.5f, 1.0f, 1.0f); component.SetSymbolVisiblity("gun_target", is_visible: false); bool symbolVisible; Vector4 column = component.GetSymbolTransform(new HashedString("gun_target"), out symbolVisible).GetColumn(3); Vector3 position = column; position.z = Grid.GetLayerZ(Grid.SceneLayer.TransferArm); arm_go.transform.SetPosition(position); arm_go.SetActive(value: true); link = new KAnimLink(component, arm_anim_ctrl); SetupBeam(); RotateArm(rotatable.GetRotatedOffset(Quaternion.Euler(0f, 0f, -arm_rot) * Vector3.up), warp: true, 0f); energyConsumer.UpdatePoweredStatus(); operational.SetActive(true); selectable.AddStatusItem(charge_status, this); selectable.AddStatusItem(kills_status, this); }
private void Refresh(bool redLightState) { redLight = redLightState; operational.SetActive(operational.IsOperational && redLight, false); base.smi.sm.redLight.Set(redLight, base.smi); if (redLight) { CreateNewReactable(); } else { ClearReactable(); } }
protected override void OnSpawn() { base.OnSpawn(); operational.SetActive(operational.IsOperational, false); var building = GetComponent <Building>(); inputCell = building.GetUtilityInputCell(); Conduit.GetFlowManager(Type).AddConduitUpdater(ConduitUpdate); }
public void Sim200ms(float dt) { if (operational.IsOperational) { operational.SetActive(HasWorkingOrder && HasWorker, false); if (!duplicantOperated && HasWorkingOrder) { ComplexRecipe complexRecipe = recipe_list[workingOrderIdx]; orderProgress += dt / complexRecipe.time; if (orderProgress >= 1f) { CompleteWorkingOrder(); } } } }
public void Sim200ms(float dt) { operational.SetActive(operational.IsOperational); if (operational.IsActive) { if (anim.currentAnim != "on") { anim.Play("on", KAnim.PlayMode.Paused); } float coldTemp = Grid.Temperature[coldCell]; float hotTemp = Grid.Temperature[hotCell]; float dTemp = Mathf.Clamp(hotTemp - coldTemp, 0f, maxTempDiff); float heatMoved = maxHeatMovedkDTU - (heatMovedPerDegree * dTemp); heatMoved = Mathf.Clamp(heatMoved, 0, maxHeatMovedkDTU); float heatInColdCell = (coldTemp * Grid.Mass[coldCell] * Grid.Element[coldCell].specificHeatCapacity); if (heatMoved > heatInColdCell) { heatMoved = heatInColdCell - 1; } if (heatMoved > 0) { isMovingHeat = true; float heatProduced = heatMoved + wasteHeatkDTU; SimMessages.ModifyEnergy(coldCell, -heatMoved * 1000f, 5000f, SimMessages.EnergySourceID.StructureTemperature); SimMessages.ModifyEnergy(hotCell, heatProduced * 1000f, 5000f, SimMessages.EnergySourceID.StructureTemperature); } else { isMovingHeat = false; } } else { isMovingHeat = false; if (anim.currentAnim != "off") { anim.Play("off"); } } }
private void UpdateLogicAndActiveState() { float num = (float)Mathf.RoundToInt(PercentFull * 100f); if (activated) { if (num >= (float)deactivateValue) { activated = false; } } else if (num <= (float)activateValue) { activated = true; } bool isOperational = operational.IsOperational; ports.SendSignal(FilteredStorage.FULL_PORT_ID, (!activated && isOperational) ? 0 : 1); filteredStorage.SetLogicMeter(!activated && isOperational); operational.SetActive(isOperational, false); }
private void ConduitUpdate(float dt) { if (!_operational.IsOperational) { return; } var flowManager = SolidConduit.GetFlowManager(); if (!flowManager.HasConduit(_inputCell) || !flowManager.HasConduit(_outputCell) || !flowManager.HasConduit(_filteredCell) || (!flowManager.IsConduitFull(_inputCell) || !flowManager.IsConduitEmpty(_outputCell) || !flowManager.IsConduitEmpty(_filteredCell))) { return; } var acceptedTags = _treeFilterable.AcceptedTags; var pickupable = flowManager.RemovePickupable(_inputCell); if (!(bool)pickupable) { return; } foreach (var acceptedTag in acceptedTags) { if (pickupable.HasTag(acceptedTag)) { flowManager.AddPickupable(_filteredCell, pickupable); return; } } flowManager.AddPickupable(_outputCell, pickupable); _operational.SetActive(false); }
private void OnConduitTick(float dt) { bool value = false; UpdateConduitBlockedStatus(); if (operational.IsOperational) { ConduitFlow flowManager = Conduit.GetFlowManager(portInfo.conduitType); ConduitFlow.ConduitContents contents = flowManager.GetContents(inputCell); int num = (contents.element != filteredElem) ? outputCell : filteredCell; ConduitFlow.ConduitContents contents2 = flowManager.GetContents(num); if (contents.mass > 0f && contents2.mass <= 0f) { value = true; float num2 = flowManager.AddElement(num, contents.element, contents.mass, contents.temperature, contents.diseaseIdx, contents.diseaseCount); if (num2 > 0f) { flowManager.RemoveElement(inputCell, num2); } } } operational.SetActive(value, false); }
protected override void OnSpawn() { Tag myTag; foreach (EdiblesManager.FoodInfo foodTypes in EdiblesManager.GetAllFoodTypes()) { Tag tag = foodTypes.Id.ToTag(); if (foodTypes.CaloriesPerUnit > 0.0) { DiscoveredResources.Instance.Discover(tag, GameTags.Edible); } if (foodTypes.CaloriesPerUnit == 0.0) { DiscoveredResources.Instance.Discover(tag, GameTags.CookingIngredient); } } List <GameObject> myObjects = (Assets.GetPrefabsWithTag(GameTags.Medicine)); foreach (GameObject myObject in myObjects) { myTag = myObject.PrefabID(); if (myTag != "Untagged") { DiscoveredResources.Instance.Discover(myTag, GameTags.Medicine); } ; } operational.SetActive(operational.IsOperational, false); GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0.0f); filteredStorage.FilterChanged(); temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, base.GetComponent <Storage>()); this.UpdateLogicCircuit(); }
public void Sim200ms(float dt) { if (mobileLamp) { lampXY = Grid.PosToXY(gameObject.transform.position); } if (alwaysOn || (operational != null && operational.IsOperational)) { if (operational != null) { operational.SetActive(true); } HashSet <GameObject> buildingsAlreadySeen = new HashSet <GameObject>(); // Delete germs in area for (int dy = aoeBottom; dy < aoeBottom + aoeHeight; dy++) { int y = lampXY.Y + dy; for (int dx = aoeLeft; dx < aoeLeft + aoeWidth; dx++) { int x = lampXY.X + dx; if (FlashReachesCell(x, y)) { int cell = Grid.XYToCell(x, y); // Delete germs in the cell byte cellGermIndex = Grid.DiseaseIdx[cell]; if (diseasesKilled.Contains(cellGermIndex)) { int cellGermCount = Grid.DiseaseCount[cell]; int cellGermsToKill = GermsToKill(cellGermCount); SimMessages.ModifyDiseaseOnCell(cell, cellGermIndex, -cellGermsToKill); } // Delete germs on pickupables in the cell var pickupablesInCell = Grid.Objects[cell, (int)ObjectLayer.Pickupables]; if (pickupablesInCell != null) { var currentPickupable = pickupablesInCell.GetComponent <Pickupable>().objectLayerListItem; while (currentPickupable != null) { var pickupable = currentPickupable.gameObject.GetComponent <Pickupable>(); currentPickupable = currentPickupable.nextItem; if (pickupable != null) { byte pickupableDiseaseIndex = pickupable.PrimaryElement.DiseaseIdx; if (diseasesKilled.Contains(pickupableDiseaseIndex)) { int pickupableGermCount = pickupable.PrimaryElement.DiseaseCount; int pickupableGermsToKill = GermsToKill(pickupableGermCount); pickupable.PrimaryElement.ModifyDiseaseCount(-pickupableGermsToKill, GermicideLampConfig.ID); } if (applySunburn) { var minion = pickupable.GetComponent <MinionIdentity>(); if (minion != null) { var sunburn = new SicknessExposureInfo(Db.Get().Sicknesses.Sunburn.Id, ModStrings.STRINGS.BUILDINGS.GERMICIDELAMP.NAME); var sicknesses = minion.GetSicknesses(); bool hasSunburn = false; if (sicknesses.IsInfected()) { foreach (SicknessInstance item in sicknesses) { if (item.ExposureInfo.sicknessID == Db.Get().Sicknesses.Sunburn.Id) { hasSunburn = true; break; } } } if (!hasSunburn) { sicknesses.Infect(sunburn); } } } } } } // Delete germs on solid conduit items in the cell var conduit = Game.Instance.solidConduitFlow.GetConduit(cell); if (!conduit.Equals(SolidConduitFlow.Conduit.Invalid())) { var conduitContents = conduit.GetContents(Game.Instance.solidConduitFlow); var conduitPickupable = Game.Instance.solidConduitFlow.GetPickupable(conduitContents.pickupableHandle); if (conduitPickupable != null) { byte conduitDiseaseIndex = conduitPickupable.PrimaryElement.DiseaseIdx; if (diseasesKilled.Contains(conduitDiseaseIndex)) { int cpuCount = conduitPickupable.PrimaryElement.DiseaseCount; int cpuGermsToKill = GermsToKill(cpuCount); conduitPickupable.PrimaryElement.ModifyDiseaseCount(-cpuGermsToKill, GermicideLampConfig.ID); } } } // Delete germs on buildings in the cell var buildingInCell = Grid.Objects[cell, (int)ObjectLayer.Building]; if (buildingInCell != null && !buildingsAlreadySeen.Contains(buildingInCell)) { var buildingElement = buildingInCell.GetComponent <PrimaryElement>(); if (buildingElement != null) { byte buildingDiseaseIndex = buildingElement.DiseaseIdx; if (diseasesKilled.Contains(buildingDiseaseIndex)) { int buildingGermCount = buildingElement.DiseaseCount; int buildingGermsToKill = GermsToKill(buildingGermCount); buildingElement.ModifyDiseaseCount(-buildingGermsToKill, GermicideLampConfig.ID); } } buildingsAlreadySeen.Add(buildingInCell); } } } } } else { if (operational != null) { operational.SetActive(false); } } }
protected override void OnStartWork(Worker worker) { operational.SetActive(true, false); }