From edb53013b259d6e817a1ab7d0210a3b85c219e41 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Thu, 6 Jul 2017 21:47:02 +0200 Subject: [PATCH] Progress --- Moose Development/Moose/Core/Cargo.lua | 3 +- Moose Development/Moose/Tasking/Task.lua | 4 +-- .../Moose/Tasking/Task_CARGO.lua | 35 +++++++------------ .../Moose/Wrapper/Positionable.lua | 6 ++++ 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua index d16e55f3c..4da31341a 100644 --- a/Moose Development/Moose/Core/Cargo.lua +++ b/Moose Development/Moose/Core/Cargo.lua @@ -164,7 +164,7 @@ do -- CARGO -- @field #number Weight A number defining the weight of the cargo. The weight is expressed in kg. -- @field #number NearRadius (optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded. -- @field Wrapper.Controllable#CONTROLLABLE CargoObject The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere... - -- @field Wrapper.Controllable#CONTROLLABLE CargoCarrier The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere... + -- @field Wrapper.Client#CLIENT CargoCarrier The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere... -- @field #boolean Slingloadable This flag defines if the cargo can be slingloaded. -- @field #boolean Moveable This flag defines if the cargo is moveable. -- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit. @@ -1032,6 +1032,7 @@ function CARGO_GROUP:OnEventCargoDead( EventData ) else if self.CargoCarrier:GetName() == EventData.IniUnitName then Destroyed = true + self.CargoCarrier:ClearCargo() end end diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 244f8200a..93522f3f0 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -309,7 +309,7 @@ function TASK:AbortGroup( PlayerGroup ) self:E( { IsGroupAssigned = IsGroupAssigned } ) if IsGroupAssigned then local PlayerName = PlayerGroup:GetUnit(1):GetPlayerName() - self:MessageToGroups( PlayerName .. " aborted Task " .. self:GetName() ) + --self:MessageToGroups( PlayerName .. " aborted Task " .. self:GetName() ) self:UnAssignFromGroup( PlayerGroup ) --self:Abort() @@ -469,7 +469,7 @@ do -- Group Assignment local TaskGroupName = TaskGroup:GetName() self.AssignedGroups[TaskGroupName] = nil - self:E( string.format( "Task %s is unassigned to %s", TaskName, TaskGroupName ) ) + --self:E( string.format( "Task %s is unassigned to %s", TaskName, TaskGroupName ) ) -- Set the group to be assigned at mission level. This allows to decide the menu options on mission level for this group. self:GetMission():ClearGroupAssignment( TaskGroup ) diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index 74eacb8f5..77b17c4bc 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -316,8 +316,7 @@ do -- TASK_CARGO --#Wrapper.Unit#UNIT - --- Route to Cargo - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task -- @param From @@ -337,8 +336,7 @@ do -- TASK_CARGO - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterArriveAtPickup( TaskUnit, Task ) @@ -346,6 +344,7 @@ do -- TASK_CARGO if self.Cargo:IsAlive() then TaskUnit:Smoke( Task:GetSmokeColor(), 15 ) if TaskUnit:IsAir() then + Task:GetMission():GetCommandCenter():MessageToGroup( "Land", TaskUnit:GetGroup() ) self:__Land( -0.1, "Pickup" ) else self:__SelectAction( -0.1 ) @@ -354,8 +353,7 @@ do -- TASK_CARGO end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterCancelRouteToPickup( TaskUnit, Task ) @@ -365,8 +363,7 @@ do -- TASK_CARGO end - --- Route to DeployZone - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit function Fsm:onafterRouteToDeploy( TaskUnit, Task, From, Event, To, DeployZone ) self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) @@ -378,14 +375,14 @@ do -- TASK_CARGO end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterArriveAtDeploy( TaskUnit, Task ) self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if TaskUnit:IsAir() then + Task:GetMission():GetCommandCenter():MessageToGroup( "Land", TaskUnit:GetGroup() ) self:__Land( -0.1, "Deploy" ) else self:__SelectAction( -0.1 ) @@ -393,8 +390,7 @@ do -- TASK_CARGO end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterCancelRouteToDeploy( TaskUnit, Task ) @@ -405,7 +401,7 @@ do -- TASK_CARGO - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterLand( TaskUnit, Task, From, Event, To, Action ) @@ -414,7 +410,6 @@ do -- TASK_CARGO if self.Cargo:IsAlive() then if self.Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then if TaskUnit:InAir() then - Task:GetMission():GetCommandCenter():MessageToGroup( "Land", TaskUnit:GetGroup() ) self:__Land( -10, Action ) else Task:GetMission():GetCommandCenter():MessageToGroup( "Landed ...", TaskUnit:GetGroup() ) @@ -430,8 +425,7 @@ do -- TASK_CARGO end end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterLanded( TaskUnit, Task, From, Event, To, Action ) @@ -454,8 +448,7 @@ do -- TASK_CARGO end end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterPrepareBoarding( TaskUnit, Task, From, Event, To, Cargo ) @@ -467,8 +460,7 @@ do -- TASK_CARGO end end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterBoard( TaskUnit, Task ) @@ -494,8 +486,7 @@ do -- TASK_CARGO end - --- - -- @param #FSM_PROCESS self + --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterBoarded( TaskUnit, Task ) diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index c258ae2de..bca3967cf 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -708,6 +708,12 @@ function POSITIONABLE:HasCargo( Cargo ) return self.__.Cargo[Cargo] end +--- Clear all cargo. +-- @param #POSITIONABLE self +function POSITIONABLE:ClearCargo() + self.__.Cargo = {} +end + --- Get cargo item count. -- @param #POSITIONABLE self -- @return Core.Cargo#CARGO Cargo