mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Migration for new helpers library
This commit is contained in:
@@ -7,11 +7,13 @@ local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local format_number = require("util").format_number --- @dep util
|
||||
local config = require("modules.exp_legacy.config.deconlog") --- @dep config.deconlog
|
||||
|
||||
local write_file = helpers.write_file
|
||||
|
||||
local filepath = "log/decon.log"
|
||||
local seconds_time_format = ExpUtil.format_time_factory{ format = "short", hours = true, minutes = true, seconds = true }
|
||||
|
||||
local function add_log(data)
|
||||
game.write_file(filepath, data .. "\n", true, 0) -- write data
|
||||
write_file(filepath, data .. "\n", true, 0) -- write data
|
||||
end
|
||||
|
||||
local function get_secs()
|
||||
@@ -36,7 +38,7 @@ local function print_to_players(admin, message)
|
||||
end
|
||||
|
||||
Event.on_init(function()
|
||||
game.write_file(filepath, "\n", false, 0) -- write data
|
||||
write_file(filepath, "\n", false, 0) -- write data
|
||||
end)
|
||||
|
||||
if config.decon_area then
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
|
||||
local write_file = helpers.write_file
|
||||
|
||||
-- Clear the file on startup to minimize its size
|
||||
Event.on_init(function()
|
||||
game.write_file("fagc-actions.txt", "", false, 0)
|
||||
write_file("fagc-actions.txt", "", false, 0)
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_player_banned, function(e)
|
||||
local text = "ban;" .. e.player_name .. ";" .. (e.by_player or "") .. ";" .. (e.reason or "") .. "\n"
|
||||
game.write_file("fagc-actions.txt", text, true, 0)
|
||||
write_file("fagc-actions.txt", text, true, 0)
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_player_unbanned, function(e)
|
||||
local text = "unban;" .. e.player_name .. ";" .. (e.by_player or "") .. ";" .. (e.reason or "") .. "\n"
|
||||
game.write_file("fagc-actions.txt", text, true, 0)
|
||||
write_file("fagc-actions.txt", text, true, 0)
|
||||
end)
|
||||
|
||||
@@ -6,9 +6,11 @@ local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.logging") --- @dep config.logging
|
||||
local config_res = require("modules.exp_legacy.config.research") --- @dep config.research
|
||||
|
||||
local write_file = helpers.write_file
|
||||
|
||||
local function add_log(data)
|
||||
game.write_file(config.file_name, data, true, 0)
|
||||
game.write_file(config.file_name, "\n", true, 0)
|
||||
write_file(config.file_name, data, true, 0)
|
||||
write_file(config.file_name, "\n", true, 0)
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_rocket_launched, function(event)
|
||||
|
||||
Reference in New Issue
Block a user