private void SetGasSource(MyResourceSourceComponent characterSourceComponent) { foreach (var gasInfo in m_storedGases) { gasInfo.LastOutputTime = MySession.Static.GameplayFrameCounter; if (m_characterGasSource != null) { m_characterGasSource.SetRemainingCapacityByType(gasInfo.Id, 0); if(Sync.IsServer) m_characterGasSource.OutputChanged -= Source_CurrentOutputChanged; } if (characterSourceComponent != null) { characterSourceComponent.SetRemainingCapacityByType(gasInfo.Id, gasInfo.FillLevel*gasInfo.MaxCapacity); characterSourceComponent.SetProductionEnabledByType(gasInfo.Id, gasInfo.FillLevel > 0); if(Sync.IsServer) characterSourceComponent.OutputChanged += Source_CurrentOutputChanged; } } m_characterGasSource = characterSourceComponent; }
private void SetGasSource(MyResourceSourceComponent characterSourceComponent) { m_gasOutputTime = MySandboxGame.TotalGamePlayTimeInMilliseconds; foreach (var gasInfo in m_storedGases) { if (m_characterGasSource != null) { m_characterGasSource.SetRemainingCapacityByType(gasInfo.Id, 0); m_characterGasSource.OutputChanged -= Source_CurrentOutputChanged; } if (characterSourceComponent != null) { characterSourceComponent.SetRemainingCapacityByType(gasInfo.Id, gasInfo.FillLevel*gasInfo.MaxCapacity); characterSourceComponent.SetProductionEnabledByType(gasInfo.Id, gasInfo.FillLevel > 0); characterSourceComponent.OutputChanged += Source_CurrentOutputChanged; } } m_characterGasSource = characterSourceComponent; }