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

g Electric symbol flashing left behind

5 years ago
(updated 5 years ago)

OwnlyMe, First off, not complaining! I love this mod and everything you've done to it. This may be a conflict with another mod, I have several, but wanted to throw it up here to get your mind going. So, when I place a turret down and pick it up again sometimes it leaves the flashing blinking "needs electricity" symbol behind. I'm guessing its a conflict with some other mod because I just noticed that its doing it with some of the solar walls I've placed as well. Penny for your thoughts? TY! Factorio Community #1
It also won't let me place anything down where its blinking so its a unusable space.

5 years ago
(updated 5 years ago)

must be some mod that destroys entities on the mined event, so the event doesn't fire for other mods anymore.
i'd need your savegame to find out what mod is causing this, but it's definitively a problem that the other mod would need to fix.

actually even if the event doesn't fire, the entity should get removed on the next electricity check..

also, my electric-energy-interfaces shouldn't cause this issue with the collision box, as they have the collision_mask "floor-layer" (gonna remove that on the next update cause it's unnecessary)

the "ts refresh" command probably doesn't remove it, or?

5 years ago

Just tried "ts refresh" no luck. I know this isn't an issue with your mod and appreciate you replying. Thanks

5 years ago

this script should destroy all electric interfaces by my mod (if they have no turret)
/c
entities = game.player.surface.find_entities_filtered{type = "electric-energy-interface"}
for _, ent in pairs(entities) do
if ent.name:sub(1,22) == "ts-electric-interface-" then
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
end

5 years ago

maybe its fixed now?

5 years ago

Tried with the following code in LuaCombinator in single player world, and got a fatal error:

entities = game.players[1].surface.find_entities_filtered{type = "electric-energy-interface"}
for _, ent in pairs(entities) do
   if ent.name:sub(1,22) == "ts-electric-interface-" then
      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
end
Error while running event Turret-Shields::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
    __Turret-Shields__/on_tick.lua:182: in function <__Turret-Shields__/on_tick.lua:1>
stack traceback:
    [C]: in function '__index'
    __Turret-Shields__/on_tick.lua:182: in function <__Turret-Shields__/on_tick.lua:1>
5 years ago
(updated 5 years ago)

is it still necessary to use this code? i thought i fixed the leftovers
the code seems to think the turret is still valid... maybe it got moved?

5 years ago

Similar bug with Warptorio harvest platforms. Might give some insight? Tried your script, got rid of the bounding boxes, but the entity shield bar shows as still there. Here's a screenshot. https://i.imgur.com/MlbwITR.jpg Might need to poke PyroFire for some compatibility though.

5 years ago

were they destroyed? (within the last 3 versions?)
if they were just moved all i can do is add those to the exclusion list

5 years ago

moved, but ended up having to remove the mod cause it crashed every time i researched a warptorio tech.

5 years ago

Do you have any error message for me?

New response