A remix of the Turret Shields mod from OwnlyMe. It makes numerous changes, mostly on the backend / inside the mod code. The notable results:
Performance
- The mod is around 100x faster than original mod, due in large part to onTick() being simplified to a few lines of code that only run on elements that they need to run on. In my savegame the original mod took around .4ms / tick for 1800 turrets, mine takes .004ms/tick.
Changes
- The ability to have shields that don't use power is gone.
- All shield parameters are now startup settings
- The setting for 'rate of drain when shield loses power' is gone. The shield will drain naturally due to the power drain inherent to powering a shield. A separate setting for this was redundant (and more work to code!)
- Shield values now have a (configurable) base HP and recharge rate, and a number of 'steps per order of magnitude'. Thus, a shield with 200 base HP and 5 steps of size would become a shield with 2000 HP by size research level 5. And 20,000 HP by research 10. Research cost scales according to a similar formula.
- Shields no longer inherit the resistances of the turrets they are applied to.
- Partial damage (some taken by shield, rest to turret) correctly factors in the turret's resistances only for the part of damage going to the turret itself.
- Shield power usage is now tied to shield capacity, and scales correctly with shield size research (it does not in the original).
- Shield research (for size and recharge) now limited to level 100 for each explicitly, rather than via hidden function call.
- Disabled the 'ts refresh' command.
- Added a 'shieldstats' command to display the current HP, regen, and passive power drain of all shields.
- Shieldstats are also printed out automatically any time research is leveled up.
Known issues / Can't fix
- I cannot find a way to add current shield stats to the bonus window, that's why you get a chat command and auto-printout on level-up.
- The mod should work in multiplayer, but it was not tested there. Use OwnlyMe's mod if you wish to do multiplayer and mine doesn't work.
Original mod: https://mods.factorio.com/mod/Turret-Shields