1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Tools usable without suit energy?

Discussion in 'Modding API' started by Duncan, Jun 24, 2016.

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

    Duncan Trainee Engineer

    Messages:
    93
    Is there any way to make tools usable when suit energy is 0? Ideally I would like to define one of each basic tool type that does not require energy and then leave the other tiers as they are.

    Reason:
    • I want to make it possible to bootstrap a base from nothing, so that a player who has lost everything, or spawned in just a suit, has a chance to survive, with a bit of hard work. I have everything set up for this apart from one issue: if you do not have a cockpit or medical room, or you do not have a power generator, your suit runs out of energy after a while. This means you can no longer dig resources, build structures or even grind parts out of existing structures.

    What I tried so far:
    • Suit energy is stored in the suit battery which is in MyCharacter.SuitBattery. MyCharacter is not accessible from the script api, and even if it were, the energy system is wildly complex and I would have to set up a chain of energy production and distribution components inside the suit to recharge it constantly.
    • The tool energy usage is a constant for all engineering tools and separate constant for the drill, stored in Sandbox.Game.MyGameConstants. I can not change this at runtime because it is constant. Even if I could change this I can not change this for some tools and not others.
    • The individual tools are set up from MyEngineerToolBase.Init(), this is where the tools energy usage is retrieved from the constant. MyEngineerToolBase is not accessible from the scripting API.
    • Tools use the object builder MyObjectBuilder_PhysicalGunObject. I can modify this in a script but I can not find a way to get from here to any kind of energy usage.

    What I have not tried:
    • Unlimited free energy: I can (and have) make the medical room free to build, but it requires enough energy to recharge the suit. I can make a free energy production block that can be attached to this and the player would then have unlimited energy for suit recharging. The problem with this is that there is nothing to prevent the player from using this unlimited free energy for everything else as well, removing energy from the game as a resource. I feel that energy is an important resource in survival so I do not want to do this.

    Summary:
    I need a way to reduce tool energy usage to 0 or to recharge the space suit without that energy being available for any other purpose. The game does not seem to support either of these. Anyone got any suggestions?
     
  2. BlackRedDead

    BlackRedDead Apprentice Engineer

    Messages:
    204
    well, the problem is the modapi restriction, guess we have to wait for keen to eigther open it to modding or doing theire job and fixing this logical issue!

    but whats with the way placing of a new ship works?
    could be such a "free" medical room and solar panel not implemented this way?
    with a check if the player already owns one or two (for the few cases where someone fails twice and the server doesnt reset ownership) to prevent abuse? - also we need a free refinery and assembler too then ;-) (i wish they could be just part of the player inventory!!! :-/ )

    all those (free stuff) needs resonable drawbacks that arent to high to allow resonable "fast" progression (to get out of the state) but are so low that the player wishes to get rigd of it in favor of real stuff ;-) (well, theres a bottom border ofc, if the calculation gets to low the player could run in a economical "state of stable decay" where he can never get out of it without help!)
    --- Automerge ---
    imaginary explanatory lore - or so...
    ...and if someone fails more than twice you can see it as a "3 lives" rule, if the player fails once he can try to dig himself out of it twice and if he fails again hes forced to ask for help by others or his game is just over! :p - well, only happens if the server doesnt reset ownership and the player left those blocks alife!^^ - he can still search them and grind them away!^^
     
  3. Duncan

    Duncan Trainee Engineer

    Messages:
    93
    I already have a free refinery and assembler. This was not difficult because I can set their power requirements. The issue with the medical bay recharge station is that I can not set it. This is all hard coded. The amount of power necessary to recharge a suit is high, and even having one block that produces enough to do this, would mean you could power your entire base for time when you are not recharging.
    I guess I will have to look into a dll mod. I think that might have less restrictions.

    I also have a plan for limited lives like you mention, although it is a little more complex than what you suggested.

    Ok it seems that .dll mods are not a thing. I am sure I remember reading about that somewhere as a way to distribute modified game code without waiting for pull requests. I guess I was wrong.
     
Thread Status:
This last post in this thread was made more than 31 days old.