1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Add player leave reasons

This commit is contained in:
James Gillham 2020-12-31 22:04:40 +00:00
parent 745cc6a894
commit 7545a41e52

View File

@ -741,13 +741,28 @@ Event.add(defines.events.on_player_joined_game, function(event)
raw_print(player_join_tag .. player.name)
end)
local leave_reason_map = {
[defines.disconnect_reason.quit] = '',
[defines.disconnect_reason.dropped] = ' (Dropped)',
[defines.disconnect_reason.reconnect] = ' (Reconnect)',
[defines.disconnect_reason.wrong_input] = ' (Wrong input)',
[defines.disconnect_reason.desync_limit_reached] = ' (Desync limit reached)',
[defines.disconnect_reason.cannot_keep_up] = ' (Cannot keep up)',
[defines.disconnect_reason.afk] = ' (AFK)',
[defines.disconnect_reason.kicked] = ' (Kicked)',
[defines.disconnect_reason.kicked_and_deleted] = ' (Kicked)',
[defines.disconnect_reason.banned] = ' (Banned)',
[defines.disconnect_reason.switching_servers] = ' (Switching servers)'
}
Event.add(defines.events.on_player_left_game, function(event)
local player = game.get_player(event.player_index)
if not player then
return
end
raw_print(player_leave_tag .. player.name)
local reason = leave_reason_map[event.reason] or ''
raw_print(player_leave_tag .. player.name .. reason)
end)
Event.add(defines.events.on_player_died, function(event)