@@ -3747,16 +3747,16 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
37473747 return self
37483748 end
37493749
3750- local coord = Unit :GetCoordinate () or Group :GetCoordinate ()
3750+ local coord = Unit :GetCoord () or Group :GetCoord ()
37513751 local capabilities = self :_GetUnitCapabilities (Unit )
37523752 local innerDist = (capabilities .length and capabilities .length / 2 ) or 15
37533753 local maxUnitsNearby = self .maxUnitsNearby or 3
37543754 local searchRadius = self .UnitDistance or 90
37553755 local checkZone = ZONE_RADIUS :New (" CTLD_C130UnitsZone" ,coord :GetVec2 (),searchRadius ,false )
3756- local nearGroups = SET_GROUP :New ():FilterCoalitions (" blue " ):FilterZones ({checkZone }):FilterOnce ()
3756+ local nearGroups = SET_GROUP :New ():FilterCoalitions (self . coalitiontxt ):FilterZones ({checkZone }):FilterOnce ()
37573757 local nearbyCount = 0
37583758 for _ ,gr in pairs (nearGroups .Set ) do
3759- local gc = gr :GetCoordinate ()
3759+ local gc = gr :GetCoord ()
37603760 if gc then
37613761 local dist = coord :Get2DDistance (gc )
37623762 if dist > innerDist then
@@ -3925,7 +3925,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
39253925 -- Check cargo location if available
39263926 local location = Cargo :GetLocation ()
39273927 if location then
3928- local unitcoord = Unit :GetCoordinate () or Group :GetCoordinate ()
3928+ local unitcoord = Unit :GetCoord () or Group :GetCoord ()
39293929 if unitcoord then
39303930 if not location :IsCoordinateInZone (unitcoord ) then
39313931 -- no we're not at the right spot
@@ -4136,8 +4136,8 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
41364136 if type (ship ) == " string" then
41374137 self :T (" Spawning on ship " .. ship )
41384138 local Ship = UNIT :FindByName (ship )
4139- local shipcoord = Ship :GetCoordinate ()
4140- local unitcoord = Unit :GetCoordinate ()
4139+ local shipcoord = Ship :GetCoord ()
4140+ local unitcoord = Unit :GetCoord ()
41414141 local dist = shipcoord :Get2DDistance (unitcoord )
41424142 dist = dist - (20 + math.random (1 , 10 ))
41434143 local halfwidth = (width or 20 ) / 2
@@ -4395,11 +4395,11 @@ function CTLD:_C130RemoveUnitsNearby(_group,_unit)
43954395 local innerDist = (capabilities .length and capabilities .length / 2 ) or 15
43964396 local finddist = self .PackDistance or (self .CrateDistance or 35 )
43974397 local zone = ZONE_RADIUS :New (" CTLD_C130RemoveZone" ,location :GetVec2 (),finddist ,false )
4398- local nearestGroups = SET_GROUP :New ():FilterCoalitions (" blue " ):FilterZones ({zone }):FilterOnce ()
4398+ local nearestGroups = SET_GROUP :New ():FilterCoalitions (self . coalitiontxt ):FilterZones ({zone }):FilterOnce ()
43994399 local removedAny = false
44004400 local removedTable = {}
44014401 for _ , gr in pairs (nearestGroups .Set ) do
4402- local gc = gr :GetCoordinate ()
4402+ local gc = gr :GetCoord ()
44034403 if gc then
44044404 local dist = location :Get2DDistance (gc )
44054405 if dist > innerDist then
@@ -5683,18 +5683,18 @@ end
56835683-- @return #number Number
56845684function CTLD :_FindPackableGroupsNearby (Group , Unit )
56855685 self :T (self .lid .. " _FindPackableGroupsNearby" )
5686- local location = Group :GetCoordinate ()
5686+ local location = Group :GetCoord ()
56875687 if not location then return {}, 0 end
56885688 local capabilities = self :_GetUnitCapabilities (Unit )
56895689 local innerDist = (capabilities .length and capabilities .length / 2 ) or 15
56905690 local finddist = self .PackDistance or (self .CrateDistance or 35 )
56915691 local zone = ZONE_RADIUS :New (" CTLD_PackableZone" , location :GetVec2 (), finddist , false )
5692- local nearestGroups = SET_GROUP :New ():FilterCoalitions (" blue " ):FilterZones ({zone }):FilterOnce ()
5692+ local nearestGroups = SET_GROUP :New ():FilterCoalitions (self . coalitiontxt ):FilterZones ({zone }):FilterOnce ()
56935693 local packable = {}
56945694
56955695 for _ , gr in pairs (nearestGroups .Set ) do
56965696 if gr and gr :GetName () ~= Group :GetName () then
5697- local gc = gr :GetCoordinate ()
5697+ local gc = gr :GetCoord ()
56985698 if gc then
56995699 local dist = location :Get2DDistance (gc )
57005700 if dist > innerDist and dist <= finddist then
@@ -6171,11 +6171,11 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,Mult
61716171 local ctype = Build .Type -- #CTLD_CARGO.Enum
61726172 local canmove = false
61736173 if ctype == CTLD_CARGO .Enum .VEHICLE then canmove = true end
6174- if ctype == CTLD_CARGO .Enum .STATIC then
6175- return self
6174+ if ctype == CTLD_CARGO .Enum .STATIC then
6175+ return self
61766176 end
61776177 local temptable = Build .Template or {}
6178- if type (temptable ) == " string" then
6178+ if type (temptable ) == " string" then
61796179 temptable = {temptable }
61806180 end
61816181 local zone = nil -- Core.Zone#ZONE_RADIUS
@@ -6217,8 +6217,11 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,Mult
62176217 self :__CratesBuild (1 ,Group ,Unit ,self .DroppedTroops [self .TroopCounter ])
62186218 end
62196219 end -- template loop
6220- self :_RefreshLoadCratesMenu (Group , Unit )
6221- self :_RefreshPackMenus (Group , Unit )
6220+
6221+ if Group and Group :IsAlive () and Group :GetID () then
6222+ self :_RefreshLoadCratesMenu (Group , Unit )
6223+ self :_RefreshPackMenus (Group , Unit )
6224+ end
62226225 else
62236226 self :T (self .lid .. " Group KIA while building!" )
62246227 end
@@ -9008,7 +9011,7 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
90089011 local zoneret = nil
90099012 local zonewret = nil
90109013 local zonenameret = nil
9011- local unitcoord = Unit :GetCoordinate ()
9014+ local unitcoord = Unit :GetCoord ()
90129015 if not unitcoord then
90139016 if Zonetype == CTLD .CargoZoneType .SHIP then
90149017 return false , nil , nil , 1000000 , nil
@@ -9029,7 +9032,7 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
90299032 self :T (" Checking Type Ship: " .. zonename )
90309033 local ZoneUNIT = UNIT :FindByName (zonename )
90319034 if not ZoneUNIT then return false end
9032- zonecoord = ZoneUNIT :GetCoordinate ()
9035+ zonecoord = ZoneUNIT :GetCoord ()
90339036 zoneradius = czone .shiplength
90349037 zonewidth = czone .shipwidth
90359038 zone = ZONE_UNIT :New ( ZoneUNIT :GetName (), ZoneUNIT , zoneradius / 2 )
0 commit comments