mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
Enemy boat bug fix
Changes: - Fixed an issue where biters around enemy boat would sometimes not attack the player boat.
This commit is contained in:
parent
be95d7e3ce
commit
32b5cf74fa
@ -19,6 +19,7 @@ local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
|
||||
-- local Crew = require 'maps.pirates.crew'
|
||||
-- local Quest = require 'maps.pirates.quest'
|
||||
local SurfacesCommon = require 'maps.pirates.surfaces.common'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -895,7 +896,7 @@ function Public.try_boat_biters_attack()
|
||||
Public.send_boat_biters_for_attack(eboat)
|
||||
end
|
||||
else
|
||||
destination.dynamic_data.enemyboats[i] = nil
|
||||
Utils.fast_remove(destination.dynamic_data.enemyboats, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -873,7 +873,7 @@ function Public.boat_movement_tick(tickinterval)
|
||||
do end
|
||||
end
|
||||
else
|
||||
destination.dynamic_data.enemyboats[i] = nil
|
||||
Utils.fast_remove(destination.dynamic_data.enemyboats, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -216,6 +216,18 @@ function Public.ordered_table_with_index_removed(tbl, index)
|
||||
return to_keep
|
||||
end
|
||||
|
||||
-- Implementation of table.fast_remove
|
||||
function Public.fast_remove(tbl, index)
|
||||
local count = #tbl
|
||||
if index > count then
|
||||
return
|
||||
elseif index < count then
|
||||
tbl[index] = tbl[count]
|
||||
end
|
||||
|
||||
tbl[count] = nil
|
||||
end
|
||||
|
||||
function Public.length(tbl)
|
||||
local count = 0
|
||||
for k, _ in pairs(tbl) do
|
||||
|
Loading…
x
Reference in New Issue
Block a user