From 5becf001baee9b67117cfad397c13e73086d2006 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Thu, 27 Sep 2018 22:08:08 +0200 Subject: [PATCH] -- Fixed NearRadius. -- Some documentation errors. --- Moose Development/Moose/Cargo/Cargo.lua | 2 +- Moose Development/Moose/Cargo/CargoCrate.lua | 2 ++ Moose Development/Moose/Cargo/CargoGroup.lua | 8 ++++---- .../Moose/Cargo/CargoSlingload.lua | 2 ++ Moose Development/Moose/Cargo/CargoUnit.lua | 20 +++++++------------ Moose Development/Moose/Core/Fsm.lua | 3 +-- .../Moose/Tasking/Task_CARGO.lua | 2 +- .../Moose/Wrapper/Controllable.lua | 2 +- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Moose Development/Moose/Cargo/Cargo.lua b/Moose Development/Moose/Cargo/Cargo.lua index 27a40b200..e393b9e9d 100644 --- a/Moose Development/Moose/Cargo/Cargo.lua +++ b/Moose Development/Moose/Cargo/Cargo.lua @@ -471,7 +471,7 @@ do -- CARGO self.CargoLimit = 0 self.LoadRadius = LoadRadius or 500 - self.NearRadius = NearRadius or 25 + --self.NearRadius = NearRadius or 25 self:SetDeployed( false ) diff --git a/Moose Development/Moose/Cargo/CargoCrate.lua b/Moose Development/Moose/Cargo/CargoCrate.lua index 92fccec02..50cef9a97 100644 --- a/Moose Development/Moose/Cargo/CargoCrate.lua +++ b/Moose Development/Moose/Cargo/CargoCrate.lua @@ -67,6 +67,8 @@ do -- CARGO_CRATE self:HandleEvent( EVENTS.PlayerLeaveUnit, self.OnEventCargoDead ) self:SetEventPriority( 4 ) + + self.NearRadius = NearRadius or 25 return self end diff --git a/Moose Development/Moose/Cargo/CargoGroup.lua b/Moose Development/Moose/Cargo/CargoGroup.lua index 218cb7c93..0203bd6ec 100644 --- a/Moose Development/Moose/Cargo/CargoGroup.lua +++ b/Moose Development/Moose/Cargo/CargoGroup.lua @@ -64,6 +64,8 @@ do -- CARGO_GROUP self.Grouped = true self.CargoUnitTemplate = {} + self.NearRadius = NearRadius + self:SetDeployed( false ) local WeightGroup = 0 @@ -297,9 +299,9 @@ do -- CARGO_GROUP -- @param Wrapper.Unit#UNIT CargoCarrier -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) - --self:F( { CargoCarrier.UnitName, From, Event, To } ) + self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } ) - local NearRadius = NearRadius or 25 + NearRadius = NearRadius or self.NearRadius if From == "UnLoaded" then @@ -347,8 +349,6 @@ do -- CARGO_GROUP function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) --self:F( { CargoCarrier.UnitName, From, Event, To } ) - local NearRadius = NearRadius or 100 - local Boarded = true local Cancelled = false local Dead = true diff --git a/Moose Development/Moose/Cargo/CargoSlingload.lua b/Moose Development/Moose/Cargo/CargoSlingload.lua index a3831dcf6..8af9d5304 100644 --- a/Moose Development/Moose/Cargo/CargoSlingload.lua +++ b/Moose Development/Moose/Cargo/CargoSlingload.lua @@ -60,6 +60,8 @@ do -- CARGO_SLINGLOAD self:HandleEvent( EVENTS.PlayerLeaveUnit, self.OnEventCargoDead ) self:SetEventPriority( 4 ) + + self.NearRadius = NearRadius or 25 return self end diff --git a/Moose Development/Moose/Cargo/CargoUnit.lua b/Moose Development/Moose/Cargo/CargoUnit.lua index bb3df8657..c0a6a3147 100644 --- a/Moose Development/Moose/Cargo/CargoUnit.lua +++ b/Moose Development/Moose/Cargo/CargoUnit.lua @@ -69,8 +69,6 @@ do -- CARGO_UNIT function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius ) self:F( { From, Event, To, ToPointVec2, NearRadius } ) - NearRadius = NearRadius or 25 - local Angle = 180 local Speed = 60 local DeployDistance = 9 @@ -139,8 +137,6 @@ do -- CARGO_UNIT function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius ) self:F( { From, Event, To, ToPointVec2, NearRadius } ) - NearRadius = NearRadius or 100 - local Angle = 180 local Speed = 10 local Distance = 5 @@ -167,8 +163,6 @@ do -- CARGO_UNIT function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius ) self:F( { From, Event, To, ToPointVec2, NearRadius } ) - NearRadius = NearRadius or 100 - self.CargoInAir = self.CargoObject:InAir() self:T( self.CargoInAir ) @@ -227,7 +221,7 @@ do -- CARGO_UNIT -- @param #string From -- @param #string To function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... ) - self:F( { From, Event, To, CargoCarrier, NearRadius } ) + self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } ) self.CargoInAir = self.CargoObject:InAir() @@ -271,7 +265,7 @@ do -- CARGO_UNIT local TaskRoute = self.CargoObject:TaskRoute( Points ) self.CargoObject:SetTask( TaskRoute, 2 ) - self:__Boarding( -5, CargoCarrier, NearRadius ) + self:__Boarding( -5, CargoCarrier, NearRadius, ... ) self.RunCount = 0 end end @@ -288,7 +282,7 @@ do -- CARGO_UNIT -- @param Wrapper.Client#CLIENT CargoCarrier -- @param #number NearRadius Default 25 m. function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) - self:F( { From, Event, To, CargoCarrier:GetName() } ) + self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } ) if CargoCarrier and CargoCarrier:IsAlive() and self.CargoObject and self.CargoObject:IsAlive() then @@ -298,11 +292,11 @@ do -- CARGO_UNIT self:__Load( 1, CargoCarrier, ... ) else if self:IsNear( CargoCarrier:GetPointVec2(), 20 ) then - self:__Boarding( -2, CargoCarrier, NearRadius, ... ) - self.RunCount = self.RunCount + 2 + self:__Boarding( -1, CargoCarrier, NearRadius, ... ) + self.RunCount = self.RunCount + 1 else - self:__Boarding( -10, CargoCarrier, NearRadius, ... ) - self.RunCount = self.RunCount + 10 + self:__Boarding( -5, CargoCarrier, NearRadius, ... ) + self.RunCount = self.RunCount + 5 end if self.RunCount >= 40 then self.RunCount = 0 diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua index 9ff0b5d16..65b0d3ea5 100644 --- a/Moose Development/Moose/Core/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -805,8 +805,7 @@ do -- FSM_CONTROLLABLE -- -- === -- - -- @field #FSM_CONTROLLABLE FSM_CONTROLLABLE - -- + -- @field #FSM_CONTROLLABLE FSM_CONTROLLABLE = { ClassName = "FSM_CONTROLLABLE", } diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index 235f69fe2..00de26c1b 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -1017,7 +1017,7 @@ do -- TASK_CARGO else Cargo:MessageToGroup( "Boarding ...", TaskUnit:GetGroup() ) if not Cargo:IsBoarding() then - Cargo:Board( TaskUnit, 20, self ) + Cargo:Board( TaskUnit, nil, self ) end end else diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 4c725c4cb..ad789a5a6 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -13,9 +13,9 @@ --- @type CONTROLLABLE --- @extends Wrapper.Positionable#POSITIONABLE -- @field DCS#Controllable DCSControllable The DCS controllable class. -- @field #string ControllableName The name of the controllable. +-- @extends Wrapper.Positionable#POSITIONABLE