Here is my current code
Code: Select all
on_entity_died = function ( entity, cause, force )
s = ""
if ((not entity == nil) and (entity.valid)) then
s = s .. entity.name
else
s = s .. "Unknown entity"
end
s = s .. " died because of "
if ((not cause == nil) and (cause.valid)) then
s = s .. cause.name
else
s = s .. " unknown cause "
end
s = s .. " in faction "
if ((not force == nil) and (force.valid)) then
s = s .. force.name
else
s = s .. " unknown force"
end
game.print(s);
end
on_player_died = function ( player_index , cause )
s = "Player " .. tostring(player_index) .. " died because of "
if ((not cause == nil) and (cause.valid)) then
s = s .. cause.name
else
s = s .. " unknown cause"
end
game.print(s);
end
script.on_event(defines.events.on_entity_died, on_entity_died)
script.on_event(defines.events.on_player_died, on_player_died)
script.on_event(defines.events.on_pre_player_died, on_player_died)
However, whenever I kill myself the only printouts I get are

I've tried killing myself via biters, nukes and trains: same result.
I've tried killing biters via turrets, smg, personal laser defence and nuke: same result (except that only on_entity_died fired of course).
I understand that the additional info is optional, but there never seems to be any info. So either I'm missing something or these events are broken