King's Turret Shields

by Kingdud

Forked from Turret-Shields by OwnlyMe. Cleaned up the code, removed a lot of options, internal tweaks to how power and damage affect the shield. Lightweight scripted shields with power consumption (configurable or researchable)

6 months ago
1.0 - 1.1
8949
Owner:
Kingdud
Source:
Kingdud/Factorio-Mods
Homepage:
N/A
License:
CC BY-SA 4.0
Created:
10 months ago
Latest Version:
1.110.0 (6 months ago)
Factorio version:
1.0 - 1.1
Downloaded:
8949 times

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

  1. 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

  1. The ability to have shields that don't use power is gone.
  2. All shield parameters are now startup settings
  3. 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!)
  4. 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.
  5. Shields no longer inherit the resistances of the turrets they are applied to.
  6. 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.
  7. Shield power usage is now tied to shield capacity, and scales correctly with shield size research (it does not in the original).
  8. Shield research (for size and recharge) now limited to level 100 for each explicitly, rather than via hidden function call.
  9. Disabled the 'ts refresh' command.
  10. Added a 'shieldstats' command to display the current HP, regen, and passive power drain of all shields.
  11. Shieldstats are also printed out automatically any time research is leveled up.

Known issues / Can't fix

  1. 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.
  2. 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