From 7c9d47b6db330775946aff82d5b6f59414afb9f9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 25 Jun 2026 05:34:51 +0900 Subject: [PATCH] remove landfill blueprint (#433) * Delete exp_scenario/module/gui/landfill_blueprint.lua * Update control.lua * Update roles.lua * Update en.cfg * Update zh-CN.cfg * Update zh-TW.cfg --- exp_legacy/module/config/expcore/roles.lua | 1 - exp_scenario/module/control.lua | 1 - .../module/gui/landfill_blueprint.lua | 175 ------------------ exp_scenario/module/locale/en.cfg | 6 +- exp_scenario/module/locale/zh-CN.cfg | 4 - exp_scenario/module/locale/zh-TW.cfg | 4 - 6 files changed, 1 insertion(+), 190 deletions(-) delete mode 100644 exp_scenario/module/gui/landfill_blueprint.lua diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 2dd07f77..a392953f 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -289,7 +289,6 @@ local default = Roles.new_role("Guest", "") "gui/research", "gui/autofill", "gui/module", - "gui/landfill", "gui/production", } diff --git a/exp_scenario/module/control.lua b/exp_scenario/module/control.lua index b031e221..5d8654f9 100644 --- a/exp_scenario/module/control.lua +++ b/exp_scenario/module/control.lua @@ -70,7 +70,6 @@ add(require("modules/exp_scenario/control/station_auto_name")) --- Guis add(require("modules/exp_scenario/gui/autofill")) add(require("modules/exp_scenario/gui/elements")) -add(require("modules/exp_scenario/gui/landfill_blueprint")) add(require("modules/exp_scenario/gui/module_inserter")) add(require("modules/exp_scenario/gui/player_bonus")) add(require("modules/exp_scenario/gui/player_stats")) diff --git a/exp_scenario/module/gui/landfill_blueprint.lua b/exp_scenario/module/gui/landfill_blueprint.lua deleted file mode 100644 index 0eae3367..00000000 --- a/exp_scenario/module/gui/landfill_blueprint.lua +++ /dev/null @@ -1,175 +0,0 @@ ---[[-- Gui - Landfill Blueprint -Adds a button to the toolbar which adds landfill to the held blueprint -]] - -local Gui = require("modules/exp_gui") -local Roles = require("modules/exp_legacy/expcore/roles") - ---- @param box BoundingBox -local function rotate_bounding_box(box) - box.left_top.x, box.left_top.y, box.right_bottom.x, box.right_bottom.y - = -box.right_bottom.y, box.left_top.x, -box.left_top.y, box.right_bottom.x -end - -local function curve_flip_lr(oc) - local nc = table.deep_copy(oc) - - for r = 1, 8 do - for c = 1, 8 do - nc[r][c] = oc[r][9 - c] - end - end - - return nc -end - -local function curve_flip_d(oc) - local nc = table.deep_copy(oc) - - for r = 1, 8 do - for c = 1, 8 do - nc[r][c] = oc[c][r] - end - end - - return nc -end - -local curve_masks = {} do - local curves = { { - { 0, 0, 0, 0, 0, 1, 0, 0 }, - { 0, 0, 0, 0, 1, 1, 1, 0 }, - { 0, 0, 0, 1, 1, 1, 1, 0 }, - { 0, 0, 0, 1, 1, 1, 0, 0 }, - { 0, 0, 1, 1, 1, 0, 0, 0 }, - { 0, 0, 1, 1, 1, 0, 0, 0 }, - { 0, 0, 1, 1, 0, 0, 0, 0 }, - { 0, 0, 1, 1, 0, 0, 0, 0 }, - } } - - curves[6] = curve_flip_d(curves[1]) - curves[3] = curve_flip_lr(curves[6]) - curves[4] = curve_flip_d(curves[3]) - curves[5] = curve_flip_lr(curves[4]) - curves[2] = curve_flip_d(curves[5]) - curves[7] = curve_flip_lr(curves[2]) - curves[8] = curve_flip_d(curves[7]) - - for i, map in ipairs(curves) do - local index = 0 - local mask = {} - curve_masks[i] = mask - - for row = 1, 8 do - for col = 1, 8 do - if map[row][col] == 1 then - index = index + 1 - mask[index] = { - x = col - 5, - y = row - 5, - } - end - end - end - end -end - -local rolling_stocks = {} -for name, _ in pairs(prototypes.get_entity_filtered{ { filter = "rolling-stock" } }) do - rolling_stocks[name] = true -end - ---- @param blueprint LuaItemStack ---- @return table -local function landfill_gui_add_landfill(blueprint) - local entities = assert(blueprint.get_blueprint_entities()) - local tile_index = 0 - local new_tiles = {} - - for _, entity in pairs(entities) do - if rolling_stocks[entity.name] or entity.name == "offshore-pump" then - goto continue - end - - if entity.name == "curved-rail" then - -- Curved rail - local curve_mask = curve_masks[entity.direction or 8] - for _, offset in ipairs(curve_mask) do - tile_index = tile_index + 1 - new_tiles[tile_index] = { - name = "landfill", - position = { entity.position.x + offset.x, entity.position.y + offset.y }, - } - end - else - -- Any other entity - local proto = prototypes.entity[entity.name] - if proto.collision_mask["ground-tile"] ~= nil then - goto continue - end - - -- Rotate the collision box to be north facing - local box = proto.collision_box or proto.selection_box - if entity.direction then - if entity.direction ~= defines.direction.north then - rotate_bounding_box(box) - if entity.direction ~= defines.direction.east then - rotate_bounding_box(box) - if entity.direction ~= defines.direction.south then - rotate_bounding_box(box) - end - end - end - end - - -- Add the landfill - for y = math.floor(entity.position.y + box.left_top.y), math.floor(entity.position.y + box.right_bottom.y), 1 do - for x = math.floor(entity.position.x + box.left_top.x), math.floor(entity.position.x + box.right_bottom.x), 1 do - tile_index = tile_index + 1 - new_tiles[tile_index] = { - name = "landfill", - position = { x, y }, - } - end - end - end - - ::continue:: - end - - local old_tiles = blueprint.get_blueprint_tiles() - - if old_tiles then - for _, old_tile in pairs(old_tiles) do - tile_index = tile_index + 1 - new_tiles[tile_index] = { - name = "landfill", - position = old_tile.position, - } - end - end - - return { tiles = new_tiles } -end - ---- Add the toolbar button -Gui.toolbar.create_button{ - name = "trigger_landfill_blueprint", - sprite = "item/landfill", - tooltip = { "exp-gui_landfill-blueprint.tooltip-main" }, - visible = function(player, element) - return Roles.player_allowed(player, "gui/landfill") - end -}:on_click(function(def, player, element) - local stack = player.cursor_stack - if stack and stack.valid_for_read and stack.type == "blueprint" and stack.is_blueprint_setup() then - local modified = landfill_gui_add_landfill(stack) - if modified and next(modified.tiles) then - stack.set_blueprint_tiles(modified.tiles) - end - else - player.print{ "exp-gui_landfill-blueprint.error-no-blueprint" } - end -end) - -return {} diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index ac5ec9cb..c75a927d 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -295,10 +295,6 @@ tooltip-amount=Amount of items to insert into the __1__ slots invalid=Autofill set to maximum amount: __1__ __2__ for __3__ inserted=Inserted __1__ __2__ into __3__ -[exp-gui_landfill-blueprint] -tooltip-main=Landfill Blueprint -error-no-blueprint=You need to hold the blueprint in cursor - [exp-gui_module-inserter] tooltip-main=Module Inserter caption-main=Modules @@ -572,4 +568,4 @@ chat-found=You cannot have __1__ in your inventory, so it was placed into the ch chat-jailed=__1__ was jailed because they removed too many protected entities. Please wait for a moderator. [exp_report-jail] -chat-jailed=__1__ was jailed because they were reported too many times. Please wait for a moderator. \ No newline at end of file +chat-jailed=__1__ was jailed because they were reported too many times. Please wait for a moderator. diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index da26d0fa..b08f6ba1 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -295,10 +295,6 @@ tooltip-amount=自動填入 __1__ 的數量 invalid=自動填入最大值 __1__ __2__ 給 __3__ inserted=自動填入 __1__ __2__ 到 __3__ -[exp-gui_landfill-blueprint] -tooltip-main=藍圖填海 -error-no-blueprint=您需要將藍圖保持在遊標處 - [exp-gui_module-inserter] tooltip-main=模組 caption-main=Modules diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index da26d0fa..b08f6ba1 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -295,10 +295,6 @@ tooltip-amount=自動填入 __1__ 的數量 invalid=自動填入最大值 __1__ __2__ 給 __3__ inserted=自動填入 __1__ __2__ 到 __3__ -[exp-gui_landfill-blueprint] -tooltip-main=藍圖填海 -error-no-blueprint=您需要將藍圖保持在遊標處 - [exp-gui_module-inserter] tooltip-main=模組 caption-main=Modules