Add General Logging (#322)

* Update logging.lua

* Update logging.lua

* Update logging.lua

* Update logging.lua

* Update logging.lua

* Update addons.cfg

* Update addons.cfg

* Update addons.cfg

* Update logging.lua

* Update logging.lua
This commit is contained in:
2024-09-06 03:52:17 +09:00
committed by GitHub
parent 1de395b614
commit d23064992d
4 changed files with 19 additions and 10 deletions

View File

@@ -87,5 +87,9 @@ jail=__1__ was jailed because they removed too many protected entities. Please w
[nukeprotect] [nukeprotect]
found=You cannot have __1__ in your inventory, so it was placed into the chests at spawn. 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
[deconlog] [deconlog]
decon=__1__ tried to deconstruct on __2__ from __3__ to __4__ which has __5__ items. decon=__1__ tried to deconstruct on __2__ from __3__ to __4__ which has __5__ items.

View File

@@ -87,5 +87,9 @@ jail=__1__ 因被多次拆除受保護物體而被禁止行動。請等候管理
[nukeprotect] [nukeprotect]
found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。 found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。
[logging]
add-l=[RES] __1__ at level __2__ has been researched
add-n=[RES] __1__ has been researched
[deconlog] [deconlog]
decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。 decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。

View File

@@ -87,5 +87,9 @@ jail=__1__ 因被多次拆除受保護物體而被禁止行動。請等候管理
[nukeprotect] [nukeprotect]
found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。 found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。
[logging]
add-l=[RES] __1__ at level __2__ has been researched
add-n=[RES] __1__ has been researched
[deconlog] [deconlog]
decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。 decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。

View File

@@ -7,7 +7,8 @@ local config = require 'config.logging' --- @dep config.logging
local config_res = require 'config.research' --- @dep config.research local config_res = require 'config.research' --- @dep config.research
local function add_log(data) local function add_log(data)
game.write_file(config.file_name, data .. '\n', true, 0) game.write_file(config.file_name, data, true, 0)
game.write_file(config.file_name, '\n', true, 0)
end end
Event.add(defines.events.on_rocket_launched, function(event) Event.add(defines.events.on_rocket_launched, function(event)
@@ -40,15 +41,11 @@ Event.add(defines.events.on_research_finished, function(event)
return return
end end
if event.research.level and event.research.level > 1 then if (event.research.level and config_res.inf_res[event.research.name]) and (event.research.level >= config_res.inf_res[event.research.name]) then
if 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})
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
else 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 end
end) end)