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
4 changes: 4 additions & 0 deletions locale/en/addons.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ jail=__1__ was jailed because they removed too many protected entities. Please w

[nukeprotect]
found=You cannot have __1__ in your inventory, so it was placed into the chests at spawn.

[logging]
add-l=[RES] __1__ at level __2__ has been researched
add-n=[RES] __1__ has been researched
4 changes: 4 additions & 0 deletions locale/zh-CN/addons.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ jail=__1__ 因被多次拆除受保護物體而被禁止行動。請等候管理

[nukeprotect]
found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。

[logging]
add-l=[RES] __1__ at level __2__ has been researched
add-n=[RES] __1__ has been researched
4 changes: 4 additions & 0 deletions locale/zh-TW/addons.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ jail=__1__ 因被多次拆除受保護物體而被禁止行動。請等候管理

[nukeprotect]
found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。

[logging]
add-l=[RES] __1__ at level __2__ has been researched
add-n=[RES] __1__ has been researched
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({'logging.add-l', event.research.prototype.localised_name, event.research.level - 1})

else
add_log('[RES] ' .. string.match(event.research.name, '^(.-)%-%d+$'):gsub('-', ' ') .. ' has been researched')
add_log({'logging.add-n', event.research.prototype.localised_name})
end
end
end)
Expand Down
Loading