//void UpdateConduitExistsStatus() //{ // bool outputCell2IsConnected = RequireOutputs.IsConnected(this.OutputCell2, this.ConduitType); // StatusItem outputConduit2Status; // var buildingStatus = Db.Get().BuildingStatusItems; // switch (this.ConduitType) // { // case ConduitType.Gas: // outputConduit2Status = buildingStatus.NeedGasOut; // break; // case ConduitType.Liquid: // outputConduit2Status = buildingStatus.NeedLiquidOut; // break; // case ConduitType.Solid: // outputConduit2Status = buildingStatus.NeedSolidOut; // break; // default: // throw new ArgumentOutOfRangeException(); // } // bool outputConduit2StatusIsEmpty = (this.OutputConduit2StatusGuid != Guid.Empty); // if (outputCell2IsConnected != outputConduit2StatusIsEmpty) // return; // this.OutputConduit2StatusGuid = this.Selectable.ToggleStatusItem(outputConduit2Status, this.OutputConduit2StatusGuid, !outputCell2IsConnected); //} void UpdateConduitBlockedStatus() { bool outputConduit2IsEmpty = FlowMgr.IsConduitEmpty(this.OutputCell2); bool blockageDetected = (this.ConduitBlockedStatusItemGuid != Guid.Empty); if (outputConduit2IsEmpty != blockageDetected) { return; } StatusItem blockedMultiples = Db.Get().BuildingStatusItems.ConduitBlockedMultiples; this.ConduitBlockedStatusItemGuid = this.Selectable.ToggleStatusItem(blockedMultiples, this.ConduitBlockedStatusItemGuid, !outputConduit2IsEmpty); }
void OnConduitUpdate(float data) { try { bool setActive = false; this.UpdateConduitBlockedStatus(); if (this.Operation.IsOperational) { var inputContent = FlowMgr.GetContents(InputCell); if ((inputContent.mass > 0) && (inputContent.element != SimHashes.Vacuum)) { var filterData = this; int outputCellIdx = filterData.GetOutputRouteIdx(inputContent.temperature, this.OutputCell1, this.OutputCell2); if (FlowMgr.IsConduitEmpty(outputCellIdx)) { var outputContent = FlowMgr.GetContents(outputCellIdx); /// ConduitFlow.AddElement() included these (similar) chks: /// (outputContent.mass >= this.ConduitMassMax) /// (!inputContent.element.Equals(outputContent.element)) /// float elementMoved = FlowMgr.AddElement(outputCellIdx , inputContent.element, inputContent.mass, inputContent.temperature, inputContent.diseaseIdx, inputContent.diseaseCount); if (elementMoved > 0) { FlowMgr.RemoveElement(this.InputCell, elementMoved); } } //else //{ // /// partial transfer not catered in (core) ElementFilter.OnConduitTick, don't break core design. //} } } this.Operation.SetActive(setActive, false); } catch (Exception ex) { KelmenUtils.Log("TemperatureFilterProcess.OnConduitUpdate", ex); throw ex; } }