Turret Shields

by OwnlyMe

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

Content
3 years ago
0.16 - 0.18
109
Combat

g Unplugged shield not removed on deconstruct

3 years ago
(updated 3 years ago)

Factorio v0.17.79, Turret Shields v0.17.39

My issue of this is due to Construction Drones not raising mined events or something when they deconstruct things. With most turrets this isn't a problem, as Turret Shields seems to auto-remove shields that aren't on a turret when they're unpowered - unless they were turned off:

using the "ts refresh" command refreshes turrets, but it doesn't remove these shields...

working with the command here: https://mods.factorio.com/mod/Turret-Shields/discussion/5d1aa04856d0c1000d927f87
I've found they're different entities, so I modified it a bit to get it to work, so for anyone else with this problem:

/c for _, ent in pairs(game.player.surface.find_entities_filtered{name = "ts-unplugged"}) do
    local turrets = ent.surface.find_entities_filtered{type = {"ammo-turret","fluid-turret","electric-turret"}, position = ent.position}
    if #turrets ==0 then
        ent.destroy()
    end
end

New response