Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

How to check if the electricity i'm reading from MyResourceSinkComponent is W, KW, MW etc.?

Discussion in 'Programming (In-game)' started by MarsAttacks, Apr 11, 2020.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. MarsAttacks Trainee Engineer

    Messages:
    23
    Hi there,

    i'm reading wrong params from this method below because some are in W others in Kw etc.
    How to convert them?

    readonly MyDefinitionId electricityId = new MyDefinitionId(typeof(VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GasProperties), "Electricity");
    MyResourceSinkComponent sink;
    public void GetPowInOut()
    {
    terminalCurrentInput = 0;
    terminalMaxRequiredInput = 0;
    foreach (IMyTerminalBlock block in TerminalBlocks)
    {
    if (!block.IsWorking) continue;
    if (block.Components.TryGet<MyResourceSinkComponent>(out sink))
    {
    terminalCurrentInput += sink.CurrentInputByType(electricityId);
    terminalMaxRequiredInput += sink.MaxRequiredInputByType(electricityId);
    }
    }
    }
     
  2. Malware Master Engineer

    Messages:
    9,860
    They're all in MWs.
     
  3. MarsAttacks Trainee Engineer

    Messages:
    23
    thanks for the reply and for the MDK ofc :)
     
  4. MarsAttacks Trainee Engineer

    Messages:
    23
    new Update:
    the wrong readings come from hydrogen thrusters,
    i get the value of m3 as electricity...
    what method should i use?
     
Thread Status:
This last post in this thread was made more than 31 days old.