mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixes
-- Cargo deployment -- Mission text in menu -- Event log decrease
This commit is contained in:
parent
192dbadd51
commit
11c20d57fd
@ -234,7 +234,7 @@ do -- CARGO
|
|||||||
function CARGO:New( Type, Name, Weight ) --R2.1
|
function CARGO:New( Type, Name, Weight ) --R2.1
|
||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
||||||
self:F( { Type, Name, Weight } )
|
self:E( { Type, Name, Weight } )
|
||||||
|
|
||||||
self:SetStartState( "UnLoaded" )
|
self:SetStartState( "UnLoaded" )
|
||||||
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||||
@ -299,7 +299,7 @@ end
|
|||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:Spawn( PointVec2 )
|
function CARGO:Spawn( PointVec2 )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ end
|
|||||||
-- @param Core.Zone#ZONE_BASE Zone
|
-- @param Core.Zone#ZONE_BASE Zone
|
||||||
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
||||||
function CARGO:IsInZone( Zone )
|
function CARGO:IsInZone( Zone )
|
||||||
self:F( { Zone } )
|
self:E( { Zone } )
|
||||||
|
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
||||||
@ -329,7 +329,7 @@ end
|
|||||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO:IsNear( PointVec2, NearRadius )
|
function CARGO:IsNear( PointVec2, NearRadius )
|
||||||
self:F( { PointVec2 } )
|
self:E( { PointVec2 } )
|
||||||
|
|
||||||
local Distance = PointVec2:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
|
local Distance = PointVec2:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
|
||||||
self:T( Distance )
|
self:T( Distance )
|
||||||
@ -382,7 +382,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, Weight, ReportRadius, NearRadius )
|
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, Weight, ReportRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
||||||
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
self:E( { Type, Name, Weight, ReportRadius, NearRadius } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -393,7 +393,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
||||||
self:F2( ToPointVec2 )
|
self:E2( ToPointVec2 )
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ end -- CARGO_REPRESENTABLE
|
|||||||
-- @return #CARGO_REPORTABLE
|
-- @return #CARGO_REPORTABLE
|
||||||
function CARGO_REPORTABLE:New( CargoObject, Type, Name, Weight, ReportRadius )
|
function CARGO_REPORTABLE:New( CargoObject, Type, Name, Weight, ReportRadius )
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight ) ) -- #CARGO_REPORTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight ) ) -- #CARGO_REPORTABLE
|
||||||
self:F( { Type, Name, Weight, ReportRadius } )
|
self:E( { Type, Name, Weight, ReportRadius } )
|
||||||
|
|
||||||
self.ReportRadius = ReportRadius or 1000
|
self.ReportRadius = ReportRadius or 1000
|
||||||
self.CargoObject = CargoObject
|
self.CargoObject = CargoObject
|
||||||
@ -442,7 +442,7 @@ end -- CARGO_REPRESENTABLE
|
|||||||
-- @param Core.Point#POINT_VEC2 PointVec2
|
-- @param Core.Point#POINT_VEC2 PointVec2
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO_REPORTABLE:IsInRadius( PointVec2 )
|
function CARGO_REPORTABLE:IsInRadius( PointVec2 )
|
||||||
self:F( { PointVec2 } )
|
self:E( { PointVec2 } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
@ -513,7 +513,7 @@ do -- CARGO_UNIT
|
|||||||
-- @return #CARGO_UNIT
|
-- @return #CARGO_UNIT
|
||||||
function CARGO_UNIT:New( CargoUnit, Type, Name, Weight, NearRadius )
|
function CARGO_UNIT:New( CargoUnit, Type, Name, Weight, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoUnit, Type, Name, Weight, NearRadius ) ) -- #CARGO_UNIT
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoUnit, Type, Name, Weight, NearRadius ) ) -- #CARGO_UNIT
|
||||||
self:F( { Type, Name, Weight, NearRadius } )
|
self:E( { Type, Name, Weight, NearRadius } )
|
||||||
|
|
||||||
self:T( CargoUnit )
|
self:T( CargoUnit )
|
||||||
self.CargoObject = CargoUnit
|
self.CargoObject = CargoUnit
|
||||||
@ -542,7 +542,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@ -599,9 +599,9 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F( { ToPointVec2, From, Event, To } )
|
self:E( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@ -625,9 +625,9 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F( { ToPointVec2, From, Event, To } )
|
self:E( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
self:F( { ToPointVec2, From, Event, To } )
|
self:E( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@ -687,9 +687,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@ -735,9 +735,9 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
self:E( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||||
self:__Load( 1, CargoCarrier, ... )
|
self:__Load( 1, CargoCarrier, ... )
|
||||||
@ -756,11 +756,11 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
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:E( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||||
|
|
||||||
|
|
||||||
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
||||||
self:__Board( -15, CargoCarrier, NearRadius, ... )
|
self:__Board( -10, CargoCarrier, NearRadius, ... )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -772,13 +772,13 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
self:E( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||||
|
|
||||||
local Speed = 90
|
local Speed = 90
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Distance = 5
|
local Distance = 5
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
if From == "UnLoaded" or From == "Boarding" then
|
if From == "UnLoaded" or From == "Boarding" then
|
||||||
|
|
||||||
@ -793,7 +793,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
self:F()
|
self:E( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ do -- CARGO_PACKAGE
|
|||||||
-- @return #CARGO_PACKAGE
|
-- @return #CARGO_PACKAGE
|
||||||
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, ReportRadius, NearRadius )
|
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, ReportRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
||||||
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
self:E( { Type, Name, Weight, ReportRadius, NearRadius } )
|
||||||
|
|
||||||
self:T( CargoCarrier )
|
self:T( CargoCarrier )
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
@ -845,7 +845,7 @@ end
|
|||||||
-- @param #number BoardDistance
|
-- @param #number BoardDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@ -878,7 +878,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
local CargoCarrierPoint = CargoCarrier:GetPointVec2()
|
local CargoCarrierPoint = CargoCarrier:GetPointVec2()
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
@ -919,7 +919,7 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@ -957,7 +957,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__UnLoad( 1, CargoCarrier, Speed )
|
self:__UnLoad( 1, CargoCarrier, Speed )
|
||||||
@ -976,7 +976,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@ -1002,7 +1002,7 @@ end
|
|||||||
-- @param #number Distance
|
-- @param #number Distance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
||||||
self:F()
|
self:E()
|
||||||
|
|
||||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
@ -1049,7 +1049,7 @@ do -- CARGO_GROUP
|
|||||||
-- @return #CARGO_GROUP
|
-- @return #CARGO_GROUP
|
||||||
function CARGO_GROUP:New( CargoGroup, Type, Name, ReportRadius )
|
function CARGO_GROUP:New( CargoGroup, Type, Name, ReportRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( CargoGroup, Type, Name, 0, ReportRadius ) ) -- #CARGO_GROUP
|
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( CargoGroup, Type, Name, 0, ReportRadius ) ) -- #CARGO_GROUP
|
||||||
self:F( { Type, Name, ReportRadius } )
|
self:E( { Type, Name, ReportRadius } )
|
||||||
|
|
||||||
self.CargoSet = SET_CARGO:New()
|
self.CargoSet = SET_CARGO:New()
|
||||||
|
|
||||||
@ -1082,9 +1082,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { CargoCarrier.UnitName, From, Event, To } )
|
self:E( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
if From == "UnLoaded" then
|
if From == "UnLoaded" then
|
||||||
|
|
||||||
@ -1107,7 +1107,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onenterLoaded( From, Event, To, CargoCarrier, ... )
|
function CARGO_GROUP:onenterLoaded( From, Event, To, CargoCarrier, ... )
|
||||||
self:F( { CargoCarrier.UnitName, From, Event, To } )
|
self:E( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
if From == "UnLoaded" then
|
if From == "UnLoaded" then
|
||||||
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
||||||
@ -1128,9 +1128,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onleaveBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onleaveBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { CargoCarrier.UnitName, From, Event, To } )
|
self:E( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
local Boarded = true
|
local Boarded = true
|
||||||
|
|
||||||
@ -1159,9 +1159,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
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:E( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
local Timer = 1
|
local Timer = 1
|
||||||
|
|
||||||
@ -1187,9 +1187,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:E( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@ -1224,9 +1224,9 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:E( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
self:__UnLoad( 1, ToPointVec2, ... )
|
self:__UnLoad( 1, ToPointVec2, ... )
|
||||||
end
|
end
|
||||||
@ -1240,7 +1240,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... )
|
||||||
self:F( { From, Event, To, ToPointVec2 } )
|
self:E( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
if From == "Loaded" then
|
if From == "Loaded" then
|
||||||
|
|
||||||
|
|||||||
@ -890,7 +890,7 @@ function EVENT:onEvent( Event )
|
|||||||
for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
|
for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
|
||||||
|
|
||||||
if Event.IniObjectCategory ~= Object.Category.STATIC then
|
if Event.IniObjectCategory ~= Object.Category.STATIC then
|
||||||
self:E( { "Evaluating: ", EventClass:GetClassNameAndID() } )
|
--self:E( { "Evaluating: ", EventClass:GetClassNameAndID() } )
|
||||||
end
|
end
|
||||||
|
|
||||||
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
||||||
|
|||||||
@ -27,6 +27,18 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi
|
|||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM
|
local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM
|
||||||
|
|
||||||
|
self:T( { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
|
||||||
|
|
||||||
|
self.CommandCenter = CommandCenter
|
||||||
|
CommandCenter:AddMission( self )
|
||||||
|
|
||||||
|
self.Name = MissionName
|
||||||
|
self.MissionPriority = MissionPriority
|
||||||
|
self.MissionBriefing = MissionBriefing
|
||||||
|
self.MissionCoalition = MissionCoalition
|
||||||
|
|
||||||
|
self.Tasks = {}
|
||||||
|
|
||||||
self:SetStartState( "IDLE" )
|
self:SetStartState( "IDLE" )
|
||||||
|
|
||||||
self:AddTransition( "IDLE", "Start", "ENGAGED" )
|
self:AddTransition( "IDLE", "Start", "ENGAGED" )
|
||||||
@ -208,17 +220,6 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi
|
|||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
-- @param #number Delay The delay in seconds.
|
-- @param #number Delay The delay in seconds.
|
||||||
|
|
||||||
self:T( { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
|
|
||||||
|
|
||||||
self.CommandCenter = CommandCenter
|
|
||||||
CommandCenter:AddMission( self )
|
|
||||||
|
|
||||||
self.Name = MissionName
|
|
||||||
self.MissionPriority = MissionPriority
|
|
||||||
self.MissionBriefing = MissionBriefing
|
|
||||||
self.MissionCoalition = MissionCoalition
|
|
||||||
|
|
||||||
self.Tasks = {}
|
|
||||||
|
|
||||||
-- Private implementations
|
-- Private implementations
|
||||||
|
|
||||||
@ -257,7 +258,7 @@ end
|
|||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
-- @return #MISSION self
|
-- @return #MISSION self
|
||||||
function MISSION:GetName()
|
function MISSION:GetName()
|
||||||
return self.Name
|
return string.format( "Mission %s (%s)", self.Name, self.MissionPriority )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a Unit to join the Mission.
|
--- Add a Unit to join the Mission.
|
||||||
|
|||||||
@ -211,7 +211,7 @@ do -- TASK_CARGO
|
|||||||
---
|
---
|
||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @param Tasking.Task_Cargo#TASK_CARGO Task
|
-- @param Tasking.Task_CARGO#TASK_CARGO Task
|
||||||
function Fsm:onenterWaitingForCommand( TaskUnit, Task )
|
function Fsm:onenterWaitingForCommand( TaskUnit, Task )
|
||||||
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
||||||
|
|
||||||
@ -472,31 +472,41 @@ do -- TASK_CARGO
|
|||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @param Tasking.Task_Cargo#TASK_CARGO Task
|
-- @param Tasking.Task_Cargo#TASK_CARGO Task
|
||||||
|
-- @param From
|
||||||
|
-- @param Event
|
||||||
|
-- @param To
|
||||||
|
-- @param Cargo
|
||||||
|
-- @param Core.Zone#ZONE_BASE DeployZone
|
||||||
function Fsm:onafterPrepareUnBoarding( TaskUnit, Task, From, Event, To, Cargo, DeployZone )
|
function Fsm:onafterPrepareUnBoarding( TaskUnit, Task, From, Event, To, Cargo, DeployZone )
|
||||||
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo, DeployZone } )
|
||||||
|
|
||||||
self.Cargo = Cargo
|
self.Cargo = Cargo
|
||||||
self.DeployZone = DeployZone
|
self.DeployZone = DeployZone -- Core.Zone#ZONE_BASE
|
||||||
self:__UnBoard( -0.1 )
|
self:__UnBoard( -0.1, Cargo, DeployZone )
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @param Tasking.Task_Cargo#TASK_CARGO Task
|
-- @param Tasking.Task_Cargo#TASK_CARGO Task
|
||||||
function Fsm:onafterUnBoard( TaskUnit, Task )
|
-- @param From
|
||||||
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
-- @param Event
|
||||||
|
-- @param To
|
||||||
|
-- @param Cargo
|
||||||
|
-- @param Core.Zone#ZONE_BASE DeployZone
|
||||||
|
function Fsm:onafterUnBoard( TaskUnit, Task, From, Event, To, Cargo, DeployZone )
|
||||||
|
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo, DeployZone } )
|
||||||
|
|
||||||
function self.Cargo:OnEnterUnLoaded( From, Event, To, DeployZone, TaskProcess )
|
function self.Cargo:OnEnterUnLoaded( From, Event, To, DeployZone, TaskProcess )
|
||||||
|
|
||||||
self:E({From, Event, To, TaskUnit, TaskProcess })
|
self:E({From, Event, To, DeployZone, TaskProcess })
|
||||||
|
|
||||||
TaskProcess:__UnBoarded( -0.1 )
|
TaskProcess:__UnBoarded( -0.1 )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.Cargo:MessageToGroup( "UnBoarding ...", TaskUnit:GetGroup() )
|
self.Cargo:MessageToGroup( "UnBoarding ...", TaskUnit:GetGroup() )
|
||||||
self.Cargo:UnBoard( self.DeployZone:GetPointVec2(), 20, self )
|
self.Cargo:UnBoard( DeployZone:GetPointVec2(), 400, self )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user