mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1009 from FlightControl-Master/FF/Develop
Warehouse v0.5.5
This commit is contained in:
commit
86fab3985b
@ -266,15 +266,12 @@ end
|
||||
function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate, Speed, Height, PickupZone )
|
||||
|
||||
if Airplane and Airplane:IsAlive() then
|
||||
--env.info("FF onafterpick aircraft alive")
|
||||
|
||||
self.PickupZone = PickupZone
|
||||
|
||||
-- Get closest airbase of current position.
|
||||
local ClosestAirbase, DistToAirbase=Airplane:GetCoordinate():GetClosestAirbase()
|
||||
|
||||
--env.info("FF onafterpickup closest airbase "..ClosestAirbase:GetName())
|
||||
|
||||
-- Two cases. Aircraft spawned in air or at an airbase.
|
||||
if Airplane:InAir() then
|
||||
self.Airbase=nil --> route will start in air
|
||||
@ -291,8 +288,6 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
|
||||
|
||||
if Airplane:InAir() or Dist>500 then
|
||||
|
||||
--env.info("FF onafterpickup routing to airbase "..ClosestAirbase:GetName())
|
||||
|
||||
-- Route aircraft to pickup airbase.
|
||||
self:Route( Airplane, Airbase, Speed, Height )
|
||||
|
||||
@ -303,7 +298,6 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
|
||||
self.RoutePickup = true
|
||||
|
||||
else
|
||||
--env.info("FF onafterpick calling landed")
|
||||
|
||||
-- We are already at the right airbase ==> Landed ==> triggers loading of troops. Is usually called at engine shutdown event.
|
||||
self.RoutePickup=true
|
||||
@ -312,8 +306,7 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
|
||||
end
|
||||
|
||||
self:GetParent( self, AI_CARGO_AIRPLANE ).onafterPickup( self, Airplane, From, Event, To, Coordinate, Speed, Height, PickupZone )
|
||||
else
|
||||
--env.info("FF onafterpick aircraft not alive")
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -640,10 +640,10 @@ function AI_CARGO_DISPATCHER:New( CarrierSet, CargoSet, PickupZoneSet, DeployZon
|
||||
self.SetCarrier = CarrierSet -- Core.Set#SET_GROUP
|
||||
self.SetCargo = CargoSet -- Core.Set#SET_CARGO
|
||||
|
||||
|
||||
self.PickupZoneSet=PickupZoneSet
|
||||
self.DeployZoneSet=DeployZoneSet
|
||||
|
||||
|
||||
self:SetStartState( "Idle" )
|
||||
|
||||
self:AddTransition( "Monitoring", "Monitor", "Monitoring" )
|
||||
@ -1116,6 +1116,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
||||
local CargoCoordinate = Cargo:GetCoordinate()
|
||||
local CoordinateFree = true
|
||||
--self.PickupZoneSet:Flush()
|
||||
--PickupZone = self.PickupZoneSet:GetRandomZone()
|
||||
PickupZone = self.PickupZoneSet and self.PickupZoneSet:IsCoordinateInZone( CargoCoordinate )
|
||||
if not self.PickupZoneSet or PickupZone then
|
||||
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
|
||||
|
||||
@ -220,6 +220,8 @@ do -- CARGO_UNIT
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||
-- @param #number NearRadius
|
||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||
|
||||
@ -236,7 +238,7 @@ do -- CARGO_UNIT
|
||||
if not self.CargoInAir then
|
||||
-- If NearRadius is given, then use the given NearRadius, otherwise calculate the NearRadius
|
||||
-- based upon the Carrier bounding radius, which is calculated from the bounding rectangle on the Y axis.
|
||||
local NearRadius = NearRadius or CargoCarrier:GetBoundingRadius( NearRadius ) + 5
|
||||
local NearRadius = NearRadius or CargoCarrier:GetBoundingRadius() + 5
|
||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||
self:Load( CargoCarrier, NearRadius, ... )
|
||||
else
|
||||
|
||||
@ -938,6 +938,21 @@ do -- COORDINATE
|
||||
end
|
||||
|
||||
|
||||
--- Set altitude.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #number altitude New altitude in meters.
|
||||
-- @param #boolean asl Altitude above sea level. Default is above ground level.
|
||||
-- @return #COORDINATE The COORDINATE with adjusted altitude.
|
||||
function COORDINATE:SetAltitude(altitude, asl)
|
||||
local alt=altitude
|
||||
if asl then
|
||||
alt=altitude
|
||||
else
|
||||
alt=self:GetLandHeight()+altitude
|
||||
end
|
||||
self.y=alt
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a Distance in meters from the COORDINATE horizontal plane, with the given angle, and calculate the new COORDINATE.
|
||||
-- @param #COORDINATE self
|
||||
|
||||
@ -1899,7 +1899,7 @@ do -- DETECTION_UNITS
|
||||
|
||||
--- Make text documenting the changes of the detected zone.
|
||||
-- @param #DETECTION_UNITS self
|
||||
-- @param #DETECTION_UNITS.DetectedItem DetectedItem
|
||||
-- @param #DETECTION_BASE.DetectedItem DetectedItem
|
||||
-- @return #string The Changes text
|
||||
function DETECTION_UNITS:GetChangeText( DetectedItem )
|
||||
self:F( DetectedItem )
|
||||
@ -1940,7 +1940,6 @@ do -- DETECTION_UNITS
|
||||
-- @param #DETECTION_UNITS self
|
||||
-- @return #DETECTION_UNITS self
|
||||
function DETECTION_UNITS:CreateDetectionItems()
|
||||
env.info("FF createdetectionitmes")
|
||||
-- Loop the current detected items, and check if each object still exists and is detected.
|
||||
|
||||
for DetectedItemKey, DetectedItem in pairs( self.DetectedItems ) do
|
||||
@ -2153,7 +2152,7 @@ do -- DETECTION_TYPES
|
||||
|
||||
--- Make text documenting the changes of the detected zone.
|
||||
-- @param #DETECTION_TYPES self
|
||||
-- @param #DETECTION_TYPES.DetectedItem DetectedItem
|
||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||
-- @return #string The Changes text
|
||||
function DETECTION_TYPES:GetChangeText( DetectedItem )
|
||||
self:F( DetectedItem )
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
-- ## Strafe Pits
|
||||
-- Each strafe pit can consist of multiple targets. Often one findes two or three strafe targets next to each other.
|
||||
--
|
||||
-- A strafe pit can be added to the range by the @{#RANGE.AddStrafepit}(*targetnames, boxlength, boxwidth, heading, inverseheading, goodpass, foulline*) function.
|
||||
-- A strafe pit can be added to the range by the @{#RANGE.AddStrafePit}(*targetnames, boxlength, boxwidth, heading, inverseheading, goodpass, foulline*) function.
|
||||
--
|
||||
-- * The first parameter *targetnames* defines the target or targets. This has to be given as a lua table which contains the names of @{Wrapper.Unit} or @{Static} objects defined in the mission editor.
|
||||
-- * In order to perform a valid pass on the strafe pit, the pilot has to begin his run from the correct direction. Therefore, an "approach box" is defined in front
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -619,9 +619,16 @@ end
|
||||
|
||||
--- Give an uncontrolled air controllable the start command.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number delay (Optional) Delay before start command in seconds.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:StartUncontrolled()
|
||||
function CONTROLLABLE:StartUncontrolled(delay)
|
||||
if delay and delay>0 then
|
||||
env.info(string.format("FF %s delayed start after %d seconds", self:GetName(), delay))
|
||||
SCHEDULER:New(nil, CONTROLLABLE.StartUncontrolled, {self}, delay)
|
||||
else
|
||||
env.info(string.format("FF %s instant start", self:GetName()))
|
||||
self:SetCommand({id='Start', params={}})
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@ -318,20 +318,20 @@ end
|
||||
|
||||
--- Get the bounding radius of the underlying POSITIONABLE DCS Object.
|
||||
-- @param #POSITIONABLE self
|
||||
-- @return DCS#Distance The bounding radius of the POSITIONABLE.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetBoundingRadius()
|
||||
-- @param #number mindist (Optional) If bounding box is smaller than this value, mindist is returned.
|
||||
-- @return DCS#Distance The bounding radius of the POSITIONABLE or #nil if the POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetBoundingRadius(mindist)
|
||||
self:F2()
|
||||
|
||||
local Box = self:GetBoundingBox()
|
||||
|
||||
|
||||
local boxmin=mindist or 0
|
||||
if Box then
|
||||
local X = Box.max.x - Box.min.x
|
||||
local Z = Box.max.z - Box.min.z
|
||||
local CX = X / 2
|
||||
local CZ = Z / 2
|
||||
return math.max( CX, CZ )
|
||||
return math.max( math.max( CX, CZ ), boxmin )
|
||||
end
|
||||
|
||||
BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )
|
||||
@ -1025,7 +1025,9 @@ do -- Cargo
|
||||
function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit )
|
||||
|
||||
if WeightLimit then
|
||||
self.__.CargoBayWeightLimit = self.__.CargoBayWeightLimit or WeightLimit
|
||||
self.__.CargoBayWeightLimit = WeightLimit
|
||||
elseif self.__.CargoBayWeightLimit~=nil then
|
||||
-- Value already set ==> Do nothing!
|
||||
else
|
||||
-- If weightlimit is not provided, we will calculate it depending on the type of unit.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user