Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private List<IMyCargoContainer> containers = new List<IMyCargoContainer>();
- private List<IMyGyro> gyros = new List<IMyGyro>();
- private float volumeCurrent = 0;
- private float volumeMax = 0;
- private float currentRatio = 0f;
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update100;
- GridTerminalSystem.GetBlocksOfType(containers);
- GridTerminalSystem.GetBlocksOfType(gyros);
- foreach (IMyCargoContainer cargo in containers)
- {
- volumeMax += cargo.GetInventory(0).MaxVolume.RawValue;
- }
- }
- public void Main(string argument, UpdateType updateType)
- {
- UpdateCurrentStorage();
- SetGyroPower();
- }
- private void UpdateCurrentStorage()
- {
- volumeCurrent = 0;
- foreach (IMyCargoContainer cargo in containers)
- {
- volumeCurrent += cargo.GetInventory(0).CurrentVolume.RawValue;
- }
- currentRatio = volumeCurrent / volumeMax;
- }
- private void SetGyroPower()
- {
- foreach (IMyGyro gyro in gyros)
- {
- gyro.GyroPower = Math.Max(currentRatio, .25f);
- }
- }
- private IMyTextSurface GetLCDPanel(string panelName)
- {
- return GridTerminalSystem.GetBlockWithName(panelName) as IMyTextSurface;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement