From bd742bc137485c8b91bd4729f591a16ef90ebea9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 14:58:04 +0900 Subject: [PATCH 01/17] Update surface.lua --- exp_scenario/module/commands/surface.lua | 64 +++++++++++++++++------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index 5bcdeab97d..abe003d758 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -2,11 +2,16 @@ Adds a command that clear item on ground so blueprint can deploy safely ]] +local AABB = require("modules/exp_util/aabb") +local Commands = require("modules/exp_commands") local ExpUtil = require("modules/exp_util") local move_items = ExpUtil.move_items_to_surface - -local Commands = require("modules/exp_commands") local format_player_name = Commands.format_player_name_locale +local Selection = require("modules/exp_util/selection") +local SelectArea = Selection.connect("ExpCommand_ClearBlueprint") + +--- @class ExpCommand_ClearBlueprint.commands +local commands = {} --- @param surface LuaSurface --- @return LuaItemStack[] @@ -20,7 +25,7 @@ local function get_ground_items(surface) end --- Clear all items on the ground, optional to select a single surface -Commands.new("clear-ground-items", { "exp-commands_surface.description-items" }) +commands.clear_ground_items = Commands.new("clear-ground-items", { "exp-commands_surface.description-items" }) :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) :register(function(player, surface) --- @cast surface LuaSurface? @@ -47,7 +52,7 @@ Commands.new("clear-ground-items", { "exp-commands_surface.description-items" }) end) --- Clear all blueprints, optional to select a single surface -Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" }) +commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprints" }) :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) :register(function(player, surface) --- @cast surface LuaSurface? @@ -70,20 +75,41 @@ Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" end) --- Clear all blueprints in a radius around you -Commands.new("clear-blueprints-radius", { "exp-commands_surface.description-radius" }) - :argument("radius", { "exp-commands_surface.arg-radius" }, Commands.types.number_range(1, 100)) - :register(function(player, radius) - --- @cast radius number - local player_name = format_player_name(player) - local entities = player.surface.find_entities_filtered{ - type = "entity-ghost", - position = player.position, - radius = radius, - } - - for _, entity in ipairs(entities) do - entity.destroy() +--- Toggle player selection mode +--- @class ExpCommands_ClearBlueprint.commands.clear_blueprints: ExpCommand +--- @overload fun(player: LuaPlayer) +commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" }) + :register(function(player) + if SelectArea:stop(player) then + return Commands.status.success{ "exp-commands_waterfill.exit" } end + SelectArea:start(player) + return Commands.status.success{ "exp-commands_waterfill.enter" } + end) --[[ @as any ]] - game.print{ "exp-commands_surface.blueprint-radius", player_name, radius, player.surface.localised_name } - end) +--- When an area is selected to be converted +SelectArea:on_selection(function(event) + local area = AABB.expand(event.area) + local player = game.players[event.player_index] + local player_name = format_player_name(player) + local surface = event.surface + + local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) + + if area_size > 1000 then + player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error) + return + end + + local entities = surface.find_entities_filtered{ type = "entity-ghost", area = area } + + for _, entity in ipairs(entities) do + entity.destroy() + end + + player.print({ "exp-commands_waterfill.complete", #entities }, Commands.print_settings.default) +end) + +return { + commands = commands, +} From 49843ab1803aa66aa7da21d180863b34a3f02bbc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:01:23 +0900 Subject: [PATCH 02/17] Update en.cfg --- exp_scenario/module/locale/en.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index c75a927db4..7fe5d56da0 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -223,12 +223,14 @@ description-items=Clear all items on the ground. description-blueprints=Clear all blueprints. description-radius=Clear all blueprints in an radius around you. arg-surface=Surface to clear on, default all. -arg-radius=Radius to clear. items-surface=__1__ cleared all items on the ground of __2__. items-all=__1__ cleared all items on the ground for all surfaces. blueprints-surface=__1__ cleared all blueprints on __2__. blueprints-all=__1__ cleared all blueprints for all surfaces. -blueprints-radius=__1__ cleared all blueprints in a __2__ radius around them on __3__. +enter=Entered selection mode, select the area. +exit=Exited selection mode. +area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. +complete=__1__ tiles were handled. [exp-commands_trains] description=Set All Trains to Automatic, does not effect trains with passengers. From 5b30364b7d2615e846285a8a371ca8c7aef880f4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:08:39 +0900 Subject: [PATCH 03/17] Update surface.lua --- exp_scenario/module/commands/surface.lua | 69 +++++++----------------- 1 file changed, 19 insertions(+), 50 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index abe003d758..057fe2b32b 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -6,7 +6,6 @@ local AABB = require("modules/exp_util/aabb") local Commands = require("modules/exp_commands") local ExpUtil = require("modules/exp_util") local move_items = ExpUtil.move_items_to_surface -local format_player_name = Commands.format_player_name_locale local Selection = require("modules/exp_util/selection") local SelectArea = Selection.connect("ExpCommand_ClearBlueprint") @@ -25,53 +24,25 @@ local function get_ground_items(surface) end --- Clear all items on the ground, optional to select a single surface -commands.clear_ground_items = Commands.new("clear-ground-items", { "exp-commands_surface.description-items" }) - :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) - :register(function(player, surface) - --- @cast surface LuaSurface? - local player_name = format_player_name(player) - if surface then - move_items{ - surface = surface, - items = get_ground_items(surface), - allow_creation = true, - name = "iron-chest", - } - game.print{ "exp-commands_surface.items-surface", player_name, surface.localised_name } - else - for _, surface in pairs(game.surfaces) do - move_items{ - surface = surface, - items = get_ground_items(surface), - allow_creation = true, - name = "iron-chest", - } - end - game.print{ "exp-commands_surface.items-all", player_name } - end +commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_surface.description-items" }) + :register(function(player) + move_items{ + surface = player.surface, + items = get_ground_items(player.surface), + allow_creation = true, + name = "iron-chest", + } + game.print{ "exp-commands_surface.item" } end) --- Clear all blueprints, optional to select a single surface commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprints" }) - :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) - :register(function(player, surface) - --- @cast surface LuaSurface? - local player_name = format_player_name(player) - if surface then - local entities = surface.find_entities_filtered{ type = "entity-ghost" } - for _, entity in ipairs(entities) do - entity.destroy() - end - game.print{ "exp-commands_surface.blueprint-surface", player_name, surface.localised_name } - else - for _, surface in pairs(game.surfaces) do - local entities = surface.find_entities_filtered{ type = "entity-ghost" } - for _, entity in ipairs(entities) do - entity.destroy() - end - end - game.print{ "exp-commands_surface.blueprint-all", player_name } + :register(function(player) + local entities = player.surface.find_entities_filtered{ type = "entity-ghost" } + for _, entity in ipairs(entities) do + entity.destroy() end + game.print{ "exp-commands_surface.blueprint" } end) --- Clear all blueprints in a radius around you @@ -81,23 +52,21 @@ commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { " commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" }) :register(function(player) if SelectArea:stop(player) then - return Commands.status.success{ "exp-commands_waterfill.exit" } + return Commands.status.success{ "exp-commands_surface.exit" } end SelectArea:start(player) - return Commands.status.success{ "exp-commands_waterfill.enter" } + return Commands.status.success{ "exp-commands_surface.enter" } end) --[[ @as any ]] ---- When an area is selected to be converted +--- When an area is selected SelectArea:on_selection(function(event) local area = AABB.expand(event.area) local player = game.players[event.player_index] - local player_name = format_player_name(player) local surface = event.surface - local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) if area_size > 1000 then - player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error) + player.print({ "exp-commands_surface.area-too-large", 1000, area_size }, Commands.print_settings.error) return end @@ -107,7 +76,7 @@ SelectArea:on_selection(function(event) entity.destroy() end - player.print({ "exp-commands_waterfill.complete", #entities }, Commands.print_settings.default) + player.print({ "exp-commands_surface.complete", #entities }, Commands.print_settings.default) end) return { From 021734b27901b33bb0769131f2e97cece644bdd4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:09:19 +0900 Subject: [PATCH 04/17] Update en.cfg --- exp_scenario/module/locale/en.cfg | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 7fe5d56da0..e33db996a9 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -219,14 +219,10 @@ arg-player=Player to start following. follow-self=You can not follow yourself. [exp-commands_surface] -description-items=Clear all items on the ground. -description-blueprints=Clear all blueprints. -description-radius=Clear all blueprints in an radius around you. -arg-surface=Surface to clear on, default all. -items-surface=__1__ cleared all items on the ground of __2__. -items-all=__1__ cleared all items on the ground for all surfaces. -blueprints-surface=__1__ cleared all blueprints on __2__. -blueprints-all=__1__ cleared all blueprints for all surfaces. +description-item=Clear all items on the ground. +description-blueprint=Clear all blueprints. +item=Cleared the items found on the current surface. +blueprint=Cleared the blueprints found on the current surface. enter=Entered selection mode, select the area. exit=Exited selection mode. area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. From a53d4a4201c0d156f15c2d8b665197685913696d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:09:26 +0900 Subject: [PATCH 05/17] Fix description keys for ground items and blueprints --- exp_scenario/module/commands/surface.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index 057fe2b32b..ad7abd94b6 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -24,7 +24,7 @@ local function get_ground_items(surface) end --- Clear all items on the ground, optional to select a single surface -commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_surface.description-items" }) +commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_surface.description-item" }) :register(function(player) move_items{ surface = player.surface, @@ -36,7 +36,7 @@ commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_ end) --- Clear all blueprints, optional to select a single surface -commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprints" }) +commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprint" }) :register(function(player) local entities = player.surface.find_entities_filtered{ type = "entity-ghost" } for _, entity in ipairs(entities) do @@ -49,7 +49,7 @@ commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { " --- Toggle player selection mode --- @class ExpCommands_ClearBlueprint.commands.clear_blueprints: ExpCommand --- @overload fun(player: LuaPlayer) -commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" }) +commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprint" }) :register(function(player) if SelectArea:stop(player) then return Commands.status.success{ "exp-commands_surface.exit" } From c1ab393239eeb59ef68b9bddc36af48873c4967c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:12:28 +0900 Subject: [PATCH 06/17] Update roles.lua --- exp_legacy/module/config/expcore/roles.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index a392953f99..9393b80665 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -125,7 +125,7 @@ Roles.new_role("Trainee", "TrMod") "command/search-online", "command/search-amount", "command/search-recent", - "command/clear-blueprints", + "command/clear-blueprint-surface", "gui/playerdata", } @@ -203,8 +203,8 @@ Roles.new_role("Veteran", "Vet") :set_parent("Member") :allow{ "command/chat-commands", - "command/clear-ground-items", - "command/clear-blueprints-radius", + "command/clear-ground-item", + "command/clear-blueprint", "command/set-trains-to-automatic", "command/set-auto-research", } From 9922b14e877e7d5f9822d87c34146c6aeac9ea7f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:13:02 +0900 Subject: [PATCH 07/17] Update surface.lua --- exp_scenario/module/commands/surface.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index ad7abd94b6..ceb0f7b6f0 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -23,8 +23,8 @@ local function get_ground_items(surface) return items end ---- Clear all items on the ground, optional to select a single surface -commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_surface.description-item" }) +--- Clear all item on the ground on a single surface +commands.clear_ground_item = Commands.new("clear-ground-item", { "exp-commands_surface.description-item" }) :register(function(player) move_items{ surface = player.surface, @@ -35,8 +35,8 @@ commands.clear_ground_items = Commands.new("clear-ground-item", { "exp-commands_ game.print{ "exp-commands_surface.item" } end) ---- Clear all blueprints, optional to select a single surface -commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprint" }) +--- Clear all blueprint in a single surface +commands.clear_blueprint_surface = Commands.new("clear-blueprint-surface", { "exp-commands_surface.description-blueprint" }) :register(function(player) local entities = player.surface.find_entities_filtered{ type = "entity-ghost" } for _, entity in ipairs(entities) do @@ -45,11 +45,10 @@ commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { " game.print{ "exp-commands_surface.blueprint" } end) ---- Clear all blueprints in a radius around you ---- Toggle player selection mode ---- @class ExpCommands_ClearBlueprint.commands.clear_blueprints: ExpCommand +--- Clear all blueprint in the area, selected by toggle player selection mode +--- @class ExpCommands_ClearBlueprint.commands.clear_blueprint: ExpCommand --- @overload fun(player: LuaPlayer) -commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprint" }) +commands.clear_blueprint = Commands.new("clear-blueprint", { "exp-commands_surface.description-blueprint" }) :register(function(player) if SelectArea:stop(player) then return Commands.status.success{ "exp-commands_surface.exit" } From 3051be246b8bef5c45b6ab344e30bb3f2f16ca41 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 15:15:29 +0900 Subject: [PATCH 08/17] Update quick_actions.lua --- exp_scenario/module/gui/quick_actions.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exp_scenario/module/gui/quick_actions.lua b/exp_scenario/module/gui/quick_actions.lua index 28ea5af4a4..0255e2cef8 100644 --- a/exp_scenario/module/gui/quick_actions.lua +++ b/exp_scenario/module/gui/quick_actions.lua @@ -11,6 +11,7 @@ local addon_research = require("modules/exp_scenario/commands/research") local addon_trains = require("modules/exp_scenario/commands/trains") local addon_teleport = require("modules/exp_scenario/commands/teleport") local addon_waterfill = require("modules/exp_scenario/commands/waterfill") +local addon_surface = require("modules/exp_scenario/commands/surface") --- @class ExpGui_QuickActions.elements local Elements = {} @@ -51,6 +52,9 @@ new_quick_action("spawn", addon_teleport.commands.spawn, function(def, player, e end) new_quick_action("waterfill", addon_waterfill.commands.waterfill) +new_quick_action("clear-ground-item", addon_surface.commands.clear_ground_item) +new_quick_action("clear-blueprint-surface", addon_surface.commands.clear_blueprint_surface) +new_quick_action("clear-blueprint", addon_surface.commands.clear_blueprint) --- Container added to the left gui flow --- @class ExpGui_QuickActions.elements.container: ExpElement From 957f774ec7743484260304de5e3ef26877adff43 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 17:10:13 +0900 Subject: [PATCH 09/17] Update en.cfg --- exp_scenario/module/locale/en.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index e33db996a9..119f612fd6 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -225,8 +225,8 @@ item=Cleared the items found on the current surface. blueprint=Cleared the blueprints found on the current surface. enter=Entered selection mode, select the area. exit=Exited selection mode. -area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. -complete=__1__ tiles were handled. +area-too-large=Selected area is too large, must be less than __1__, selected __2__. +complete=__1__ were handled. [exp-commands_trains] description=Set All Trains to Automatic, does not effect trains with passengers. From 2953fe2c002d9cf15526dfa845cbc37d41310a1b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 18:24:35 +0900 Subject: [PATCH 10/17] Update en.cfg --- exp_scenario/module/locale/en.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 119f612fd6..6e99fdb8cb 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -226,7 +226,7 @@ blueprint=Cleared the blueprints found on the current surface. enter=Entered selection mode, select the area. exit=Exited selection mode. area-too-large=Selected area is too large, must be less than __1__, selected __2__. -complete=__1__ were handled. +complete=__1__ blueprint ghost were handled. [exp-commands_trains] description=Set All Trains to Automatic, does not effect trains with passengers. From 41639664d4fa110bc23e590b031391788c166921 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 18:25:07 +0900 Subject: [PATCH 11/17] Update surface.lua --- exp_scenario/module/commands/surface.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index ceb0f7b6f0..24a441e881 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -75,7 +75,7 @@ SelectArea:on_selection(function(event) entity.destroy() end - player.print({ "exp-commands_surface.complete", #entities }, Commands.print_settings.default) + game.print({ "exp-commands_surface.complete", #entities }, Commands.print_settings.default) end) return { From 1cb1eafe81b007042b6c75c4df424af02e57d7ce Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 18:27:46 +0900 Subject: [PATCH 12/17] Update zh-CN.cfg --- exp_scenario/module/locale/zh-CN.cfg | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index b08f6ba1db..cac1389a0a 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -219,16 +219,14 @@ arg-player=用戶 follow-self=你不能追蹤自己 [exp-commands_surface] -description-items=清除地面上的物品 -description-blueprints=清除藍圖 -description-radius=清除周邊的藍圖 -arg-surface=位面 -arg-radius=周邊半徑 -items-surface=__1__ 清除了所有在 __2__ 中掉地上的東西。 -items-all=__1__ 清除了所有掉地上的東西。 -blueprints-surface=__1__ 清除了所有在 __2__ 中在地上的藍圖。 -blueprints-all=__1__ 清除了所有在地上的藍圖。 -blueprints-radius=__1__ 清除了在 __3__ 上,周邊 __2__ 格的地上的藍圖。 +description-item=清除地面上的物品 +description-blueprint=清除藍圖 +item=清除了所有掉在地上的東西。 +blueprint=清除了所有在地上的藍圖。 +enter=現在進入區域選擇 +exit=已進入區域選擇 +area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 +complete=__1__ 個地上的藍圖已被清除。 [exp-commands_trains] description=把火車設置為自動模式 From db31b487f291b5d3e3b6c767b6a43e3c62650b80 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 18:28:02 +0900 Subject: [PATCH 13/17] Update zh-TW.cfg --- exp_scenario/module/locale/zh-TW.cfg | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index b08f6ba1db..cac1389a0a 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -219,16 +219,14 @@ arg-player=用戶 follow-self=你不能追蹤自己 [exp-commands_surface] -description-items=清除地面上的物品 -description-blueprints=清除藍圖 -description-radius=清除周邊的藍圖 -arg-surface=位面 -arg-radius=周邊半徑 -items-surface=__1__ 清除了所有在 __2__ 中掉地上的東西。 -items-all=__1__ 清除了所有掉地上的東西。 -blueprints-surface=__1__ 清除了所有在 __2__ 中在地上的藍圖。 -blueprints-all=__1__ 清除了所有在地上的藍圖。 -blueprints-radius=__1__ 清除了在 __3__ 上,周邊 __2__ 格的地上的藍圖。 +description-item=清除地面上的物品 +description-blueprint=清除藍圖 +item=清除了所有掉在地上的東西。 +blueprint=清除了所有在地上的藍圖。 +enter=現在進入區域選擇 +exit=已進入區域選擇 +area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 +complete=__1__ 個地上的藍圖已被清除。 [exp-commands_trains] description=把火車設置為自動模式 From 31a40e458ba4e1c485917030062d7d36f402bba6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 19:36:53 +0900 Subject: [PATCH 14/17] . --- exp_scenario/module/gui/quick_actions.lua | 45 +++++++++++++---------- exp_scenario/module/locale/en.cfg | 5 --- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/exp_scenario/module/gui/quick_actions.lua b/exp_scenario/module/gui/quick_actions.lua index dc1c1ade28..3486251f97 100644 --- a/exp_scenario/module/gui/quick_actions.lua +++ b/exp_scenario/module/gui/quick_actions.lua @@ -24,12 +24,19 @@ local Actions = {} --- @param name string --- @param command ExpCommand | function (this is needed because of the overload on commands) --- @param on_click? ExpElement.EventHandler -local function new_quick_action(name, command, on_click) - local element = Gui.define("quick_actions/" .. name) +local function new_quick_action(group_name, command_name, command, on_click) + local element = Gui.define("quick_actions/" .. group_name .. '_' .. command_name) :draw{ type = "button", - caption = { "exp-gui_quick-actions.caption-" .. name }, - tooltip = { "exp-gui_quick-actions.tooltip-" .. name }, + caption = { "?", + { "exp-gui_quick-actions.caption-" .. command_name }, + group_name .. '_' .. command_name + }, + tooltip = { "?", + { "exp-commands_" .. group_name .. ".description-" .. command_name }, + { "exp-commands_" .. group_name .. ".description" }, + "" + }, } :style{ width = 160, @@ -38,30 +45,30 @@ local function new_quick_action(name, command, on_click) command(player) end) - Elements[name] = element - Actions[name] = { + Elements[group_name .. '-' .. command_name] = element + Actions[group_name .. '-' .. command_name] = { command = command --[[ @as ExpCommand ]], element = element, } end -new_quick_action("artillery", addon_artillery.commands.artillery) -new_quick_action("trains", addon_trains.commands.set_trains_to_automatic) -new_quick_action("research", addon_research.commands.set_auto_research) +new_quick_action("artillery", "artillery", addon_artillery.commands.artillery) +new_quick_action("trains", "trains", addon_trains.commands.set_trains_to_automatic) +new_quick_action("research", "research", addon_research.commands.set_auto_research) -new_quick_action("spawn", addon_teleport.commands.spawn, function(def, player, element, event) +new_quick_action("teleport", "spawn", addon_teleport.commands.spawn, function(def, player, element, event) addon_teleport.commands.spawn(player, player) end) -new_quick_action("waterfill", addon_waterfill.commands.waterfill) -new_quick_action("clear-ground-item", addon_surface.commands.clear_ground_item) -new_quick_action("clear-blueprint-surface", addon_surface.commands.clear_blueprint_surface) -new_quick_action("clear-blueprint", addon_surface.commands.clear_blueprint) -new_quick_action("home", addon_home.commands.home) -new_quick_action("return", addon_home.commands._return) -new_quick_action("set-home", addon_home.commands.set_home) -new_quick_action("get-home", addon_home.commands.get_home) -new_quick_action("vlayer", addon_vlayer.commands.vlayer) +new_quick_action("waterfill", "waterfill", addon_waterfill.commands.waterfill) +new_quick_action("surface", "item", addon_surface.commands.clear_ground_item) +new_quick_action("surface", "blueprint", addon_surface.commands.clear_blueprint_surface) +new_quick_action("surface", "clear-blueprint", addon_surface.commands.clear_blueprint) +new_quick_action("home", "home", addon_home.commands.home) +new_quick_action("home", "return", addon_home.commands._return) +new_quick_action("home", "set", addon_home.commands.set_home) +new_quick_action("home", "get", addon_home.commands.get_home) +new_quick_action("vlayer", "vlayer", addon_vlayer.commands.vlayer) --- Container added to the left gui flow --- @class ExpGui_QuickActions.elements.container: ExpElement diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 6e99fdb8cb..aae5ee2e7f 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -330,15 +330,10 @@ caption-net=Net [exp-gui_quick-actions] tooltip-main=Quick Actions caption-artillery=Artillery -tooltip-artillery=Select artillery targets caption-research=Auto Research -tooltip-research=Toggle auto research queue caption-spawn=Teleport Spawn -tooltip-spawn-tooltip=Teleport to spawn caption-trains=Set Auto Train -tooltip-trains=Set all trains to automatic caption-waterfill=Waterfill -tooltip-waterfill=Change tiles to water [exp-gui_readme] main-tooltip=Information From 35ed2fd1bf1109cbb9033a72e943652f13350d16 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 19:49:00 +0900 Subject: [PATCH 15/17] . --- exp_scenario/module/commands/surface.lua | 4 ++-- exp_scenario/module/gui/quick_actions.lua | 4 ++-- exp_scenario/module/locale/en.cfg | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index 24a441e881..e79208d8ae 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -36,13 +36,13 @@ commands.clear_ground_item = Commands.new("clear-ground-item", { "exp-commands_s end) --- Clear all blueprint in a single surface -commands.clear_blueprint_surface = Commands.new("clear-blueprint-surface", { "exp-commands_surface.description-blueprint" }) +commands.clear_blueprint_surface = Commands.new("clear-blueprint-surface", { "exp-commands_surface.description-blueprint-surface" }) :register(function(player) local entities = player.surface.find_entities_filtered{ type = "entity-ghost" } for _, entity in ipairs(entities) do entity.destroy() end - game.print{ "exp-commands_surface.blueprint" } + game.print{ "exp-commands_surface.blueprint-surface" } end) --- Clear all blueprint in the area, selected by toggle player selection mode diff --git a/exp_scenario/module/gui/quick_actions.lua b/exp_scenario/module/gui/quick_actions.lua index 3486251f97..213878b5b1 100644 --- a/exp_scenario/module/gui/quick_actions.lua +++ b/exp_scenario/module/gui/quick_actions.lua @@ -62,8 +62,8 @@ end) new_quick_action("waterfill", "waterfill", addon_waterfill.commands.waterfill) new_quick_action("surface", "item", addon_surface.commands.clear_ground_item) -new_quick_action("surface", "blueprint", addon_surface.commands.clear_blueprint_surface) -new_quick_action("surface", "clear-blueprint", addon_surface.commands.clear_blueprint) +new_quick_action("surface", "blueprint-surface", addon_surface.commands.clear_blueprint_surface) +new_quick_action("surface", "blueprint", addon_surface.commands.clear_blueprint) new_quick_action("home", "home", addon_home.commands.home) new_quick_action("home", "return", addon_home.commands._return) new_quick_action("home", "set", addon_home.commands.set_home) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index aae5ee2e7f..29259169e3 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -220,9 +220,11 @@ follow-self=You can not follow yourself. [exp-commands_surface] description-item=Clear all items on the ground. +description-blueprint-surface=Clear all blueprints on the current surface. description-blueprint=Clear all blueprints. -item=Cleared the items found on the current surface. -blueprint=Cleared the blueprints found on the current surface. +item=Cleared all items found on the ground. +blueprint-surface=Cleared all the blueprints found on the current surface. +blueprint=Cleared the blueprints. enter=Entered selection mode, select the area. exit=Exited selection mode. area-too-large=Selected area is too large, must be less than __1__, selected __2__. From 475daf4bcb449dfc08ce23db289b957436adc77e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 26 Jun 2026 19:55:05 +0900 Subject: [PATCH 16/17] . --- exp_scenario/module/commands/surface.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index e79208d8ae..806036438f 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -25,10 +25,14 @@ end --- Clear all item on the ground on a single surface commands.clear_ground_item = Commands.new("clear-ground-item", { "exp-commands_surface.description-item" }) + :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) + :defaults{ + surface = function(player) return player.surface end + } :register(function(player) move_items{ - surface = player.surface, - items = get_ground_items(player.surface), + surface = surface, + items = get_ground_items(surface), allow_creation = true, name = "iron-chest", } @@ -37,8 +41,12 @@ commands.clear_ground_item = Commands.new("clear-ground-item", { "exp-commands_s --- Clear all blueprint in a single surface commands.clear_blueprint_surface = Commands.new("clear-blueprint-surface", { "exp-commands_surface.description-blueprint-surface" }) + :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) + :defaults{ + surface = function(player) return player.surface end + } :register(function(player) - local entities = player.surface.find_entities_filtered{ type = "entity-ghost" } + local entities = surface.find_entities_filtered{ type = "entity-ghost" } for _, entity in ipairs(entities) do entity.destroy() end From 333232a9fae0fdd949ae4a0f3207d77239a4b1ae Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Fri, 26 Jun 2026 13:13:15 +0100 Subject: [PATCH 17/17] Many fixes and reverts --- exp_legacy/module/config/expcore/roles.lua | 6 +-- exp_scenario/module/commands/surface.lua | 27 +++++++------ exp_scenario/module/gui/quick_actions.lua | 45 +++++++++++----------- exp_scenario/module/locale/en.cfg | 14 +++---- exp_scenario/module/locale/zh-CN.cfg | 10 +++-- exp_scenario/module/locale/zh-TW.cfg | 10 +++-- 6 files changed, 61 insertions(+), 51 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index eb40fa8497..df346afbfc 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -125,7 +125,7 @@ Roles.new_role("Trainee", "TrMod") "command/search-online", "command/search-amount", "command/search-recent", - "command/clear-blueprint-surface", + "command/clear-blueprints-surface", "gui/playerdata", } @@ -203,8 +203,8 @@ Roles.new_role("Veteran", "Vet") :set_parent("Member") :allow{ "command/chat-commands", - "command/clear-ground-item", - "command/clear-blueprint", + "command/clear-ground-items", + "command/clear-blueprints", "command/set-trains-to-automatic", } :set_auto_assign_condition(function(player) diff --git a/exp_scenario/module/commands/surface.lua b/exp_scenario/module/commands/surface.lua index 806036438f..1d98e96a02 100644 --- a/exp_scenario/module/commands/surface.lua +++ b/exp_scenario/module/commands/surface.lua @@ -8,6 +8,7 @@ local ExpUtil = require("modules/exp_util") local move_items = ExpUtil.move_items_to_surface local Selection = require("modules/exp_util/selection") local SelectArea = Selection.connect("ExpCommand_ClearBlueprint") +local format_player_name = Commands.format_player_name_locale --- @class ExpCommand_ClearBlueprint.commands local commands = {} @@ -23,52 +24,57 @@ local function get_ground_items(surface) return items end ---- Clear all item on the ground on a single surface -commands.clear_ground_item = Commands.new("clear-ground-item", { "exp-commands_surface.description-item" }) +--- Clear all items on the ground on a surface +commands.clear_ground_items = Commands.new("clear-ground-items", { "exp-commands_surface.description-items" }) :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) :defaults{ surface = function(player) return player.surface end } - :register(function(player) + :register(function(player, surface) + --- @cast surface LuaSurface move_items{ surface = surface, items = get_ground_items(surface), allow_creation = true, name = "iron-chest", } - game.print{ "exp-commands_surface.item" } + local player_name = format_player_name(player) + game.print{ "exp-commands_surface.items", player_name, surface.localised_name } end) ---- Clear all blueprint in a single surface -commands.clear_blueprint_surface = Commands.new("clear-blueprint-surface", { "exp-commands_surface.description-blueprint-surface" }) +--- Clear all blueprints on a surface +commands.clear_blueprints_surface = Commands.new("clear-blueprints-surface", { "exp-commands_surface.description-blueprints-surface" }) :optional("surface", { "exp-commands_surface.arg-surface" }, Commands.types.surface) :defaults{ surface = function(player) return player.surface end } - :register(function(player) + :register(function(player, surface) + --- @cast surface LuaSurface local entities = surface.find_entities_filtered{ type = "entity-ghost" } for _, entity in ipairs(entities) do entity.destroy() end - game.print{ "exp-commands_surface.blueprint-surface" } + local player_name = format_player_name(player) + game.print{ "exp-commands_surface.blueprints", player_name, surface.localised_name } end) --- Clear all blueprint in the area, selected by toggle player selection mode --- @class ExpCommands_ClearBlueprint.commands.clear_blueprint: ExpCommand --- @overload fun(player: LuaPlayer) -commands.clear_blueprint = Commands.new("clear-blueprint", { "exp-commands_surface.description-blueprint" }) +commands.clear_blueprints = Commands.new("clear-blueprints", { "exp-commands_surface.description-blueprints" }) :register(function(player) if SelectArea:stop(player) then return Commands.status.success{ "exp-commands_surface.exit" } end + SelectArea:start(player) return Commands.status.success{ "exp-commands_surface.enter" } end) --[[ @as any ]] --- When an area is selected SelectArea:on_selection(function(event) + local player = assert(game.get_player(event.player_index)) local area = AABB.expand(event.area) - local player = game.players[event.player_index] local surface = event.surface local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) @@ -78,7 +84,6 @@ SelectArea:on_selection(function(event) end local entities = surface.find_entities_filtered{ type = "entity-ghost", area = area } - for _, entity in ipairs(entities) do entity.destroy() end diff --git a/exp_scenario/module/gui/quick_actions.lua b/exp_scenario/module/gui/quick_actions.lua index 4181b75358..056a213a99 100644 --- a/exp_scenario/module/gui/quick_actions.lua +++ b/exp_scenario/module/gui/quick_actions.lua @@ -22,20 +22,21 @@ local Elements = {} --- @type table local Actions = {} ---- @param name string --- @param command ExpCommand | function (this is needed because of the overload on commands) --- @param on_click? ExpElement.EventHandler -local function new_quick_action(group_name, command_name, command, on_click) - local element = Gui.define("quick_actions/" .. group_name .. '_' .. command_name) +local function new_quick_action(command, on_click) + local command_name = command.name + + local element = Gui.define("quick_actions/" .. command_name) :draw{ type = "button", caption = { "?", { "exp-gui_quick-actions.caption-" .. command_name }, - group_name .. '_' .. command_name + command_name, }, tooltip = { "?", - { "exp-commands_" .. group_name .. ".description-" .. command_name }, - { "exp-commands_" .. group_name .. ".description" }, + { "exp-gui_quick-actions.tooltip-" .. command_name }, + command.description, "" }, } @@ -46,31 +47,31 @@ local function new_quick_action(group_name, command_name, command, on_click) command(player) end) - Elements[group_name .. '-' .. command_name] = element - Actions[group_name .. '-' .. command_name] = { + Elements[command_name] = element + Actions[command_name] = { command = command --[[ @as ExpCommand ]], element = element, } end -new_quick_action("artillery", "artillery", addon_artillery.commands.artillery) -new_quick_action("trains", "trains", addon_trains.commands.set_trains_to_automatic) +new_quick_action(addon_artillery.commands.artillery) +new_quick_action(addon_trains.commands.set_trains_to_automatic) -new_quick_action("teleport", "spawn", addon_teleport.commands.spawn, function(def, player, element, event) +new_quick_action(addon_teleport.commands.spawn, function(def, player, element, event) addon_teleport.commands.spawn(player, player) end) -new_quick_action("waterfill", "waterfill", addon_waterfill.commands.waterfill) -new_quick_action("lawnmower", "lawnmower", addon_lawnmower.commands.lawnmower) -new_quick_action("surface", "item", addon_surface.commands.clear_ground_item) -new_quick_action("surface", "blueprint-surface", addon_surface.commands.clear_blueprint_surface) -new_quick_action("surface", "blueprint", addon_surface.commands.clear_blueprint) -new_quick_action("home", "home", addon_home.commands.home) -new_quick_action("home", "return", addon_home.commands._return) -new_quick_action("home", "set", addon_home.commands.set_home) -new_quick_action("home", "get", addon_home.commands.get_home) -new_quick_action("vlayer", "vlayer", addon_vlayer.commands.vlayer) -new_quick_action("repair", "repair", addon_repair.commands.repair) +new_quick_action(addon_waterfill.commands.waterfill) +new_quick_action(addon_lawnmower.commands.lawnmower) +new_quick_action(addon_surface.commands.clear_ground_items) +new_quick_action(addon_surface.commands.clear_blueprints_surface) +new_quick_action(addon_surface.commands.clear_blueprints) +new_quick_action(addon_home.commands.home) +new_quick_action(addon_home.commands._return) +new_quick_action(addon_home.commands.set_home) +new_quick_action(addon_home.commands.get_home) +new_quick_action(addon_vlayer.commands.vlayer) +new_quick_action(addon_repair.commands.repair) --- Container added to the left gui flow --- @class ExpGui_QuickActions.elements.container: ExpElement diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index b177f51d55..311ec05c67 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -218,16 +218,16 @@ arg-player=Player to start following. follow-self=You can not follow yourself. [exp-commands_surface] -description-item=Clear all items on the ground. -description-blueprint-surface=Clear all blueprints on the current surface. -description-blueprint=Clear all blueprints. -item=Cleared all items found on the ground. -blueprint-surface=Cleared all the blueprints found on the current surface. -blueprint=Cleared the blueprints. +description-items=Clear all items on the ground. +description-blueprints=Clear all blueprints. +description-blueprints-surface=Clear all blueprints on the current surface. +arg-surface=Surface to clear on, default all. +items=__1__ cleared all items on the ground of __2__. +blueprints=__1__ cleared all blueprints on __2__. enter=Entered selection mode, select the area. exit=Exited selection mode. area-too-large=Selected area is too large, must be less than __1__, selected __2__. -complete=__1__ blueprint ghost were handled. +complete=__1__ blueprint ghost were removed. [exp-commands_trains] description=Set All Trains to Automatic, does not effect trains with passengers. diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 1a0a512559..bf65db42e3 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -213,10 +213,12 @@ arg-player=用戶 follow-self=你不能追蹤自己 [exp-commands_surface] -description-item=清除地面上的物品 -description-blueprint=清除藍圖 -item=清除了所有掉在地上的東西。 -blueprint=清除了所有在地上的藍圖。 +description-items=清除地面上的物品 +description-blueprints=清除藍圖 +description-blueprints-surface=清除藍圖 +arg-surface=位面 +items=__1__ 清除了所有在 __2__ 中掉地上的東西。 +blueprints=__1__ 清除了所有在 __2__ 中在地上的藍圖。 enter=現在進入區域選擇 exit=已進入區域選擇 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 1a0a512559..bf65db42e3 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -213,10 +213,12 @@ arg-player=用戶 follow-self=你不能追蹤自己 [exp-commands_surface] -description-item=清除地面上的物品 -description-blueprint=清除藍圖 -item=清除了所有掉在地上的東西。 -blueprint=清除了所有在地上的藍圖。 +description-items=清除地面上的物品 +description-blueprints=清除藍圖 +description-blueprints-surface=清除藍圖 +arg-surface=位面 +items=__1__ 清除了所有在 __2__ 中掉地上的東西。 +blueprints=__1__ 清除了所有在 __2__ 中在地上的藍圖。 enter=現在進入區域選擇 exit=已進入區域選擇 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。