Code: Select all
local damaged_entities = {}
script.on_event({defines.events.on_entity_damaged},
function (e)
local damaged_entity = e.entity
for entity, i in pairs(damaged_entities) do
if entity == damaged_entity and damaged_entities[entity] ~= damaged_entities[damaged_entity] then
game.players[1].print('broken')
end
end
damaged_entities[damaged_entity] = true
end
)