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)

Content
2 years ago
1.0 - 1.1
6.89K
Combat

g 1.110.0 causing crashes

3 years ago

The mod King's Turret Shields (1.110.0) caused a non-recoverable error.
Please report this error to the mod author.
I get the below error:

Error while running event KingsTurret-Shields::on_entity_damaged (ID 98)
KingsTurret-Shields/prototypes/functions.lua:182: attempt to index field 'immuneUntil' (a nil value)
stack traceback:
KingsTurret-Shields/prototypes/functions.lua:182: in function 'handleDamageEvent'
KingsTurret-Shields/control.lua:354: in function <KingsTurret-Shields/control.lua:340>

3 years ago

Commented out that function in the mod and was working until trying to build new turrets via robots and got the following:

The mod King's Turret Shields (1.110.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event KingsTurret-Shields::on_robot_built_entity (ID 14)
KingsTurret-Shields/control.lua:329: attempt to index field 'immuneUntil' (a nil value)
stack traceback:
KingsTurret-Shields/control.lua:329: in function <KingsTurret-Shields/control.lua:318>

3 years ago

Error while running event KingsTurret-Shields::on_built_entity (ID 6)
KingsTurret-Shields/control.lua:329: attempt to index field 'immuneUntil' (a nil value)
stack traceback:
KingsTurret-Shields/control.lua:329: in function <KingsTurret-Shields/control.lua:318>

additional badness

https://justpaste.me/5sYv <---log

3 years ago
(updated 3 years ago)

Currently testing a local version that uses some extra nil checks wrapped around those lines where the index is used:

control.lua:329
if global.immuneUntil[entity.unit_number] ~= nil then
global.immuneUntil[entity.unit_number] = event.tick+60
end

functions.lua:182
--Take no damage if immune.
if global.immuneUntil[event.entity.unit_number] ~= nil then
if global.immuneUntil[event.entity.unit_number] and global.immuneUntil[event.entity.unit_number] > event.tick then
event.entity.health = event.entity.health + event.final_damage_amount
return
elseif global.immuneUntil[event.entity.unit_number] and global.immuneUntil[event.entity.unit_number] <= event.tick then
global.immuneUntil[event.entity.unit_number] = nil
end
end

formatting is bad here so https://pastebin.com/Qc1w3Ry7

3 years ago

good job

3 years ago

I am having this issue as well please help

3 years ago

Yeah same here, all my games having the issue when attacked by bugs.

New response