public MyPhysicalDistributionGroup(MyDefinitionId typeId, MyResourceSourceComponent tempConnectedSource) { SinksByPriority = null; SourcesByPriority = null; SinkSourcePairs = null; FirstEndpoint = null; SinkDataByPriority = null; SourceDataByPriority = null; StockpilingStorage = null; OtherStorage = null; InputOutputData = new MyTuple<MySinkGroupData, MySourceGroupData>(); MaxAvailableResources = 0f; ResourceState = MyResourceStateEnum.NoPower; AllocateData(); InitFromTempConnected(typeId, tempConnectedSource); }
public MyPhysicalDistributionGroup(MyDefinitionId typeId, IMyConveyorEndpointBlock block) { SinksByPriority = null; SourcesByPriority = null; SinkSourcePairs = null; FirstEndpoint = null; SinkDataByPriority = null; SourceDataByPriority = null; StockpilingStorage = null; OtherStorage = null; InputOutputData = new MyTuple<MySinkGroupData, MySourceGroupData>(); MaxAvailableResources = 0f; ResourceState = MyResourceStateEnum.NoPower; AllocateData(); Init(typeId, block); }
public override void UpdateAfterSimulation10() { base.UpdateAfterSimulation10(); if (CubeGrid.GridSystems.ResourceDistributor.ResourceState != m_oldResourceState) { m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState; UpdateEmissivity(); } m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState; }
public override void UpdateBeforeSimulation100() { if (this.m_segment.ConveyorLine != null) { MyResourceStateEnum enum2 = this.m_segment.ConveyorLine.UpdateIsWorking(); if ((!this.m_emissivitySet || (this.m_working != this.m_segment.ConveyorLine.IsWorking)) || (this.m_state != enum2)) { this.m_working = this.m_segment.ConveyorLine.IsWorking; this.m_state = enum2; this.SetEmissiveStateWorking(); } } }
public override void UpdateBeforeSimulation100() { base.UpdateBeforeSimulation100(); if (m_soundEmitter == null) { return; } if (m_needsRefresh) { RefreshConnections(); m_needsRefresh = false; } if (CubeGrid.GridSystems.ResourceDistributor.ResourceState != m_oldResourceState) { m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState; UpdateEmissivity(); } m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState; bool powered = false; foreach (var block in m_connectedBlocks.Values) { powered |= block != null && block.ResourceSink != null && block.ResourceSink.IsPoweredByType(MyResourceDistributorComponent.ElectricityId) && block.IsWorking; if (powered) { break; } } powered &= IsWorking; if (powered && m_connectedBlockCount > 0 && (m_soundEmitter.IsPlaying == false || m_soundEmitter.SoundPair != m_baseIdleSound)) { m_soundEmitter.PlaySound(m_baseIdleSound, true); } else if ((!powered || m_connectedBlockCount == 0) && m_soundEmitter.IsPlaying && m_soundEmitter.SoundPair == m_baseIdleSound) { m_soundEmitter.StopSound(false); } }
void PowerDistributor_PowerStateChaged(MyResourceStateEnum newState) { UpdateIsWorking(); UpdateEmissivity(); }