1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2024-12-12 10:13:58 +02:00

Remove unnecessary use of pairs in GetClosestUniqueSpawn. Remove old reference to "enemy-easy" in ShareChatBetweenForces.

This commit is contained in:
Oarcinae 2024-11-05 11:10:56 -05:00
parent 7dba51d535
commit b10b507eb8
2 changed files with 4 additions and 10 deletions

View File

@ -600,7 +600,6 @@ function ShareChatBetweenForces(player, msg)
for _,force in pairs(game.forces) do
if (force ~= nil) then
if ((force.name ~= "enemy") and
(force.name ~= "enemy-easy") and
(force.name ~= "neutral") and
(force.name ~= "player") and
(force ~= player.force)) then

View File

@ -1064,15 +1064,10 @@ end
---@param pos MapPosition
---@return OarcUniqueSpawn?
function GetClosestUniqueSpawn(surface_name, pos)
local surface_spawns
for surface_index, spawns in pairs(storage.unique_spawns) do
if (surface_index == surface_name) then
if (table_size(spawns) == 0) then return nil end -- EXIT - No spawns on requested surface
surface_spawns = spawns
end
end
if (surface_spawns == nil) then return nil end
local surface_spawns = storage.unique_spawns[surface_name]
if (surface_spawns == nil) then return nil end -- EXIT - No spawns on requested surface
if (table_size(surface_spawns) == 0) then return nil end -- EXIT - No spawns on requested surface
local closest_dist = nil
local closest_spawn = nil