mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 19:45:29 +00:00
Optimizations of cargo deployment.
This commit is contained in:
@@ -148,7 +148,7 @@ function AI_CARGO_TROOPS:onafterLoad( CargoCarrier, From, Event, To )
|
|||||||
|
|
||||||
if CargoCarrier and CargoCarrier:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then
|
||||||
CargoCarrier:RouteStop()
|
CargoCarrier:RouteStop()
|
||||||
self:Board()
|
self:__Board( 10 )
|
||||||
self.CargoGroup:Board( CargoCarrier, 25 )
|
self.CargoGroup:Board( CargoCarrier, 25 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ function AI_CARGO_TROOPS:onafterBoard( CargoCarrier, From, Event, To )
|
|||||||
if CargoCarrier and CargoCarrier:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then
|
||||||
self:F({ IsLoaded = self.CargoGroup:IsLoaded() } )
|
self:F({ IsLoaded = self.CargoGroup:IsLoaded() } )
|
||||||
if not self.CargoGroup:IsLoaded() then
|
if not self.CargoGroup:IsLoaded() then
|
||||||
self:__Board( 1 )
|
self:__Board( 10 )
|
||||||
else
|
else
|
||||||
self:__Loaded( 1 )
|
self:__Loaded( 1 )
|
||||||
end
|
end
|
||||||
@@ -190,7 +190,7 @@ function AI_CARGO_TROOPS:onafterUnload( CargoCarrier, From, Event, To )
|
|||||||
if CargoCarrier and CargoCarrier:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then
|
||||||
CargoCarrier:RouteStop()
|
CargoCarrier:RouteStop()
|
||||||
self.CargoGroup:UnBoard( )
|
self.CargoGroup:UnBoard( )
|
||||||
self:__Unboard( 1 )
|
self:__Unboard( 10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -202,9 +202,9 @@ function AI_CARGO_TROOPS:onafterUnboard( CargoCarrier, From, Event, To )
|
|||||||
|
|
||||||
if CargoCarrier and CargoCarrier:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then
|
||||||
if not self.CargoGroup:IsUnLoaded() then
|
if not self.CargoGroup:IsUnLoaded() then
|
||||||
self:__Unboard( 1 )
|
self:__Unboard( 10 )
|
||||||
else
|
else
|
||||||
self:Unloaded()
|
self:__Unloaded( 1 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -771,25 +771,26 @@ do -- CARGO_UNIT
|
|||||||
|
|
||||||
|
|
||||||
-- if there is no ToPointVec2 given, then use the CargoRoutePointVec2
|
-- if there is no ToPointVec2 given, then use the CargoRoutePointVec2
|
||||||
ToPointVec2 = ToPointVec2 or CargoCarrierPointVec2:GetRandomCoordinateInRadius( NearRadius, 5 )
|
local FromDirectionVec3 = CargoCarrierPointVec2:GetDirectionVec3( ToPointVec2 or CargoRoutePointVec2 )
|
||||||
local DirectionVec3 = CargoCarrierPointVec2:GetDirectionVec3(ToPointVec2)
|
local FromAngle = CargoCarrierPointVec2:GetAngleDegrees(FromDirectionVec3)
|
||||||
local Angle = CargoCarrierPointVec2:GetAngleDegrees(DirectionVec3)
|
local FromPointVec2 = CargoCarrierPointVec2:Translate( DeployDistance, FromAngle )
|
||||||
|
--local CargoDeployPointVec2 = CargoCarrierPointVec2:GetRandomCoordinateInRadius( 10, 5 )
|
||||||
|
|
||||||
local CargoDeployPointVec2 = CargoCarrierPointVec2:Translate( DeployDistance, Angle )
|
ToPointVec2 = ToPointVec2 or CargoCarrierPointVec2:GetRandomCoordinateInRadius( NearRadius, DeployDistance )
|
||||||
local CargoDeployPointVec2 = CargoCarrierPointVec2:GetRandomCoordinateInRadius( NearRadius, 5 )
|
|
||||||
|
|
||||||
local FromPointVec2 = CargoCarrierPointVec2
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
if self.CargoObject then
|
if self.CargoObject then
|
||||||
self.CargoObject:ReSpawn( CargoDeployPointVec2:GetVec3(), CargoDeployHeading )
|
self.CargoObject:ReSpawn( FromPointVec2:GetVec3(), CargoDeployHeading )
|
||||||
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||||
self.CargoCarrier = nil
|
self.CargoCarrier = nil
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
Points[#Points+1] = CargoCarrierPointVec2:WaypointGround( Speed )
|
|
||||||
|
|
||||||
Points[#Points+1] = ToPointVec2:WaypointGround( Speed )
|
-- From
|
||||||
|
Points[#Points+1] = FromPointVec2:WaypointGround( Speed, "Vee" )
|
||||||
|
|
||||||
|
-- To
|
||||||
|
Points[#Points+1] = ToPointVec2:WaypointGround( Speed, "Vee" )
|
||||||
|
|
||||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||||
self.CargoObject:SetTask( TaskRoute, 1 )
|
self.CargoObject:SetTask( TaskRoute, 1 )
|
||||||
@@ -1375,7 +1376,7 @@ function CARGO_GROUP:OnEventCargoDead( EventData )
|
|||||||
function CARGO_GROUP:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 100
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
local Timer = 1
|
local Timer = 1
|
||||||
|
|
||||||
@@ -1390,7 +1391,7 @@ function CARGO_GROUP:OnEventCargoDead( EventData )
|
|||||||
function( Cargo, NearRadius )
|
function( Cargo, NearRadius )
|
||||||
|
|
||||||
Cargo:__UnBoard( Timer, ToPointVec2, NearRadius )
|
Cargo:__UnBoard( Timer, ToPointVec2, NearRadius )
|
||||||
Timer = Timer + 10
|
Timer = Timer + 3
|
||||||
end, { NearRadius }
|
end, { NearRadius }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user