mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Enable stricter type checks
This commit is contained in:
@@ -42,7 +42,7 @@ end
|
||||
|
||||
local function emit_event(args)
|
||||
local title = args.title or ""
|
||||
local color = args.color or "0x0"
|
||||
local color = args.color or "0x0" --- @type string | Color
|
||||
local description = args.description or ""
|
||||
|
||||
if type(color) == "table" then
|
||||
|
||||
@@ -14,6 +14,7 @@ end
|
||||
|
||||
-- Will degrade a tile down to the next tile when called
|
||||
local function degrade(surface, position)
|
||||
--- @diagnostic disable-next-line Incorrect Api Type: https://forums.factorio.com/viewtopic.php?f=233&t=109145&p=593761&hilit=get_tile#p593761
|
||||
local tile = surface.get_tile(position)
|
||||
local tile_name = tile.name
|
||||
local degrade_tile_name = config.degrade_order[tile_name]
|
||||
@@ -55,6 +56,7 @@ end
|
||||
|
||||
-- Gets the mean of the strengths around a tile to give the strength at that position
|
||||
local function get_tile_strength(surface, position)
|
||||
--- @diagnostic disable-next-line Incorrect Api Type: https://forums.factorio.com/viewtopic.php?f=233&t=109145&p=593761&hilit=get_tile#p593761
|
||||
local tile = surface.get_tile(position)
|
||||
local tile_name = tile.name
|
||||
local strength = config.strengths[tile_name]
|
||||
@@ -62,7 +64,7 @@ local function get_tile_strength(surface, position)
|
||||
for x = -1, 1 do -- x loop
|
||||
local px = position.x + x
|
||||
for y = -1, 1 do -- y loop
|
||||
local check_tile = surface.get_tile{ x = px, y = position.y + y }
|
||||
local check_tile = surface.get_tile(px, position.y + y)
|
||||
local check_tile_name = check_tile.name
|
||||
local check_strength = config.strengths[check_tile_name] or 0
|
||||
strength = strength + check_strength
|
||||
|
||||
@@ -144,9 +144,11 @@ local function spawn_area(surface, position)
|
||||
|
||||
local fr = config.spawn_area.landfill_radius
|
||||
local fr2 = fr ^ 2
|
||||
--- @diagnostic disable-next-line Incorrect Api Type: https://forums.factorio.com/viewtopic.php?f=233&t=109145&p=593761&hilit=get_tile#p593761
|
||||
local fill_tile = surface.get_tile(position).name
|
||||
|
||||
-- Make sure a non water tile is used for each tile
|
||||
--- @diagnostic disable-next-line Incorrect Api Type: https://forums.factorio.com/viewtopic.php?f=233&t=109145&p=593761&hilit=get_tile#p593761
|
||||
if surface.get_tile(position).collides_with("player") then fill_tile = "landfill" end
|
||||
if decon_tile == nil then decon_tile = fill_tile end
|
||||
|
||||
@@ -160,6 +162,7 @@ local function spawn_area(surface, position)
|
||||
if dst < tr2 then
|
||||
-- If it is inside the decon radius always set the tile
|
||||
table.insert(tiles_to_make, { name = decon_tile, position = pos })
|
||||
--- @diagnostic disable-next-line Incorrect Api Type: https://forums.factorio.com/viewtopic.php?f=233&t=109145&p=593761&hilit=get_tile#p593761
|
||||
elseif dst < fr2 and surface.get_tile(pos).collides_with("player") then
|
||||
-- If it is inside the fill radius only set the tile if it is water
|
||||
table.insert(tiles_to_make, { name = fill_tile, position = pos })
|
||||
|
||||
Reference in New Issue
Block a user