From 1e861c5c0ba1b0787afbbe0cbaaa794f1975cf8a Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Sat, 8 Aug 2026 21:58:46 +0100 Subject: [PATCH] Fix issue with MapPosition.energy --- .emmyrc.json | 2 +- exp_legacy/module/modules/gui/vlayer.lua | 2 +- exp_legacy/module/modules/gui/warp-list.lua | 2 +- exp_scenario/module/commands/artillery.lua | 2 +- exp_scenario/module/commands/protected_entities.lua | 2 +- exp_scenario/module/control/damage_popups.lua | 2 +- exp_scenario/module/control/degrading_tiles.lua | 2 +- exp_scenario/module/control/mine_depletion.lua | 8 ++++---- exp_scenario/module/gui/production_stats.lua | 2 +- exp_util/module/flying_text.lua | 6 +++--- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.emmyrc.json b/.emmyrc.json index e6d9de6d..213157cc 100644 --- a/.emmyrc.json +++ b/.emmyrc.json @@ -9,7 +9,7 @@ "$comment-library": "clusterio is outside this repo, set CLUSTERIO to your checkout. The factorio typedefs come from .luarc.json, which the factoriomod-debug extension manages", "library": [ "$CLUSTERIO/packages/host" ], "ignoreDir": [ ".github", "web", "dist", "factorio" ], - "ignoreGlobs": [ "**/node_modules/**", "**/dist/**" ], + "ignoreGlobs": [ "**/node_modules/**", "**/dist/**", "**/campaigns/**" ], "moduleMap": [ { "pattern": "^([^.]+)\\.module\\.module_exports$", "replace": "modules.$1" }, { "pattern": "^([^.]+)\\.module\\.(.+)$", "replace": "modules.$1.$2" } diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index dd603bc0..727f9b9d 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -326,7 +326,7 @@ local function vlayer_gui_list_refresh(player) for i = 1, vlayer.get_interface_counts()[vlayer_control_type_list[target]], 1 do local entity = assert(interface[i]) - local entity_position = entity.position --[[@as MapPosition.struct]] + local entity_position = entity.position table.insert(full_list, i .. " X " .. entity_position.x .. " Y " .. entity_position.y) end diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index a42ec2a0..15359dbc 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -799,7 +799,7 @@ Event.on_nth_tick(math.floor(60 / config.update_smoothing), function() end -- Check if the player is within range - local warp_pos = warp.position --[[@as MapPosition.struct]] + local warp_pos = warp.position if warp.surface == surface then local dx, dy = px - warp_pos.x, py - warp_pos.y local dist = (dx * dx) + (dy * dy) diff --git a/exp_scenario/module/commands/artillery.lua b/exp_scenario/module/commands/artillery.lua index 5a2e16bf..e0a5bdf3 100644 --- a/exp_scenario/module/commands/artillery.lua +++ b/exp_scenario/module/commands/artillery.lua @@ -67,7 +67,7 @@ SelectArea:on_selection(function(event) for _, entity in ipairs(entities) do local skip = false - local entity_position = entity.position --[[@as MapPosition.struct]] + local entity_position = entity.position for _, pos in ipairs(hits) do local x = abs(entity_position.x - pos.x) local y = abs(entity_position.y - pos.y) diff --git a/exp_scenario/module/commands/protected_entities.lua b/exp_scenario/module/commands/protected_entities.lua index b84d14d7..f2c71df2 100644 --- a/exp_scenario/module/commands/protected_entities.lua +++ b/exp_scenario/module/commands/protected_entities.lua @@ -51,7 +51,7 @@ local function show_protected_entity(player, entity) if renders[player.index][key] then return end local selection_box = entity.selection_box --[[@as ExpUtil_AABB.Box]] local rb = selection_box.right_bottom - local position = entity.position --[[@as MapPosition.struct]] + local position = entity.position renders[player.index][key] = rendering.draw_sprite{ sprite = "utility/notification", target = entity, diff --git a/exp_scenario/module/control/damage_popups.lua b/exp_scenario/module/control/damage_popups.lua index 146a94fe..803f95b6 100644 --- a/exp_scenario/module/control/damage_popups.lua +++ b/exp_scenario/module/control/damage_popups.lua @@ -26,7 +26,7 @@ local function on_entity_damaged(event) -- Outputs the message as floating text if message then - local entity_position = entity.position --[[@as MapPosition.struct]] + local entity_position = entity.position local entity_radius = max(1, entity.get_radius()) local offset = (random() - 0.5) * entity_radius * config.damage_location_variance local position = { x = entity_position.x + offset, y = entity_position.y - entity_radius } diff --git a/exp_scenario/module/control/degrading_tiles.lua b/exp_scenario/module/control/degrading_tiles.lua index 6d7b951f..7707c0e8 100644 --- a/exp_scenario/module/control/degrading_tiles.lua +++ b/exp_scenario/module/control/degrading_tiles.lua @@ -85,7 +85,7 @@ local function on_player_changed_position(event) if player.controller_type ~= defines.controllers.character then return end local surface = player.physical_surface - local position = player.physical_position --[[@as MapPosition.struct]] + local position = player.physical_position local strength = get_tile_strength(surface, position) if not strength then return end diff --git a/exp_scenario/module/control/mine_depletion.lua b/exp_scenario/module/control/mine_depletion.lua index 0f54a676..7b5be7b5 100644 --- a/exp_scenario/module/control/mine_depletion.lua +++ b/exp_scenario/module/control/mine_depletion.lua @@ -68,7 +68,7 @@ local function try_deconstruct_output_chest(entity) end -- Get all adjacent mining drills and inserters - local target_position = target.position --[[@as MapPosition.struct]] + local target_position = target.position local entities = target.surface.find_entities_filtered{ type = { "mining-drill", "inserter" }, to_be_deconstructed = false, @@ -160,7 +160,7 @@ local function try_deconstruct_miner(entity) end -- Build pipes if the miner used fluid - local position = entity.position --[[@as MapPosition.struct]] + local position = entity.position local create_entity_position = { x = position.x, y = position.y } local create_entity_param = { name = "entity-ghost", inner_name = "pipe", force = entity.force, position = create_entity_position } local create_entity = surface.create_entity @@ -247,7 +247,7 @@ local function on_resource_depleted(event) end -- Find all mining drills within the area - local position = resource.position --[[@as MapPosition.struct]] + local position = resource.position local drills = resource.surface.find_entities_filtered{ type = "mining-drill", area = { @@ -259,7 +259,7 @@ local function on_resource_depleted(event) -- Check which could have reached this resource for _, drill in pairs(drills) do local radius = drill.prototype.mining_drill_radius - local drill_position = drill.position --[[@as MapPosition.struct]] + local drill_position = drill.position local dx = math.abs(drill_position.x - position.x) local dy = math.abs(drill_position.y - position.y) if dx <= radius and dy <= radius then diff --git a/exp_scenario/module/gui/production_stats.lua b/exp_scenario/module/gui/production_stats.lua index bc6cac8a..94b49562 100644 --- a/exp_scenario/module/gui/production_stats.lua +++ b/exp_scenario/module/gui/production_stats.lua @@ -130,7 +130,7 @@ Elements.production_table = Gui.define("production_stats/production_table") :track_all_elements() :draw(function(def, parent) local scroll_table = Gui.elements.scroll_table(parent, 304, 4) - local display_alignments = scroll_table.style.column_alignments + local display_alignments = assert(scroll_table.style.column_alignments) for i = 2, 4 do display_alignments[i] = "right" end diff --git a/exp_util/module/flying_text.lua b/exp_util/module/flying_text.lua index 84f87564..9ec23028 100644 --- a/exp_util/module/flying_text.lua +++ b/exp_util/module/flying_text.lua @@ -44,7 +44,7 @@ function FlyingText.create_above_entity(options) local entity = assert(options.target_entity, "A target entity is required") local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]] local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y - local position = entity.position --[[@as MapPosition.struct]] + local position = entity.position local offset = options.offset or { x = 0, y = 0 } options.position = { @@ -66,7 +66,7 @@ function FlyingText.create_above_player(options) local entity = player.character; if not entity then return end local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]] local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y - local position = entity.position --[[@as MapPosition.struct]] + local position = entity.position local offset = options.offset or { x = 0, y = 0 } options.position = { @@ -88,7 +88,7 @@ function FlyingText.create_as_player(options) local entity = player.character; if not entity then return end local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]] local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y - local position = entity.position --[[@as MapPosition.struct]] + local position = entity.position local offset = options.offset or { x = 0, y = 0 } options.color = player.chat_color