1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00

utils/server.lua: don't assume player association

Until now, it was assumed that entity "character" was player associated.
While this is true in 99% of cases, mods that allows NPCs are not
associated with a player and thus when they kill, error happens.

This patch adds additional check.
This commit is contained in:
cogito123 2020-01-03 20:52:01 +01:00 committed by cogito
parent 3d95d8d633
commit 44bed491ea

View File

@ -730,7 +730,7 @@ Event.add(
message[#message + 1] = ' was killed by '
local name = cause.name
if name == 'character' then
if name == 'character' and cause.player then
name = cause.player.name
end