My use case is, entity of one force gets placed on the spot where ghost of another force is present. This operation will remove the ghost.
Is is possible to detect that removed ghost this with an event?
I'm trying to do this:
Code: Select all
script.on_event(defines.events.on_entity_died, function(event)
if event.entity.force == game.forces.enemy and event.entity.type == "turret" then
for i, worm in pairs(global.surface_worms) do
if worm == event.entity then
table.remove(global.surface_worms, i)
break
end
end
elseif event.entity.type == "ghost" then
game.players[1].print("Ghost of " .. event.entity.name .. " destroyed ")
end
end, {{filter = "turret"}, {filter = "ghost"}})