Final manual fixups

This commit is contained in:
Cooldude2606
2026-08-08 23:09:39 +01:00
parent 1e861c5c0b
commit 5890155331
19 changed files with 59 additions and 75 deletions
@@ -42,7 +42,7 @@ local function format_position(pos)
end
--- Convert an area to a string
--- @param area ExpUtil_AABB.Box
--- @param area BoundingBox.struct
--- @return string
local function format_area(area)
return format_string("%.1f,%.1f,%.1f,%.1f", area.left_top.x, area.left_top.y, area.right_bottom.x, area.right_bottom.y)
@@ -137,8 +137,7 @@ local function on_player_ammo_inventory_changed(event)
if not player or not player.character then return end
local character_ammo = assert(player.get_inventory(defines.inventory.character_ammo))
local gun_index = player.character.selected_gun_index
--- @cast gun_index uint
local gun_index = player.character.selected_gun_index --[[@as uint]]
local item = character_ammo[gun_index]
if not item or not item.valid or not item.valid_for_read then
return
@@ -32,7 +32,7 @@ local function degrade_entity(entity)
local tiles = {}
local surface = entity.surface
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
local bounding_box = entity.bounding_box
local left_top = bounding_box.left_top
local right_bottom = bounding_box.right_bottom
for x = left_top.x, right_bottom.x do
@@ -167,7 +167,7 @@ local function try_deconstruct_miner(entity)
create_entity(create_entity_param)
-- Find all the entities to connect to
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
local bounding_box = entity.bounding_box
local search_area = {
{ bounding_box.left_top.x - 1, bounding_box.left_top.y - 1 },
{ bounding_box.right_bottom.x + 1, bounding_box.right_bottom.y + 1 },
@@ -57,7 +57,7 @@ local function rename_station(event)
-- Find the closest resource
local icon = ""
local item_name = ""
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
local bounding_box = entity.bounding_box
local resources = entity.surface.find_entities_filtered{ position = entity.position, radius = 250, type = "resource" }
if #resources > 0 then
local closest_recourse --- @type LuaEntity?
@@ -66,7 +66,7 @@ local function rename_station(event)
-- Check which recourse is closest
for _, resource in ipairs(resources) do
local resource_box = resource.bounding_box --[[@as ExpUtil_AABB.Box]]
local resource_box = resource.bounding_box
local dx = px - resource_box.left_top.x
local dy = py - resource_box.left_top.y
local distance = (dx * dx) + (dy * dy)