Turret Shields deprecated

by OwnlyMe

Lightweight scripted shields with power consumption for all turrets (configurable or researchable)

Content
4 years ago
0.16 - 0.18
127
Combat

b Two Bugs

6 years ago

Hi OwnlyMe,

I made a force = "enemy" base using turrets with enabled turret shields. After some combat i got two different errors, each referencing to the same line of code:

Error while running event Turret-Shields::on_entity_damaged (ID 97)
Turret-Shields/control.lua:67: bad argument #1 to 'insert' (table expected, got nil)

Same with the following one:

Error while running event Turret-Shields::on_robot_built_entity (ID 14)
Turret-Shields/control.lua:67: bad argument #1 to 'insert' (table expected, got nil)

The table "global.refresh_orientation" is nil, because i gave the enemy force the techs in the "on_init" event, which triggered no "on_research_finished" event. Would you please add some kind of safety check? This would be great!

Regards
Arcitos

6 years ago
(updated 6 years ago)

sorry, that line indeed caused some errors.
the force seems to have been initialized and enabled with the shields.
only each single turret was not initialized, because they were script-created.
do you have the research setting enabled?
that it isnt enabled is the only cause i could think of which would make the force have shields enabled (if the on_research didnt fire)
if the research setting was enabled, it would be nice if you could send me your mod so i can better understand what's going on inside.
you can still enter "ts refresh" in the console to update the forces so their shields match their research level.
anyway, the line 67 bug will be fixed in version .27
thank you very much for your report.

New response