Shield Generators

Adds turret shields and shield generators for civil structures.

9 days ago
a month ago
Latest Version:
0.0.11 (9 days ago)
Factorio version:
2413 times

This mod is in very alpha stage of development and can be save breaking! Report any issues you find.

This mod add Lua-driven shield generators for structures and also add internal Turret Shields (which render this mod virtually incompatible with Turret Shields mod and it's forks).

Shield generators work like one in Star Wars Galactic Battlegrounds, effectively doubling hitpoints of structures in work range, building up shield hitpoints from it's internal battery buffers.

Turret shields can be researched earlier and are researched separately from Shield generators, providing every turret with it's own shield.

Turret and Generator shields can be stacked, but Generator shields do not stack on each other.

Research include structures recipes unlock, Shield Generator shield recharge speed, Turret Shields shield recharge speed, Turret Shields battery recharge speed, Turret Shields battery capacity, and an end-game Superconducting Shields research, doubling shield capacity of shields generated by Shield Generators.

Shields have no drain due to performance concerns and being vanilla friendly (vanilla energy shields impose no drain), so if shield got charged it stay charged until taking damage.

This mod has somewhat heavy logic on Lua script side, but if it doesn't have to do anything, it doesn't even try to, so generally, UPS should be fine as long as nothing insane happens. If shields idle and can't do anything, they don't do anything in code.

Performance test:
2k turrets charging simultaneously: 9 ms script time from Turret Shields (which is a very rare case), and after they all charged update time drop to 0.003 ms.
Also, when building entities which can be shielded by shield generator, it search for shields, but it search them on Lua side without not using Factorio internal API (only if there are less than 400 shields total in game), so it should not tank performance due to Lua<->C++ overhead (which is huge in Factorio for some reason) in most cases.

Due to being Lua driven, if Wube whenever replace regular Lua with LuaJIT, this mod will experience at least 8 times speedup (tested with LuaJIT 2.1 beta x64 build). Main barrier for Wube for incorporating LuaJIT is that LuaJIT is being Lua 5.1, while Factorio use Lua 5.2+ features, such as native integers without FFI

Discord server

Sources can be found there