From 40d409dabd437b5737ed72aa8185b7ec990b35b1 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 25 Sep 2023 14:21:44 +0900 Subject: [PATCH 1/4] ignore alt mode of decon event in log --- modules/addons/deconlog.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/addons/deconlog.lua b/modules/addons/deconlog.lua index b44d5416..77496689 100644 --- a/modules/addons/deconlog.lua +++ b/modules/addons/deconlog.lua @@ -39,6 +39,10 @@ end) if config.decon_area then Event.add(defines.events.on_player_deconstructed_area, function (e) + if e.alt then + return + end + local player = game.get_player(e.player_index) if Roles.player_has_flag(player, "deconlog-bypass") then return From 90e629951089ea7483056c64cf880fe9a3ccccbd Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 25 Sep 2023 14:24:44 +0900 Subject: [PATCH 2/4] 2dp in gps display of message in decon log --- modules/addons/deconlog.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/addons/deconlog.lua b/modules/addons/deconlog.lua index 77496689..5d147921 100644 --- a/modules/addons/deconlog.lua +++ b/modules/addons/deconlog.lua @@ -21,7 +21,7 @@ local function pos_to_string(pos) end local function pos_to_gps_string(pos) - return '[gps=' .. tostring(pos.x) .. ',' .. tostring(pos.y) .. ']' + return '[gps=' .. string.format('%.1f', pos.x) .. ',' .. string.format('%.1f', pos.y) .. ']' end --- Print a message to all players who match the value of admin From b0827c7d3029c70875ab8ef8b69ef290f6a8c4bf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 25 Sep 2023 21:20:19 +0900 Subject: [PATCH 3/4] format number of amount display --- modules/addons/deconlog.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/addons/deconlog.lua b/modules/addons/deconlog.lua index 5d147921..fda7371b 100644 --- a/modules/addons/deconlog.lua +++ b/modules/addons/deconlog.lua @@ -4,6 +4,7 @@ local Event = require 'utils.event' --- @dep utils.event local Roles = require 'expcore.roles' --- @dep expcore.roles local format_time = _C.format_time +local format_time = _C.format_time --- @dep expcore.common local config = require 'config.deconlog' --- @dep config.deconlog local filepath = "log/decon.log" @@ -51,7 +52,7 @@ if config.decon_area then local items = e.surface.find_entities_filtered{area=e.area, force=player.force} if #items > 250 then - print_to_players(true, player.name .. ' tried to deconstruct the area ' .. pos_to_gps_string(e.area.left_top) .. ' to ' .. pos_to_gps_string(e.area.right_bottom) .. ' that have ' .. #items .. ' items, but were not allowed.') + print_to_players(true, player.name .. ' tried to deconstruct the area ' .. pos_to_gps_string(e.area.left_top) .. ' to ' .. pos_to_gps_string(e.area.right_bottom) .. ' that have ' .. format_number(#items) .. ' items, but were not allowed.') end add_log(get_secs() .. "," .. player.name .. ",decon_area," .. pos_to_string(e.area.left_top) .. "," .. pos_to_string(e.area.right_bottom)) From c6b153b5ebd3202d47cee18dd6bc8fbfcf52166f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 25 Sep 2023 23:20:41 +0900 Subject: [PATCH 4/4] fix --- modules/addons/deconlog.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/addons/deconlog.lua b/modules/addons/deconlog.lua index fda7371b..58f415f9 100644 --- a/modules/addons/deconlog.lua +++ b/modules/addons/deconlog.lua @@ -3,8 +3,8 @@ local Event = require 'utils.event' --- @dep utils.event local Roles = require 'expcore.roles' --- @dep expcore.roles -local format_time = _C.format_time local format_time = _C.format_time --- @dep expcore.common +local format_number = require('util').format_number --- @dep util local config = require 'config.deconlog' --- @dep config.deconlog local filepath = "log/decon.log"