mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
24 lines
1.1 KiB
Lua
24 lines
1.1 KiB
Lua
-- made by cooldude - this just adds a marker to the map which is removed when the body is removed
|
|
|
|
Event.register(defines.events.on_player_died, function(event)
|
|
local player = game.players[event.player_index]
|
|
local o = player.position
|
|
local entity = player.surface.find_entities_filtered{area={{o.x-1,o.y-1},{o.x+1,o.y+1}},name='character-corpse'}
|
|
table.insert(entity,nil)
|
|
local tag = player.force.add_chart_tag(player.surface,{
|
|
position=player.position,
|
|
text='Death: '..player.name..' ('..tick_to_display_format(event.tick)..')',
|
|
target=entity[1]
|
|
})
|
|
if not global.corpses then global.corpses = {} end
|
|
table.insert(global.corpses,tag)
|
|
end)
|
|
|
|
Event.register(defines.events.on_tick, function(event)
|
|
if (game.tick%3600) ~= 0 then return end
|
|
if not global.corpses then global.corpses = {} end
|
|
for key,tag in pairs(global.corpses) do
|
|
if not tag.valid then global.corpses[key] = nil return end
|
|
if not tag.target or not tag.target.valid then tag.destroy() global.corpses[key] = nil return end
|
|
end
|
|
end) |