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 )
|
function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate, Speed, Height, PickupZone )
|
||||||
|
|
||||||
if Airplane and Airplane:IsAlive() then
|
if Airplane and Airplane:IsAlive() then
|
||||||
--env.info("FF onafterpick aircraft alive")
|
|
||||||
|
|
||||||
self.PickupZone = PickupZone
|
self.PickupZone = PickupZone
|
||||||
|
|
||||||
-- Get closest airbase of current position.
|
-- Get closest airbase of current position.
|
||||||
local ClosestAirbase, DistToAirbase=Airplane:GetCoordinate():GetClosestAirbase()
|
local ClosestAirbase, DistToAirbase=Airplane:GetCoordinate():GetClosestAirbase()
|
||||||
|
|
||||||
--env.info("FF onafterpickup closest airbase "..ClosestAirbase:GetName())
|
|
||||||
|
|
||||||
-- Two cases. Aircraft spawned in air or at an airbase.
|
-- Two cases. Aircraft spawned in air or at an airbase.
|
||||||
if Airplane:InAir() then
|
if Airplane:InAir() then
|
||||||
self.Airbase=nil --> route will start in air
|
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
|
if Airplane:InAir() or Dist>500 then
|
||||||
|
|
||||||
--env.info("FF onafterpickup routing to airbase "..ClosestAirbase:GetName())
|
|
||||||
|
|
||||||
-- Route aircraft to pickup airbase.
|
-- Route aircraft to pickup airbase.
|
||||||
self:Route( Airplane, Airbase, Speed, Height )
|
self:Route( Airplane, Airbase, Speed, Height )
|
||||||
|
|
||||||
@ -303,7 +298,6 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
|
|||||||
self.RoutePickup = true
|
self.RoutePickup = true
|
||||||
|
|
||||||
else
|
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.
|
-- We are already at the right airbase ==> Landed ==> triggers loading of troops. Is usually called at engine shutdown event.
|
||||||
self.RoutePickup=true
|
self.RoutePickup=true
|
||||||
@ -312,8 +306,7 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:GetParent( self, AI_CARGO_AIRPLANE ).onafterPickup( self, Airplane, From, Event, To, Coordinate, Speed, Height, PickupZone )
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -640,9 +640,9 @@ function AI_CARGO_DISPATCHER:New( CarrierSet, CargoSet, PickupZoneSet, DeployZon
|
|||||||
self.SetCarrier = CarrierSet -- Core.Set#SET_GROUP
|
self.SetCarrier = CarrierSet -- Core.Set#SET_GROUP
|
||||||
self.SetCargo = CargoSet -- Core.Set#SET_CARGO
|
self.SetCargo = CargoSet -- Core.Set#SET_CARGO
|
||||||
|
|
||||||
self.PickupZoneSet = PickupZoneSet
|
|
||||||
self.DeployZoneSet = DeployZoneSet
|
|
||||||
|
|
||||||
|
self.PickupZoneSet=PickupZoneSet
|
||||||
|
self.DeployZoneSet=DeployZoneSet
|
||||||
|
|
||||||
self:SetStartState( "Idle" )
|
self:SetStartState( "Idle" )
|
||||||
|
|
||||||
@ -1116,6 +1116,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
|||||||
local CargoCoordinate = Cargo:GetCoordinate()
|
local CargoCoordinate = Cargo:GetCoordinate()
|
||||||
local CoordinateFree = true
|
local CoordinateFree = true
|
||||||
--self.PickupZoneSet:Flush()
|
--self.PickupZoneSet:Flush()
|
||||||
|
--PickupZone = self.PickupZoneSet:GetRandomZone()
|
||||||
PickupZone = self.PickupZoneSet and self.PickupZoneSet:IsCoordinateInZone( CargoCoordinate )
|
PickupZone = self.PickupZoneSet and self.PickupZoneSet:IsCoordinateInZone( CargoCoordinate )
|
||||||
if not self.PickupZoneSet or PickupZone then
|
if not self.PickupZoneSet or PickupZone then
|
||||||
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
|
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
|
||||||
|
|||||||
@ -220,6 +220,8 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
|
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||||
|
-- @param #number NearRadius
|
||||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||||
|
|
||||||
@ -236,7 +238,7 @@ do -- CARGO_UNIT
|
|||||||
if not self.CargoInAir then
|
if not self.CargoInAir then
|
||||||
-- If NearRadius is given, then use the given NearRadius, otherwise calculate the NearRadius
|
-- 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.
|
-- 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
|
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||||
self:Load( CargoCarrier, NearRadius, ... )
|
self:Load( CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
|
|||||||
@ -938,6 +938,21 @@ do -- COORDINATE
|
|||||||
end
|
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.
|
--- Add a Distance in meters from the COORDINATE horizontal plane, with the given angle, and calculate the new COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
|
|||||||
@ -1899,7 +1899,7 @@ do -- DETECTION_UNITS
|
|||||||
|
|
||||||
--- Make text documenting the changes of the detected zone.
|
--- Make text documenting the changes of the detected zone.
|
||||||
-- @param #DETECTION_UNITS self
|
-- @param #DETECTION_UNITS self
|
||||||
-- @param #DETECTION_UNITS.DetectedItem DetectedItem
|
-- @param #DETECTION_BASE.DetectedItem DetectedItem
|
||||||
-- @return #string The Changes text
|
-- @return #string The Changes text
|
||||||
function DETECTION_UNITS:GetChangeText( DetectedItem )
|
function DETECTION_UNITS:GetChangeText( DetectedItem )
|
||||||
self:F( DetectedItem )
|
self:F( DetectedItem )
|
||||||
@ -1940,7 +1940,6 @@ do -- DETECTION_UNITS
|
|||||||
-- @param #DETECTION_UNITS self
|
-- @param #DETECTION_UNITS self
|
||||||
-- @return #DETECTION_UNITS self
|
-- @return #DETECTION_UNITS self
|
||||||
function DETECTION_UNITS:CreateDetectionItems()
|
function DETECTION_UNITS:CreateDetectionItems()
|
||||||
env.info("FF createdetectionitmes")
|
|
||||||
-- Loop the current detected items, and check if each object still exists and is detected.
|
-- Loop the current detected items, and check if each object still exists and is detected.
|
||||||
|
|
||||||
for DetectedItemKey, DetectedItem in pairs( self.DetectedItems ) do
|
for DetectedItemKey, DetectedItem in pairs( self.DetectedItems ) do
|
||||||
@ -2153,7 +2152,7 @@ do -- DETECTION_TYPES
|
|||||||
|
|
||||||
--- Make text documenting the changes of the detected zone.
|
--- Make text documenting the changes of the detected zone.
|
||||||
-- @param #DETECTION_TYPES self
|
-- @param #DETECTION_TYPES self
|
||||||
-- @param #DETECTION_TYPES.DetectedItem DetectedItem
|
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||||
-- @return #string The Changes text
|
-- @return #string The Changes text
|
||||||
function DETECTION_TYPES:GetChangeText( DetectedItem )
|
function DETECTION_TYPES:GetChangeText( DetectedItem )
|
||||||
self:F( DetectedItem )
|
self:F( DetectedItem )
|
||||||
|
|||||||
@ -104,7 +104,7 @@
|
|||||||
-- ## Strafe Pits
|
-- ## Strafe Pits
|
||||||
-- Each strafe pit can consist of multiple targets. Often one findes two or three strafe targets next to each other.
|
-- 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.
|
-- * 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
|
-- * 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.
|
--- Give an uncontrolled air controllable the start command.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number delay (Optional) Delay before start command in seconds.
|
||||||
-- @return #CONTROLLABLE self
|
-- @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={}})
|
self:SetCommand({id='Start', params={}})
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -318,20 +318,20 @@ end
|
|||||||
|
|
||||||
--- Get the bounding radius of the underlying POSITIONABLE DCS Object.
|
--- Get the bounding radius of the underlying POSITIONABLE DCS Object.
|
||||||
-- @param #POSITIONABLE self
|
-- @param #POSITIONABLE self
|
||||||
-- @return DCS#Distance The bounding radius of the POSITIONABLE.
|
-- @param #number mindist (Optional) If bounding box is smaller than this value, mindist is returned.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
-- @return DCS#Distance The bounding radius of the POSITIONABLE or #nil if the POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetBoundingRadius()
|
function POSITIONABLE:GetBoundingRadius(mindist)
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
local Box = self:GetBoundingBox()
|
local Box = self:GetBoundingBox()
|
||||||
|
|
||||||
|
local boxmin=mindist or 0
|
||||||
if Box then
|
if Box then
|
||||||
local X = Box.max.x - Box.min.x
|
local X = Box.max.x - Box.min.x
|
||||||
local Z = Box.max.z - Box.min.z
|
local Z = Box.max.z - Box.min.z
|
||||||
local CX = X / 2
|
local CX = X / 2
|
||||||
local CZ = Z / 2
|
local CZ = Z / 2
|
||||||
return math.max( CX, CZ )
|
return math.max( math.max( CX, CZ ), boxmin )
|
||||||
end
|
end
|
||||||
|
|
||||||
BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )
|
BASE:E( { "Cannot GetBoundingRadius", Positionable = self, Alive = self:IsAlive() } )
|
||||||
@ -1025,7 +1025,9 @@ do -- Cargo
|
|||||||
function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit )
|
function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit )
|
||||||
|
|
||||||
if WeightLimit then
|
if WeightLimit then
|
||||||
self.__.CargoBayWeightLimit = self.__.CargoBayWeightLimit or WeightLimit
|
self.__.CargoBayWeightLimit = WeightLimit
|
||||||
|
elseif self.__.CargoBayWeightLimit~=nil then
|
||||||
|
-- Value already set ==> Do nothing!
|
||||||
else
|
else
|
||||||
-- If weightlimit is not provided, we will calculate it depending on the type of unit.
|
-- If weightlimit is not provided, we will calculate it depending on the type of unit.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user