private int GetConnectedNetworkID() { GameObject gameObject = Grid.Objects[utilityCell, 20]; SolidConduit solidConduit = (!((Object)gameObject != (Object)null)) ? null : gameObject.GetComponent <SolidConduit>(); return(((!((Object)solidConduit != (Object)null)) ? null : solidConduit.GetNetwork())?.id ?? (-1)); }
public static void ModifyVectorZAxis(SaveLoadRoot layerTarget) { if (layerTarget == null) { return; } SolidConduit component = layerTarget.GetComponent <SolidConduit>(); if (!(UnityEngine.Object)component != (UnityEngine.Object)null) { return; } Vector3 position = layerTarget.transform.GetPosition(); float desired = Grid.GetLayerZ(Grid.SceneLayer.Move); if (position.z != desired) { if (!InitialZValues.ContainsKey(layerTarget)) { InitialZValues.Add(layerTarget, position.z); } position.z = desired; layerTarget.transform.SetPosition(position); RefreshKbacForLayerTarget(layerTarget); } }
private void ConduitUpdate(float dt) { operational.SetActive(operational.IsOperational, false); if (Type == ConduitType.Solid) { var sFlow = SolidConduit.GetFlowManager(); if (sFlow == null || !sFlow.HasConduit(outputCell) || !IsOperational) { return; } storage.AddOre(FilteredElement, Flow / InfiniteSourceFlowControl.GramsPerKilogram, Temp, 0, 0, false, false); sFlow.GetContents(outputCell); return; } else { var flowManager = Conduit.GetFlowManager(Type); if (flowManager == null || !flowManager.HasConduit(outputCell) || !IsOperational) { return; } var delta = flowManager.AddElement(outputCell, FilteredElement, Flow / InfiniteSourceFlowControl.GramsPerKilogram, Temp, 0, 0); Game.Instance.accumulators.Accumulate(accumulator, delta); } }
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 ConduitUpdate(float dt) { if (Type == ConduitType.Solid) { var sFlow = SolidConduit.GetFlowManager(); if (sFlow == null || !sFlow.HasConduit(inputCell) || !IsOperational) { operational.SetActive(false, false);; return; } if (sFlow.IsConduitEmpty(inputCell)) { operational.SetActive(false, false); return; } operational.SetActive(true, false); var pickupable = sFlow.RemovePickupable(inputCell); pickupable.DeleteObject(); } else { var flowManager = Conduit.GetFlowManager(Type); if (flowManager == null || !flowManager.HasConduit(inputCell) || !IsOperational || flowManager.IsConduitEmpty(inputCell)) { operational.SetActive(false, false); return; } operational.SetActive(true, false); var contents = flowManager.GetContents(inputCell); flowManager.RemoveElement(inputCell, contents.mass); Game.Instance.accumulators.Accumulate(accumulator, contents.mass); } }
private int GetConnectedNetworkID() { GameObject gameObject = Grid.Objects[this.utilityCell, 20]; SolidConduit solidConduit = (UnityEngine.Object)gameObject != (UnityEngine.Object)null ? gameObject.GetComponent <SolidConduit>() : (SolidConduit)null; UtilityNetwork utilityNetwork = (UnityEngine.Object)solidConduit != (UnityEngine.Object)null ? solidConduit.GetNetwork() : (UtilityNetwork)null; return(utilityNetwork == null ? -1 : utilityNetwork.id); }
protected override void OnSpawn() { base.OnSpawn(); Subscribe((int)GameHashes.CopySettings, new Action <object>(OnCopySettings)); // -905833192 SolidConduit.GetFlowManager().AddConduitUpdater(ConduitUpdate); animController = GetComponent <KBatchedAnimController>(); OnSwitchToggled(); }
protected override void OnSpawn() { base.OnSpawn(); Building component = GetComponent <Building>(); inputCell = component.GetUtilityInputCell(); outputCell = component.GetUtilityOutputCell(); SolidConduit.GetFlowManager().AddConduitUpdater(ConduitUpdate, ConduitFlowPriority.Default); }
protected override void OnSpawn() { base.OnSpawn(); var component = GetComponent <Building>(); SolidConduit.GetFlowManager().AddConduitUpdater(ConduitUpdate); animController = GetComponent <KBatchedAnimController>(); UpdateLogicCircuit(); }
protected override void OnSpawn() { base.OnSpawn(); Building component = this.GetComponent <Building>(); this.inputCell = component.GetUtilityInputCell(); this.outputCell = component.GetUtilityOutputCell(); SolidConduit.GetFlowManager().AddConduitUpdater(new System.Action <float>(this.ConduitUpdate), ConduitFlowPriority.Default); }
protected override void OnSpawn() { base.OnSpawn(); Building component = this.GetComponent <Building>(); this._inputCell = component.GetUtilityInputCell(); this._outputCell = component.GetUtilityOutputCell(); this._filteredCell = Grid.OffsetCell(Grid.PosToCell(this.transform.GetPosition()), component.GetRotatedOffset(this.SecondaryPort.offset)); Game.Instance.solidConduitSystem.AddToNetworks(this._filteredCell, (object)new FlowUtilityNetwork.NetworkItem(this.SecondaryPort.conduitType, Endpoint.Source, this._filteredCell, this.gameObject), true); SolidConduit.GetFlowManager().AddConduitUpdater(new System.Action <float>(this.ConduitUpdate), ConduitFlowPriority.Default); }
protected override void OnSpawn() { base.OnSpawn(); var component = GetComponent <Building>(); _inputCell = component.GetUtilityInputCell(); _outputCell = component.GetUtilityOutputCell(); _filteredCell = Grid.OffsetCell(Grid.PosToCell(transform.GetPosition()), component.GetRotatedOffset(SecondaryPort.offset)); var itemFilter = new FlowUtilityNetwork.NetworkItem(SecondaryPort.conduitType, Endpoint.Source, _filteredCell, gameObject); Game.Instance.solidConduitSystem.AddToNetworks(_filteredCell, itemFilter, true); SolidConduit.GetFlowManager().AddConduitUpdater(ConduitUpdate); }
private void ConduitUpdate(float dt) { dispensing = false; if (!(bool)operational || operational.IsOperational) { SolidConduitFlow flowManager = SolidConduit.GetFlowManager(); if (flowManager.HasConduit(inputCell) && flowManager.HasConduit(outputCell) && flowManager.IsConduitFull(inputCell) && flowManager.IsConduitEmpty(outputCell)) { Pickupable pickupable = flowManager.RemovePickupable(inputCell); if ((bool)pickupable) { flowManager.AddPickupable(outputCell, pickupable); dispensing = true; } } } }
private void GetSolidConduitData(out float temperature, out float mass, out int germs, out Element element) { int cell = Grid.PosToCell(this); var manager = SolidConduit.GetFlowManager(); var content = manager.GetPickupable(manager.GetContents(cell).pickupableHandle); if (content == null) { temperature = 0; mass = 0; germs = 0; element = ElementLoader.FindElementByHash(SimHashes.Vacuum); } else { temperature = content.PrimaryElement.Temperature; mass = content.PrimaryElement.Mass; germs = content.PrimaryElement.DiseaseCount; element = content.PrimaryElement.Element; } }
private void ConduitUpdate(float dt) { if (this.operational.IsOperational) { SolidConduitFlow flowManager = SolidConduit.GetFlowManager(); if (!flowManager.HasConduit(this.inputCell) || !flowManager.HasConduit(this.outputCell) || !flowManager.IsConduitFull(this.inputCell) || !flowManager.IsConduitEmpty(this.outputCell)) { return; } Pickupable pickupable = flowManager.RemovePickupable(this.inputCell); if (!(bool)((UnityEngine.Object)pickupable)) { return; } flowManager.AddPickupable(this.outputCell, pickupable); this.operational.SetActive(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 ConduitUpdate(float dt) { SolidConduitFlow flowManager = SolidConduit.GetFlowManager(); if (!flowManager.HasConduit(this._inputCell) || !flowManager.HasConduit(this._outputCell) || !flowManager.IsConduitFull(this._inputCell) || (!flowManager.IsConduitEmpty(this._outputCell))) { return; } Pickupable pickupable = flowManager.RemovePickupable(_inputCell); flowManager.AddPickupable(this._outputCell, pickupable); if (!(bool)((UnityEngine.Object)pickupable)) { return; } if (flowManager.HasConduit(this._filteredCell) && flowManager.IsConduitEmpty(this._filteredCell)) { Pickupable pickupable2 = EntityPrefabs.Instantiate(pickupable); flowManager.AddPickupable(this._filteredCell, pickupable2); } this.operational.SetActive(false, false); }
private void ConduitUpdate(float dt) { bool flag = false; if (this.operational.IsOperational) { SolidConduitFlow flowManager = SolidConduit.GetFlowManager(); if (!flowManager.HasConduit(this.inputCell) || !flowManager.HasConduit(this.outputCell) || !flowManager.HasConduit(this.filteredCell) || (!flowManager.IsConduitFull(this.inputCell) || !flowManager.IsConduitEmpty(this.outputCell) || !flowManager.IsConduitEmpty(this.filteredCell))) { return; } var acceptedTags = treeFilterable.AcceptedTags; Pickupable pickupable = flowManager.RemovePickupable(this.inputCell); if (!(bool)((UnityEngine.Object)pickupable)) { return; } foreach (var acceptedTag in acceptedTags) { if (pickupable.HasTag(acceptedTag)) { flowManager.AddPickupable(this.filteredCell, pickupable); return; } } flowManager.AddPickupable(this.outputCell, pickupable); this.operational.SetActive(flag, false); } }
protected override void OnCleanUp() { SolidConduit.GetFlowManager().RemoveConduitUpdater(ConduitUpdate); base.OnCleanUp(); }
protected override void OnCleanUp() { SolidConduit.GetFlowManager().RemoveConduitUpdater(new System.Action <float>(this.ConduitUpdate)); base.OnCleanUp(); }