Skip to content

Commit

Permalink
Partial Share Bug Fix (FAForever#4491)
Browse files Browse the repository at this point in the history
  • Loading branch information
Penguin5 authored Dec 12, 2022
1 parent e4bf44c commit 3b7d752
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/SimUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ local sharedUnits = {}
function KillSharedUnits(owner, categoriesToKill)
local sharedUnitOwner = sharedUnits[owner]
if sharedUnitOwner and not table.empty(sharedUnitOwner) then
for _, unit in sharedUnitOwner do
local sharedUnitOwnerSize = table.getn(sharedUnitOwner)
for i = sharedUnitOwnerSize, 1, -1 do
local unit = sharedUnitOwner[i]
if not unit.Dead and unit.oldowner == owner then
if categoriesToKill then
if ContainsCategory(unit, categoriesToKill) then
table.remove(sharedUnits[owner], unit)
if EntityCategoryContains(categoriesToKill, unit) then
table.remove(sharedUnits[owner], i)
unit:Kill()
end
else
Expand Down

0 comments on commit 3b7d752

Please sign in to comment.