Shield Generators


Adds turret shields and shield generators for civil structures.

Content
a month ago
1.1 - 2.0
29.9K
Combat

b Crash since 3.0

2 years ago

Everyone once in a while I get the following crash,a dn it looks like it might be just after a robot builds a turret (from a ghost).

579.887 Error MainLoop.cpp:1285: Exception at tick 39407680: The mod Shield Generators (0.3.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event shield-generators::on_tick (ID 0)
shield-generators/control.lua:831: attempt to perform arithmetic on field 'last_damage_bar' (a nil value)
stack traceback:
shield-generators/control.lua:831: in function <shield-generators/control.lua:584>

Happy to provide any more info (I'm running Krastiorio & SE2, plus a few other mods). Unfortunately it's not easily replicate-able, it just seems to happen every once in a while

2 years ago

Yeah, every time it happens it's when a robot tries to build a turret, either from a blueprint or because it's been destroyed.

It's really quick and very dirty, but I added this code into control.lua (at line 830) which has allowed me to continue playign this save until you come up with a fix (and can I say, I absolutely LOVE this mod !)

-- Added to fix crash on robot build
if tracked_data.last_damage_bar == nil then
tracked_data.last_damage_bar = 0
end
if tracked_data.last_damage == nil then
tracked_data.last_damage = 0
end
-- end
-- this was line 830
if tick - tracked_data.last_damage > VISUAL_DAMAGE_BAR_WAIT_TICKS or tick - tracked_data.last_damage_bar > VISUAL_DAMAGE_BAR_WAIT_TICKS_MAX then

2 years ago
(updated 2 years ago)

This is a symptom and not the cause, and you treat the symptom.

d530aee56c358e997780dec658eda981c5d5e703 (0.3.1) should try to address this (add tick to structs that have it missing), or at least narrow down the cause (throw errors earlier than this with cause)

2 years ago

Yeah, my fix was just because I was unable to play as the game kept crashing (typically 30 seconds after the autosave). I'll download your update and let you know if I encounter any more issues. Thanks for the quick response (did I mention it's a great mod?)

2 years ago
(updated 2 years ago)

Looks like the problem still exists in 0.3.1, but in a slightly different place. This error occured immediate;y after completing research on superconducting shields:

5114.648 Error MainLoop.cpp:1283: Exception at tick 51575858: The mod Shield Generators (0.3.1) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event shield-generators::on_tick (ID 0)
shield-generators/control.lua:651: attempt to perform arithmetic on field 'last_damage' (a nil value)
stack traceback:
shield-generators/control.lua:651: in function <shield-generators/control.lua:588>

2 years ago

updated migration

New response