Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging #322

Merged
merged 12 commits into from
Sep 5, 2024
14 changes: 5 additions & 9 deletions modules/addons/logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Event.add(defines.events.on_pre_player_died, function(event)
if event and event.player_index then
if event.cause then
if event.cause.type and event.cause.type == 'character' and event.cause.player and event.cause.player.index then
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (game.players[event.cause.player.index].name or ' unknown reason'))
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (game.players[event.cause.player.index].name or 'unknown reason'))

else
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (event.cause.name or ' unknown reason'))
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (event.cause.name or 'unknown reason'))
end

else
Expand All @@ -40,15 +40,11 @@ Event.add(defines.events.on_research_finished, function(event)
return
end

if event.research.level and event.research.level > 1 then
if config_res.inf_res[event.research.name] and (event.research.level >= config_res.inf_res[event.research.name]) then
add_log('[RES] ' .. string.match(event.research.name, '^(.-)%-%d+$'):gsub('-', ' ') .. ' at level ' .. (event.research.level - 1) .. ' has been researched')
else
add_log('[RES] ' .. string.match(event.research.name, '^(.-)%-%d+$'):gsub('-', ' ') .. ' at level ' .. event.research.level .. ' has been researched')
end
if (event.research.level and config_res.inf_res[event.research.name]) and (event.research.level >= config_res.inf_res[event.research.name]) then
add_log('[RES] ' .. event.research.prototype.localised_name .. ' at level ' .. (event.research.level - 1) .. ' has been researched')

else
add_log('[RES] ' .. string.match(event.research.name, '^(.-)%-%d+$'):gsub('-', ' ') .. ' has been researched')
add_log('[RES] ' .. event.research.prototype.localised_name .. ' has been researched')
PHIDIAS0303 marked this conversation as resolved.
Show resolved Hide resolved
end
end
end)
Expand Down
Loading