mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
-- @function [parent=#CARGO] Board
|
||||
-- @param #CARGO self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||
|
||||
--- Boards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo to the Carrier.
|
||||
-- The cargo must be in the **UnLoaded** state.
|
||||
@@ -34,6 +35,7 @@
|
||||
-- @param #CARGO self
|
||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||
|
||||
|
||||
-- UnBoard
|
||||
@@ -117,6 +119,7 @@
|
||||
--- @function [parent=#CARGO] OnEnterBoarding
|
||||
-- @param #CARGO self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||
|
||||
-- UnBoarding
|
||||
|
||||
@@ -215,10 +218,10 @@ do -- CARGO
|
||||
-- @param #number Weight
|
||||
-- @param #number NearRadius (optional)
|
||||
-- @return #CARGO
|
||||
function CARGO:New( Type, Name, Weight, NearRadius )
|
||||
function CARGO:New( Type, Name, Weight )
|
||||
|
||||
local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM
|
||||
self:F( { Type, Name, Weight, NearRadius } )
|
||||
self:F( { Type, Name, Weight } )
|
||||
|
||||
self:SetStartState( "UnLoaded" )
|
||||
self:AddTransition( "UnLoaded", "Board", "Boarding" )
|
||||
@@ -234,7 +237,6 @@ function CARGO:New( Type, Name, Weight, NearRadius )
|
||||
self.Type = Type
|
||||
self.Name = Name
|
||||
self.Weight = Weight
|
||||
self.NearRadius = NearRadius or 200
|
||||
self.CargoObject = nil
|
||||
self.CargoCarrier = nil
|
||||
self.Representable = false
|
||||
@@ -311,14 +313,15 @@ end
|
||||
--- Check if CargoCarrier is near the Cargo to be Loaded.
|
||||
-- @param #CARGO self
|
||||
-- @param Core.Point#POINT_VEC2 PointVec2
|
||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||
-- @return #boolean
|
||||
function CARGO:IsNear( PointVec2 )
|
||||
function CARGO:IsNear( PointVec2, NearRadius )
|
||||
self:F( { PointVec2 } )
|
||||
|
||||
local Distance = PointVec2:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
|
||||
self:T( Distance )
|
||||
|
||||
if Distance <= self.NearRadius then
|
||||
if Distance <= NearRadius then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
@@ -407,11 +410,12 @@ do -- CARGO_REPORTABLE
|
||||
-- @param #number ReportRadius (optional)
|
||||
-- @param #number NearRadius (optional)
|
||||
-- @return #CARGO_REPORTABLE
|
||||
function CARGO_REPORTABLE:New( Type, Name, Weight, ReportRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, NearRadius ) ) -- #CARGO_REPORTABLE
|
||||
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
||||
function CARGO_REPORTABLE:New( CargoObject, Type, Name, Weight, ReportRadius )
|
||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight ) ) -- #CARGO_REPORTABLE
|
||||
self:F( { Type, Name, Weight, ReportRadius } )
|
||||
|
||||
self.ReportRadius = ReportRadius or 1000
|
||||
self.CargoObject = CargoObject
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -483,8 +487,6 @@ function CARGO_UNIT:New( CargoUnit, Type, Name, Weight, NearRadius )
|
||||
|
||||
self:T( self.ClassName )
|
||||
|
||||
-- Cargo objects are added to the _DATABASE and SET_CARGO objects.
|
||||
_EVENTDISPATCHER:CreateEventNewCargo( self )
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -638,12 +640,14 @@ end
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
function CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier, ... )
|
||||
self:F( { CargoCarrier.UnitName, From, Event, To } )
|
||||
function CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||
|
||||
local Speed = 10
|
||||
local Angle = 180
|
||||
local Distance = 5
|
||||
|
||||
NearRadius = NearRadius or 25
|
||||
|
||||
if From == "UnLoaded" then
|
||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||
@@ -670,10 +674,12 @@ end
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
function CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier, ... )
|
||||
self:F( { CargoCarrier.UnitName, From, Event, To } )
|
||||
function CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
|
||||
|
||||
if self:IsNear( CargoCarrier:GetPointVec2() ) then
|
||||
NearRadius = NearRadius or 25
|
||||
|
||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||
self:__Load( 1, CargoCarrier, ... )
|
||||
return true
|
||||
else
|
||||
@@ -706,9 +712,11 @@ end
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, ... )
|
||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F()
|
||||
|
||||
NearRadius = NearRadius or 25
|
||||
|
||||
self.CargoInAir = self.CargoObject:InAir()
|
||||
|
||||
self:T( self.CargoInAir )
|
||||
@@ -963,7 +971,7 @@ do -- CARGO_GROUP
|
||||
-- @param #number NearRadius (optional)
|
||||
-- @return #CARGO_GROUP
|
||||
function CARGO_GROUP:New( CargoGroup, Type, Name, ReportRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, ReportRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( CargoGroup, Type, Name, 0, ReportRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||
self:F( { Type, Name, ReportRadius, NearRadius } )
|
||||
|
||||
self.CargoSet = SET_CARGO:New()
|
||||
@@ -981,6 +989,9 @@ function CARGO_GROUP:New( CargoGroup, Type, Name, ReportRadius, NearRadius )
|
||||
self:SetWeight( WeightGroup )
|
||||
|
||||
self:T( { "Weight Cargo", WeightGroup } )
|
||||
|
||||
-- Cargo objects are added to the _DATABASE and SET_CARGO objects.
|
||||
_EVENTDISPATCHER:CreateEventNewCargo( self )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -1,70 +1,3 @@
|
||||
--- The main include file for the MOOSE system.
|
||||
-- Test of permissions
|
||||
|
||||
--- Core Routines
|
||||
Include.File( "Utilities/Routines" )
|
||||
Include.File( "Utilities/Utils" )
|
||||
|
||||
--- Core Classes
|
||||
Include.File( "Core/Base" )
|
||||
Include.File( "Core/Scheduler" )
|
||||
Include.File( "Core/ScheduleDispatcher")
|
||||
Include.File( "Core/Event" )
|
||||
Include.File( "Core/Menu" )
|
||||
Include.File( "Core/Zone" )
|
||||
Include.File( "Core/Database" )
|
||||
Include.File( "Core/Set" )
|
||||
Include.File( "Core/Point" )
|
||||
Include.File( "Core/Message" )
|
||||
Include.File( "Core/Fsm" )
|
||||
Include.File( "Core/Radio" )
|
||||
|
||||
--- Wrapper Classes
|
||||
Include.File( "Wrapper/Object" )
|
||||
Include.File( "Wrapper/Identifiable" )
|
||||
Include.File( "Wrapper/Positionable" )
|
||||
Include.File( "Wrapper/Controllable" )
|
||||
Include.File( "Wrapper/Group" )
|
||||
Include.File( "Wrapper/Unit" )
|
||||
Include.File( "Wrapper/Client" )
|
||||
Include.File( "Wrapper/Static" )
|
||||
Include.File( "Wrapper/Airbase" )
|
||||
Include.File( "Wrapper/Scenery" )
|
||||
|
||||
--- Functional Classes
|
||||
Include.File( "Functional/Scoring" )
|
||||
Include.File( "Functional/CleanUp" )
|
||||
Include.File( "Functional/Spawn" )
|
||||
Include.File( "Functional/Movement" )
|
||||
Include.File( "Functional/Sead" )
|
||||
Include.File( "Functional/Escort" )
|
||||
Include.File( "Functional/MissileTrainer" )
|
||||
Include.File( "Functional/AirbasePolice" )
|
||||
Include.File( "Functional/Detection" )
|
||||
|
||||
--- AI Classes
|
||||
Include.File( "AI/AI_Balancer" )
|
||||
Include.File( "AI/AI_Patrol" )
|
||||
Include.File( "AI/AI_Cap" )
|
||||
Include.File( "AI/AI_Cas" )
|
||||
Include.File( "AI/AI_Cargo" )
|
||||
|
||||
--- Actions
|
||||
Include.File( "Actions/Act_Assign" )
|
||||
Include.File( "Actions/Act_Route" )
|
||||
Include.File( "Actions/Act_Account" )
|
||||
Include.File( "Actions/Act_Assist" )
|
||||
|
||||
--- Task Handling Classes
|
||||
Include.File( "Tasking/CommandCenter" )
|
||||
Include.File( "Tasking/Mission" )
|
||||
Include.File( "Tasking/Task" )
|
||||
Include.File( "Tasking/DetectionManager" )
|
||||
Include.File( "Tasking/Task_A2G_Dispatcher")
|
||||
Include.File( "Tasking/Task_A2G" )
|
||||
Include.File( "Tasking/Task_CARGO" )
|
||||
|
||||
|
||||
-- The order of the declarations is important here. Don't touch it.
|
||||
|
||||
--- Declare the event dispatcher based on the EVENT class
|
||||
@@ -74,7 +7,7 @@ _EVENTDISPATCHER = EVENT:New() -- Core.Event#EVENT
|
||||
_SCHEDULEDISPATCHER = SCHEDULEDISPATCHER:New() -- Core.Timer#SCHEDULEDISPATCHER
|
||||
|
||||
--- Declare the main database object, which is used internally by the MOOSE classes.
|
||||
_DATABASE = DATABASE:New() -- Core.Database#DATABASE
|
||||
_DATABASE = DATABASE:New() -- Database#DATABASE
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ do -- TASK_CARGO
|
||||
|
||||
Task.SetCargo:ForEachCargo(
|
||||
|
||||
--- @param AI.AI_Cargo#AI_CARGO Cargo
|
||||
--- @param Core.Cargo#CARGO Cargo
|
||||
function( Cargo )
|
||||
if Cargo:IsUnLoaded() then
|
||||
if Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then
|
||||
|
||||
Reference in New Issue
Block a user