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.

Space Engineers Ingame API Feature Requests

Discussion in 'Programming (In-game)' started by rexxar, Oct 10, 2017.

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

    Messages:
    348
    For Solar Panels could they be given the "Enabled" property. For some reason currently you can only turn them On/Off using GetActionWithName("OnOff_Off").
     
  2. Grimly Trainee Engineer

    Messages:
    74
    On IMyProjector, I would love to have access to the projection.

    Something like a List<ProjectionBlock> with read/write access where ProjectionBlock would be an ID (MyDefinitionId ?) + position(Vector3) + rotation(Vector3I or an enum?) + properties(Dictionary<string, ITerminalProperty> ?)
     
    • Agree Agree x 1
  3. HellArea Trainee Engineer

    Messages:
    26
    For the IMyCargoContainer interface (or for entire IMyTerminalBlock)
    Property Get IsActive (like for Camera block, or IsUnderControl for IMyShipController)
    Returns true, when user is activate/open block manually.
     
  4. Digi Senior Engineer

    Messages:
    2,384
    You might want to elaborate. Active how? You can't be in a cargo container like in a camera or ship controller, do you mean when the player is looking at the inventory screen on that ship? Because you can see a lot of inventories there so it can be weird to determine.
    Also this is likely not something that the server is aware of so they'll have to synchronize this manually, sounds not really worth the hassle so you should also include what use cases you have in mind for it.
     
  5. HellArea Trainee Engineer

    Messages:
    26
    When you interact some block, the game is already have an icon - on the right panel, Icon with tooltip "Show inventory or interacted item (corpse)". Also in the Control panel tab this block is selected for managing.
    With this feature cargo block can have interactivity for user, can send items to him or etc.
     
  6. Sarithule Trainee Engineer

    Messages:
    55
    I would like an Interface that is connected to IMyTerminalBlock that gives access to all the blocks non-modifiable block information (example: like rotor angle for rotors, or piston extension for pistons) without the need for downcasting from IMyTerminalBlock.

    Currently we have "ITerminalProperties" and "ITerminalActions" that give us access to the properties and actions of an IMyTerminalBlock, but we do not have an "ITerminalState" that might expose the bits of block information that are hidden behind a hierarchy. Currently the only way to retrieve information like this without downcasting is to parse the detailed info. This is of course a terrible way to retrieve this information but it is the only option that avoids the requirement that the block you are working with be known at compile time (which downcasting requires). This puts a big damper on creating in-game scripts that are able to dynamically accept blocks based on the users requirements. This is why "ITerminalProperties" and "ITerminalActions" are so great, they allow this freedom. But we are still not given access to all of the blocks information through these interfaces.


    Can I have access to the properties of any block without having to downcast it?
    Yes
    var block = GridTerminalSystem.GetBlockWithName(blockName);
    var blockProperties = new List<ITerminalProperty>();
    block.GetProperties(blockProperties);
    YAY!

    Can I have access to the Actions of any block without having to downcast it?
    Yes
    var block = GridTerminalSystem.GetBlockWithName(blockName);
    var blockActions = new List<ITerminalAction>();
    block.GetActions(blockActions);
    YAY!

    Can I have access to states of any block like "Current position" of a piston or "Current angle" of a rotor without having to downcast it?
    No...
    Booo!

    A potential way to rectify this:
    ???
    var block = GridTerminalSystem.GetBlockWithName(blockName);
    var blockStates = new List<ITerminalState>();
    block.GetStates(blockStates);
    ???

    Given that programs in space engineers that use the state of one type of block to affect how another type of block reacts are pretty much the bread and butter of all in-game scripts, I think that this addition would have a tremendously positive effect on the entire in-game scripting community and by extension all those who use those scripts, sooo pretty much every one.

    Please let me know what you think,
    Thanks!

    Coren of the "Easy Automation 2" script
     
    Last edited: Nov 25, 2018
  7. otobot1 Trainee Engineer

    Messages:
    1
    I know it's been said before, but exposing the jump command for jump drives would be amazing. Preferably jumps to coordinates, but even being able to initiate a blind jump would be nice. If we lose our ship? Oh well, our fault, time to make a new one. And if game balance is a concern? To be honest I don't think the game is terribly well balanced to begin with, but that's fine because it's a sandbox to play around in. And perhaps the ability to expose the jump command could be added as a game setting that could be left off by default or something.
     
    • Like Like x 1
  8. Malware Master Engineer

    Messages:
    9,600
    The answer is always the same. They're deliberately denying that ability. They do not want automated jumps. No, this will have to remain mod material I fear.

    I wish I could tell you exactly the reasoning they've used over the years but since I want this so much myself I tend to forget... :p

    Balance? The game isn't finished. It hasn't been balanced yet. Adding more imbalance won't do any good... You know that old adage "one wrong does not make another right"... :D
     
  9. Regn Trainee Engineer

    Messages:
    74
    I've never seen the source code for GetBlocksOfType. Seems like using it every game tick is fine, but I'm still wary of it in case it searches through all the blocks every time it is used. It would be great to have access to CubeGrid.Amount or CubeGrid.CanUpdate / CubeGrid.IsUpdateReady. Because right now we have to use GetBlocksOfType prior to checking if we need to use GetBlocksOfType. Either that, or we're supposed to go recompile our scripts every time we've added or removed terminals.

    ... What am I saying... We don't have to do that at all if GetBlocksOfType already does it.
    --- Automerge ---
    Trivial request.

    IMyMedicalRoom.IsBeingUsed, similar to IMyShipController.IsUnderControl.

    With it you can for instance determine whether to turn on/off gas generator to save power.
     
  10. mojomann71 Senior Engineer

    Messages:
    1,773
    @Regen I didn't know we had Gas Generators in the game unless you are referring to a mod. Can't throw an old man a curve like that!! LOL
     
  11. Malware Master Engineer

    Messages:
    9,600
    The H2/O2 generator is known as a gas generator (IMyGasGenerator) in the ingame scripting API.
     
  12. mojomann71 Senior Engineer

    Messages:
    1,773
    I was thinking like petrol lol...yeah brain not working today...lol thanks @Malware
     
  13. Sinus32 Trainee Engineer

    Messages:
    20
    In upcoming update I would love to have two new features in API related to inventories.

    The first one is a field "GasLevel" in struct MyInventoryItem, that would tell me if oxygen/hydrogen bottle is empty or not.

    The second is a method that would allow me to convert item amount into mass or volume. For now I have to hard code volume ratios for different item types, like 0.37 for ores, with exception 0.254 for scrap, 0.112 for nickel ingot, 70.0 for radio component, etc.
     
    • Like Like x 1
  14. Burillo Junior Engineer

    Messages:
    648
    is there still no way to get power current/max power consumption of an arbitrary block with InGame API? also, is there still no way to get ore/ingots needed by the assemblers' current queue?
     
  15. Digi Senior Engineer

    Messages:
    2,384
    You could get power required and power generated from any block (even modded ones that add resource stuff which normally don't have) for quite a while, but it is weirdly accessible:

    Code:
    MyDefinitionId ElectricityId = MyDefinitionId.Parse("MyObjectBuilder_GasProperties/Electricity");
    
    //...
    
    var sink = block.Components.Get<MyResourceSinkComponent>();
    
    if(sink != null)
    {
    	// you also probably want to make sure the block requires power by checking if ElectricityId is in sink.AcceptedResources.
    
    	var usingMW = sink.CurrentInputByType(ElectricityId);
    	var maxReqMW = sink.MaxRequiredInputByType(ElectricityId);
    }
    
    Also note, thrusters (and probably some other blocks) don't have their own individual sink so that will return null on most of them. They share a single sink that is usually given to a single thruster, but if that thruster is removed I think the sink isn't given to another thruster.

    But yes, it is quite weird and there should be a common interface for blocks that use/generate power and for other resources aswell, similar to the sink/source components thing but easier to find...

    Power producers have IMyPowerProducer now with fields for current and max, but for mods that add power/resource generation on blocks that don't normally have it you need to use the same way as above but with MyResourceSourceComponent.

    As for ingot requirements, there's no automated way, you'd have to hardcode that info from the game's blueprints.sbc.
     
  16. Burillo Junior Engineer

    Messages:
    648
    understatement of the decade... thanks very much!
     
  17. Teddy Trainee Engineer

    Messages:
    3
    Any progress on ore detectors?
     
  18. Malware Master Engineer

    Messages:
    9,600
    @Teddy Ore detectors run on clients. Scripts run on the server. For this reason we are very unlikely to be getting ore detector support in scripts.
     
  19. cheerkin Trainee Engineer

    Messages:
    62
    bool IMyCamera.IsViewedThrough would come very handy, if it's possible.
     
Thread Status:
This last post in this thread was made more than 31 days old.