From 55b1756a42801ce68e476b87860a459836cf4e3d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 4 Feb 2025 06:20:08 +0900 Subject: [PATCH 1/5] Fix missing storage reference (#373) --- exp_gui/module/data.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_gui/module/data.lua b/exp_gui/module/data.lua index b5ceac5c..c792fcdb 100644 --- a/exp_gui/module/data.lua +++ b/exp_gui/module/data.lua @@ -25,6 +25,7 @@ Storage.register({ scope_data = scope_data, registration_numbers = registration_numbers, }, function(tbl) + scope_data = tbl.scope_data registration_numbers = tbl.registration_numbers for scope, data in pairs(tbl.scope_data) do local proxy = registered_scopes[scope] From 44d025edd6667379a095a87d94b07caf4e88a728 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 4 Feb 2025 06:25:03 +0900 Subject: [PATCH 2/5] Fix "repair:6:3439203 'health': real number expected got inf." (#372) --- exp_scenario/module/commands/repair.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/exp_scenario/module/commands/repair.lua b/exp_scenario/module/commands/repair.lua index 6f82c67b..019c1dee 100644 --- a/exp_scenario/module/commands/repair.lua +++ b/exp_scenario/module/commands/repair.lua @@ -5,8 +5,6 @@ Adds a command that allows an admin to repair and revive a large area local Commands = require("modules/exp_commands") local config = require("modules.exp_legacy.config.repair") --- @dep config.repair -local huge = math.huge - --- Repairs entities on your force around you Commands.new("repair", { "exp-commands_repair.description" }) :argument("range", { "exp-commands_repair.arg-range" }, Commands.types.integer_range(1, config.max_range)) @@ -46,9 +44,9 @@ Commands.new("repair", { "exp-commands_repair.description" }) } for _, entity in ipairs(entities) do - if entity.health and entity.get_health_ratio() ~= 1 then + if entity.health and entity.max_health and entity.health ~= entity.max_health then healed_count = healed_count + 1 - entity.health = huge + entity.health = entity.max_health end end @@ -57,4 +55,3 @@ Commands.new("repair", { "exp-commands_repair.description" }) return Commands.status.success(response) end) - From 7cccf793834cb0f1d8273dccc5517cb84c4c1b0c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 4 Feb 2025 06:26:16 +0900 Subject: [PATCH 3/5] Fix tree-decon on click event (#371) --- exp_legacy/module/modules/addons/tree-decon.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/tree-decon.lua b/exp_legacy/module/modules/addons/tree-decon.lua index 0fa81f11..c6d33d9f 100644 --- a/exp_legacy/module/modules/addons/tree-decon.lua +++ b/exp_legacy/module/modules/addons/tree-decon.lua @@ -43,8 +43,7 @@ Gui.toolbar.create_button{ visible = function(player, _) return Roles.player_allowed(player, "fast-tree-decon") end -}:on_click(function(def, event, element) - local player = Gui.get_player(event) +}:on_click(function(def, player, element) local state = Gui.toolbar.get_button_toggled_state(def, player) HasEnabledDecon:set(player, state) player.print{ "tree-decon.toggle-msg", state and { "tree-decon.enabled" } or { "tree-decon.disabled" } } From 7adf4a4477ed0c80db3c10023e437077ef3b4d33 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 4 Feb 2025 06:36:40 +0900 Subject: [PATCH 4/5] Add Kill Effect (#366) * Update kill.lua * Update kill.lua * Update kill.lua --- exp_scenario/module/commands/kill.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 2ab239bd..ac4356d0 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,11 +20,11 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif other_player == player then - -- You can always kill yourself - other_player.character.die() - elseif highest_role(other_player).index < highest_role(player).index then - -- Can kill lower role players + elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then + -- You can always kill yourself or can kill lower role players + if script.active_mods["space-age"] then + other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } + end other_player.character.die() else return Commands.status.unauthorised{ "exp-commands_kill.lower-role" } From a041fe0a389e4c961d808b1d4013ac0fd6d1b932 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 4 Feb 2025 06:43:40 +0900 Subject: [PATCH 5/5] Allow Waterfill with Recipe (#364) * Update waterfill.lua * Update en.cfg * Update zh-CN.cfg * Update zh-TW.cfg * Update zh-CN.cfg * Update zh-TW.cfg * Update waterfill.lua * Update waterfill.lua * Update waterfill.lua * Update tool.lua * Update waterfill.lua --- exp_legacy/module/modules/gui/tool.lua | 13 +++++--- exp_scenario/module/commands/waterfill.lua | 38 +++++++++++++++++----- exp_scenario/module/locale/en.cfg | 2 +- exp_scenario/module/locale/zh-CN.cfg | 2 +- exp_scenario/module/locale/zh-TW.cfg | 2 +- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/modules/gui/tool.lua b/exp_legacy/module/modules/gui/tool.lua index c6c67acb..6ccfc7ff 100644 --- a/exp_legacy/module/modules/gui/tool.lua +++ b/exp_legacy/module/modules/gui/tool.lua @@ -83,11 +83,16 @@ local tool_gui_waterfill_b = Gui.element("tool_gui_waterfill_b") if Selection.is_selecting(player, SelectionWaterfillArea) then Selection.stop(player) return player.print{ "exp-commands_waterfill.exit" } - elseif player.get_item_count("cliff-explosives") == 0 then - return player.print{ "exp-commands_waterfill.requires-explosives" } else - Selection.start(player, SelectionWaterfillArea) - return player.print{ "exp-commands_waterfill.enter" } + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft + if item_count_total == 0 then + return player.print{ "exp-commands_waterfill.requires-explosives" } + else + Selection.start(player, SelectionWaterfillArea) + return player.print{ "exp-commands_waterfill.enter" } + end end end) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index d748356f..a3c9d602 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -13,11 +13,16 @@ Commands.new("waterfill", { "exp-commands_waterfill.description" }) if Selection.is_selecting(player, SelectionName) then Selection.stop(player) return Commands.status.success{ "exp-commands_waterfill.exit" } - elseif player.get_item_count("cliff-explosives") == 0 then - return Commands.status.error{ "exp-commands_waterfill.requires-explosives" } else - Selection.start(player, SelectionName) - return Commands.status.success{ "exp-commands_waterfill.enter" } + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft + if item_count_total == 0 then + return player.print{ "exp-commands_waterfill.requires-explosives" } + else + Selection.start(player, SelectionName) + return player.print{ "exp-commands_waterfill.enter" } + end end end) @@ -39,9 +44,12 @@ Selection.on_selection(SelectionName, function(event) return end - local item_count = player.get_item_count("cliff-explosives") - if item_count < area_size then - player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count }, Commands.print_settings.error) + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft + + if item_count_total < area_size then + player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error) return end @@ -59,7 +67,21 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } - player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles } + local t_diff = tile_count - remaining_tiles + + if item_count_cliff >= t_diff then + player.remove_item{ name = "cliff-explosives", count = t_diff } + else + if item_count_cliff > 0 then + player.remove_item{ name = "cliff-explosives", count = item_count_cliff } + end + local item_count_needed = t_diff - item_count_cliff + if item_count_needed > 0 then + player.remove_item{ name = "explosives", count = 10 * item_count_needed } + player.remove_item{ name = "barrel", count = item_count_needed } + player.remove_item{ name = "grenade", count = item_count_needed } + end + end if remaining_tiles > 0 then player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 2dd747e4..1b928702 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -278,6 +278,6 @@ enter=Entered waterfill selection mode, select the area to fill with water. exit=Exited waterfill selection mode. nauvis-only=Can only waterfill on Nauvis, this may change in the future. area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. -too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ you have __2__. +too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ or its ingredients, you have __2__. part-complete=__1__ tiles were filled with water, but entities are blocking __2__ tiles. complete=__1__ tiles were filled with water. diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index bc4a69a3..09cc70d3 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index bc4a69a3..09cc70d3 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。