diff --git a/Moose Development/Moose/AI/AI_Cargo_APC.lua b/Moose Development/Moose/AI/AI_Cargo_APC.lua index 58a2e7589..3cb970db3 100644 --- a/Moose Development/Moose/AI/AI_Cargo_APC.lua +++ b/Moose Development/Moose/AI/AI_Cargo_APC.lua @@ -424,7 +424,7 @@ function AI_CARGO_APC:onbeforeLoad( APC, From, Event, To ) for _, Cargo in pairs( self.CargoSet:GetSet() ) do local Cargo = Cargo -- Cargo.Cargo#CARGO self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), APC:GetName() } ) - if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then + if Cargo:IsUnLoaded() then -- and not Cargo:IsDeployed() then if Cargo:IsInLoadRadius( APCUnit:GetCoordinate() ) then self:F( { "In radius", APCUnit:GetName() } ) @@ -552,7 +552,6 @@ function AI_CARGO_APC:onafterUnload( APC, From, Event, To, Deployed ) for _, Cargo in pairs( APCUnit:GetCargo() ) do if Cargo:IsLoaded() then Cargo:UnBoard() - Cargo:SetDeployed( true ) self:__Unboard( 10, Cargo, Deployed ) end end @@ -581,7 +580,6 @@ function AI_CARGO_APC:onafterUnboard( APC, From, Event, To, Cargo, Deployed ) for _, Cargo in pairs( APCUnit:GetCargo() ) do if Cargo:IsLoaded() then Cargo:UnBoard() - Cargo:SetDeployed( true ) self:__Unboard( 10, Cargo, Deployed ) return end @@ -606,6 +604,7 @@ function AI_CARGO_APC:onbeforeUnloaded( APC, From, Event, To, Cargo, Deployed ) self:F( { APC, From, Event, To, Cargo:GetName(), Deployed = Deployed } ) local AllUnloaded = true + Cargo:SetDeployed( true ) --Cargo:Regroup() diff --git a/Moose Development/Moose/Cargo/CargoUnit.lua b/Moose Development/Moose/Cargo/CargoUnit.lua index da9c73f2b..621a9a3a9 100644 --- a/Moose Development/Moose/Cargo/CargoUnit.lua +++ b/Moose Development/Moose/Cargo/CargoUnit.lua @@ -239,7 +239,7 @@ do -- CARGO_UNIT if not self.CargoInAir then -- If NearRadius is given, then use the given NearRadius, otherwise calculate the NearRadius -- based upon the Carrier bounding radius, which is calculated from the bounding rectangle on the Y axis. - local NearRadius = CargoCarrier:GetBoundingRadius( NearRadius ) + local NearRadius = CargoCarrier:GetBoundingRadius( NearRadius ) + 5 if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then self:Load( CargoCarrier, NearRadius, ... ) else diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index 4d28f6ebc..1ab9d9f78 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -643,14 +643,14 @@ function ZONE_RADIUS:Scan( ObjectCategories ) local CoalitionDCSUnit = ZoneObject:getCoalition() self.ScanData.Coalitions[CoalitionDCSUnit] = true self.ScanData.Units[ZoneObject] = ZoneObject - self:F( { Name = ZoneObject:getName(), Coalition = CoalitionDCSUnit } ) + self:F2( { Name = ZoneObject:getName(), Coalition = CoalitionDCSUnit } ) end if ObjectCategory == Object.Category.SCENERY then local SceneryType = ZoneObject:getTypeName() local SceneryName = ZoneObject:getName() self.ScanData.Scenery[SceneryType] = self.ScanData.Scenery[SceneryType] or {} self.ScanData.Scenery[SceneryType][SceneryName] = SCENERY:Register( SceneryName, ZoneObject ) - self:F( { SCENERY = self.ScanData.Scenery[SceneryType][SceneryName] } ) + self:F2( { SCENERY = self.ScanData.Scenery[SceneryType][SceneryName] } ) end end return true @@ -1174,6 +1174,7 @@ function ZONE_GROUP:New( ZoneName, ZoneGROUP, Radius ) self:F( { ZoneName, ZoneGROUP:GetVec2(), Radius } ) self._.ZoneGROUP = ZoneGROUP + self._.ZoneVec2Cache = self._.ZoneGROUP:GetVec2() -- Zone objects are added to the _DATABASE and SET_ZONE objects. _EVENTDISPATCHER:CreateEventNewZone( self ) @@ -1188,7 +1189,14 @@ end function ZONE_GROUP:GetVec2() self:F( self.ZoneName ) - local ZoneVec2 = self._.ZoneGROUP:GetVec2() + local ZoneVec2 = nil + + if self._.ZoneGROUP:IsAlive() then + ZoneVec2 = self._.ZoneGROUP:GetVec2() + self._.ZoneVec2Cache = ZoneVec2 + else + ZoneVec2 = self._.ZoneVec2Cache + end self:T( { ZoneVec2 } ) diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 906fd31d5..984ebfd65 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -279,7 +279,7 @@ function POSITIONABLE:GetBoundingRadius() local Z = Box.max.z - Box.min.z local CX = X / 2 local CZ = Z / 2 - return math.max( CX, CZ ) + 3 + return math.max( CX, CZ ) end BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )