mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
- fixed cargo APC unloading in case of enemy presence and loading in case of enemy destroy or leave.
- fixed boarding near range to 5 meters for cargo units.
This commit is contained in:
parent
dffd66940d
commit
1aabb1bfbd
@ -423,7 +423,7 @@ function AI_CARGO_APC:onbeforeLoad( APC, From, Event, To )
|
|||||||
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||||
self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), APC:GetName() } )
|
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
|
if Cargo:IsInLoadRadius( APCUnit:GetCoordinate() ) then
|
||||||
self:F( { "In radius", APCUnit:GetName() } )
|
self:F( { "In radius", APCUnit:GetName() } )
|
||||||
|
|
||||||
@ -551,7 +551,6 @@ function AI_CARGO_APC:onafterUnload( APC, From, Event, To, Deployed )
|
|||||||
for _, Cargo in pairs( APCUnit:GetCargo() ) do
|
for _, Cargo in pairs( APCUnit:GetCargo() ) do
|
||||||
if Cargo:IsLoaded() then
|
if Cargo:IsLoaded() then
|
||||||
Cargo:UnBoard()
|
Cargo:UnBoard()
|
||||||
Cargo:SetDeployed( true )
|
|
||||||
self:__Unboard( 10, Cargo, Deployed )
|
self:__Unboard( 10, Cargo, Deployed )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -580,7 +579,6 @@ function AI_CARGO_APC:onafterUnboard( APC, From, Event, To, Cargo, Deployed )
|
|||||||
for _, Cargo in pairs( APCUnit:GetCargo() ) do
|
for _, Cargo in pairs( APCUnit:GetCargo() ) do
|
||||||
if Cargo:IsLoaded() then
|
if Cargo:IsLoaded() then
|
||||||
Cargo:UnBoard()
|
Cargo:UnBoard()
|
||||||
Cargo:SetDeployed( true )
|
|
||||||
self:__Unboard( 10, Cargo, Deployed )
|
self:__Unboard( 10, Cargo, Deployed )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -605,6 +603,7 @@ function AI_CARGO_APC:onbeforeUnloaded( APC, From, Event, To, Cargo, Deployed )
|
|||||||
self:F( { APC, From, Event, To, Cargo:GetName(), Deployed = Deployed } )
|
self:F( { APC, From, Event, To, Cargo:GetName(), Deployed = Deployed } )
|
||||||
|
|
||||||
local AllUnloaded = true
|
local AllUnloaded = true
|
||||||
|
Cargo:SetDeployed( true )
|
||||||
|
|
||||||
--Cargo:Regroup()
|
--Cargo:Regroup()
|
||||||
|
|
||||||
|
|||||||
@ -239,7 +239,7 @@ do -- CARGO_UNIT
|
|||||||
if not self.CargoInAir then
|
if not self.CargoInAir then
|
||||||
-- If NearRadius is given, then use the given NearRadius, otherwise calculate the NearRadius
|
-- 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.
|
-- 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
|
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||||
self:Load( CargoCarrier, NearRadius, ... )
|
self:Load( CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
|
|||||||
@ -279,7 +279,7 @@ function POSITIONABLE:GetBoundingRadius()
|
|||||||
local Z = Box.max.z - Box.min.z
|
local Z = Box.max.z - Box.min.z
|
||||||
local CX = X / 2
|
local CX = X / 2
|
||||||
local CZ = Z / 2
|
local CZ = Z / 2
|
||||||
return math.max( CX, CZ ) + 3
|
return math.max( CX, CZ )
|
||||||
end
|
end
|
||||||
|
|
||||||
BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )
|
BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user