Code: Select all
on_entity_died
Called when an entity dies.
Contains
entity :: LuaEntity
force :: LuaForce (optional): The force that did the killing if any.
Code: Select all
on_entity_died
Called when an entity dies.
Contains
entity :: LuaEntity
force :: LuaForce (optional): The force that did the killing if any.
Rseding91 wrote:Added for 0.15. It's an optional field as it's not always available.
Code: Select all
script.on_event(defines.events.on_marked_for_deconstruction, function(event)
-- on_marked_for_deconstruction
-- Called when an entity is marked for deconstruction with the Deconstruction planner or via script.
-- Contains
-- entity :: LuaEntity
-- player_index :: uint (optional)
local player_index = event.player_index
local entity = event.entity
if not entity.last_user then return end
printAll("Last user: " .. entity.last_user.index)
end)