mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixed #456
-- After landing the tasking menu is displayed again. -- The cargo is boarded properly now. Every 15 seconds is checked if the cargo is still moving.
This commit is contained in:
parent
a87ab0fd82
commit
d369a1be9f
@ -237,7 +237,7 @@ function CARGO:New( Type, Name, Weight ) --R2.1
|
|||||||
self:F( { Type, Name, Weight } )
|
self:F( { Type, Name, Weight } )
|
||||||
|
|
||||||
self:SetStartState( "UnLoaded" )
|
self:SetStartState( "UnLoaded" )
|
||||||
self:AddTransition( "UnLoaded", "Board", "Boarding" )
|
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||||
self:AddTransition( "Boarding" , "Boarding", "Boarding" )
|
self:AddTransition( "Boarding" , "Boarding", "Boarding" )
|
||||||
self:AddTransition( "Boarding", "Load", "Loaded" )
|
self:AddTransition( "Boarding", "Load", "Loaded" )
|
||||||
self:AddTransition( "UnLoaded", "Load", "Loaded" )
|
self:AddTransition( "UnLoaded", "Load", "Loaded" )
|
||||||
@ -701,7 +701,27 @@ function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ...
|
|||||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||||
self:Load( CargoCarrier, NearRadius, ... )
|
self:Load( CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
self:__Boarding( 1, CargoCarrier, NearRadius )
|
local Speed = 90
|
||||||
|
local Angle = 180
|
||||||
|
local Distance = 5
|
||||||
|
|
||||||
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
|
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||||
|
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
|
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||||
|
local CargoDeployPointVec2 = CargoCarrierPointVec2:Translate( Distance, CargoDeployHeading )
|
||||||
|
|
||||||
|
local Points = {}
|
||||||
|
|
||||||
|
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
||||||
|
|
||||||
|
Points[#Points+1] = PointStartVec2:RoutePointGround( Speed )
|
||||||
|
Points[#Points+1] = CargoDeployPointVec2:RoutePointGround( Speed )
|
||||||
|
|
||||||
|
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||||
|
self.CargoObject:SetTask( TaskRoute, 2 )
|
||||||
|
self:__Boarding( -1, CargoCarrier, NearRadius )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -738,28 +758,9 @@ end
|
|||||||
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||||
|
|
||||||
local Speed = 90
|
|
||||||
local Angle = 180
|
|
||||||
local Distance = 5
|
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
||||||
|
self:__Board( -15, CargoCarrier, NearRadius, ... )
|
||||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
|
||||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
|
||||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
|
||||||
local CargoDeployPointVec2 = CargoCarrierPointVec2:Translate( Distance, CargoDeployHeading )
|
|
||||||
|
|
||||||
local Points = {}
|
|
||||||
|
|
||||||
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
|
||||||
|
|
||||||
Points[#Points+1] = PointStartVec2:RoutePointGround( Speed )
|
|
||||||
Points[#Points+1] = CargoDeployPointVec2:RoutePointGround( Speed )
|
|
||||||
|
|
||||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
|
||||||
self.CargoObject:SetTask( TaskRoute, 2 )
|
|
||||||
|
|
||||||
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -181,7 +181,7 @@ do -- TASK_CARGO
|
|||||||
|
|
||||||
Fsm:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "SelectAction", Rejected = "Reject" } )
|
Fsm:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "SelectAction", Rejected = "Reject" } )
|
||||||
|
|
||||||
Fsm:AddTransition( { "Assigned", "WaitingForCommand", "ArrivedAtPickup", "ArrivedAtDeploy", "Boarded", "UnBoarded" }, "SelectAction", "WaitingForCommand" )
|
Fsm:AddTransition( { "Assigned", "WaitingForCommand", "ArrivedAtPickup", "ArrivedAtDeploy", "Boarded", "UnBoarded", "Landed" }, "SelectAction", "WaitingForCommand" )
|
||||||
|
|
||||||
Fsm:AddTransition( "WaitingForCommand", "RouteToPickup", "RoutingToPickup" )
|
Fsm:AddTransition( "WaitingForCommand", "RouteToPickup", "RoutingToPickup" )
|
||||||
Fsm:AddProcess ( "RoutingToPickup", "RouteToPickupPoint", ACT_ROUTE_POINT:New(), { Arrived = "ArriveAtPickup" } )
|
Fsm:AddProcess ( "RoutingToPickup", "RouteToPickupPoint", ACT_ROUTE_POINT:New(), { Arrived = "ArriveAtPickup" } )
|
||||||
@ -339,7 +339,7 @@ do -- TASK_CARGO
|
|||||||
function Fsm:onafterRouteToDeploy( TaskUnit, Task, From, Event, To, DeployZone )
|
function Fsm:onafterRouteToDeploy( TaskUnit, Task, From, Event, To, DeployZone )
|
||||||
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
||||||
|
|
||||||
|
self:E( DeployZone )
|
||||||
self.DeployZone = DeployZone
|
self.DeployZone = DeployZone
|
||||||
Task:SetDeployZone( self.DeployZone, TaskUnit )
|
Task:SetDeployZone( self.DeployZone, TaskUnit )
|
||||||
self:__RouteToDeployZone( -0.1 )
|
self:__RouteToDeployZone( -0.1 )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user