1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Added debug output to on_player_died

This commit is contained in:
Valansch 2017-10-27 23:18:26 +02:00
parent 8c98491577
commit b30d20c5c5
2 changed files with 14 additions and 3 deletions

View File

@ -30,7 +30,7 @@ local function on_player_deconstructed_area(event)
end
local function log_on_player_mined_entity(str, event)
game.write_file("on_plalyer_mined_entity_debug", game.tick .. " (" .. game.players[event.player_index].name .. ") " .. str .. "\n", true, 1)
game.write_file("on_player_mined_entity_debug", game.tick .. " (" .. game.players[event.player_index].name .. ") " .. str .. "\n", true, 0)
end
global.on_player_mined_item_enabled = true

View File

@ -399,12 +399,23 @@ function player_list_on_12_seconds()
end
end
local function player_list_on_player_died( event_player, cause )
player = game.players[event_player.player_index]
local function log_on_player_died_debug(str, event)
local cause = event.cause or {name = "no cause"}
game.write_file("on_player_died_debug", game.tick .. " (" .. game.players[event.player_index].name .. ", cause: " .. cause.name .. ") " .. str .. "\n", true, 1)
end
local function player_list_on_player_died(event)
log_on_player_died_debug("entry", event)
local player = game.players[event.player_index]
log_on_player_died_debug("player", event)
if not global.scenario.variables.player_deaths[player.name] then
log_on_player_died_debug("if", event)
global.scenario.variables.player_deaths[player.name] = 0
log_on_player_died_debug("deaths zero", event)
end
log_on_player_died_debug("deaths ++", event)
global.scenario.variables.player_deaths[player.name] = global.scenario.variables.player_deaths[player.name] + 1
log_on_player_died_debug("exit", event)
end