Fix issue with MapPosition.energy

This commit is contained in:
Cooldude2606
2026-08-08 21:58:46 +01:00
parent d495a345d6
commit 1e861c5c0b
10 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -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)
@@ -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,
@@ -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 }
@@ -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
@@ -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
+1 -1
View File
@@ -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