Use only one shield battery per activation

  • I just cleared the campaign for the first time in years, and along the way I was reminded of one minor issue I've always had with FL- the length of time it takes for a shield to come back on after being knocked down. Using shield batteries is expensive and wasteful; for higher-tier ships a single activation can cost tens of thousands of credits when all you really needed was to jump-start the recharge process. Sometimes you're short of cash, or flying around in hostile space... for whatever reason, you need to stretch your supplies as far as possible.


    So, bearing in mind that I have zero practical experience with FL modding despite having been around since the demo:


    Obviously the game can recognize when the shield is full so it knows to only use a certain number of batteries, and it's possible to use batteries when you don't have enough to fill your shield, so there must be some function somewhere that decides how many batteries to use when the key is pressed. Is there some way to limit that function so that it only uses a single battery, no matter how many are available for use or what the shield's charge status is?


    Also, would it be possible to map two separate activation functions, one of which uses only a single battery, plus the stock full recharge function?

  • Here's a patch (for v1.1, as a BPatch file - new bytes on the left, original on the right) to use one complete battery at a time. Having two functions is possible, but will require a plugin, which I'm afraid will have to wait.


    Code
    1. File: Server.dll
    2. 00776C: 85 C0 0F 95 C0 0F B6 E8 EB 12 [ 8B E8 89 6C 24 58 DB 44 24 58 ]
  • Not so long a wait, after all. One Battery uses a normal key to use batteries as normal, a modified key (i.e. with Shift, Control or Alt) to use one battery. In SP it will make the above patch; in MP it will still use a partial battery, since it's controlled by the server. Hm, actually, I could probably make the client do the test and avoid calling the server. Oh well, next version...

  • Not so long a wait, after all. One Battery uses a normal key to use batteries as normal, a modified key (i.e. with Shift, Control or Alt) to use one battery. In SP it will make the above patch; in MP it will still use a partial battery, since it's controlled by the server. Hm, actually, I could probably make the client do the test and avoid calling the server. Oh well, next version...

    Could you do the same for using nanobots?

  • Do you mean one-at-a-time and/or not using a partial (and/or 50%)? I did consider it, but it didn't seem relevant for hull, since it doesn't regenerate itself. I guess if you have a plugin for a regenerative hull (or healing zone, repair guns) it could be useful.

  • It works with MP. In One Battery, I was able to prevent using a partial battery in SP, but the method I used would not work in MP (the test was done by the server). With Unit Repair, I do the necessary tests on the client, so now a partial bat/bot will not be used in MP, too. Hope that clears it up, unless you meant something else?


    In the testing and fine-tuning phase, then update the docs.