mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1015 from FlightControl-Master/FF/Develop
Warehouse v0.5.8
This commit is contained in:
commit
7340b0aad3
@ -5,7 +5,8 @@
|
|||||||
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
|
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
|
||||||
--
|
--
|
||||||
-- * Spot for a defined duration.
|
-- * Spot for a defined duration.
|
||||||
-- * wiggle the spot at the target.
|
-- * Updates of laer spot position every 0.2 seconds for moving targets.
|
||||||
|
-- * Wiggle the spot at the target.
|
||||||
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
||||||
-- * Implement a status machine, LaseOn, LaseOff.
|
-- * Implement a status machine, LaseOn, LaseOff.
|
||||||
--
|
--
|
||||||
@ -49,7 +50,8 @@ do
|
|||||||
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
|
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
|
||||||
--
|
--
|
||||||
-- * Mark targets for a defined duration.
|
-- * Mark targets for a defined duration.
|
||||||
-- * wiggle the spot at the target.
|
-- * Updates of laer spot position every 0.2 seconds for moving targets.
|
||||||
|
-- * Wiggle the spot at the target.
|
||||||
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
||||||
-- * Implement a status machine, LaseOn, LaseOff.
|
-- * Implement a status machine, LaseOn, LaseOff.
|
||||||
--
|
--
|
||||||
@ -85,9 +87,7 @@ do
|
|||||||
|
|
||||||
--- SPOT Constructor.
|
--- SPOT Constructor.
|
||||||
-- @param #SPOT self
|
-- @param #SPOT self
|
||||||
-- @param Wrapper.Unit#UNIT Recce
|
-- @param Wrapper.Unit#UNIT Recce Unit that is lasing
|
||||||
-- @param #number LaserCode
|
|
||||||
-- @param #number Duration
|
|
||||||
-- @return #SPOT
|
-- @return #SPOT
|
||||||
function SPOT:New( Recce )
|
function SPOT:New( Recce )
|
||||||
|
|
||||||
@ -115,12 +115,17 @@ do
|
|||||||
--- LaseOn Trigger for SPOT
|
--- LaseOn Trigger for SPOT
|
||||||
-- @function [parent=#SPOT] LaseOn
|
-- @function [parent=#SPOT] LaseOn
|
||||||
-- @param #SPOT self
|
-- @param #SPOT self
|
||||||
|
-- @param Wrapper.Positionable#POSITIONABLE Target
|
||||||
|
-- @param #number LaserCode Laser code.
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
|
||||||
--- LaseOn Asynchronous Trigger for SPOT
|
--- LaseOn Asynchronous Trigger for SPOT
|
||||||
-- @function [parent=#SPOT] __LaseOn
|
-- @function [parent=#SPOT] __LaseOn
|
||||||
-- @param #SPOT self
|
-- @param #SPOT self
|
||||||
-- @param #number Delay
|
-- @param #number Delay
|
||||||
|
-- @param Wrapper.Positionable#POSITIONABLE Target
|
||||||
|
-- @param #number LaserCode Laser code.
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
|
||||||
|
|
||||||
self:AddTransition( "On", "Lasing", "On" )
|
self:AddTransition( "On", "Lasing", "On" )
|
||||||
@ -193,9 +198,9 @@ do
|
|||||||
-- @param From
|
-- @param From
|
||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Wrapper.Positionable#POSITIONABLE Target
|
-- @param Wrapper.Positionable#POSITIONABLE Target Unit that is being lased.
|
||||||
-- @param #number LaserCode
|
-- @param #number LaserCode Laser code.
|
||||||
-- @param #number Duration
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
|
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
|
||||||
self:F( { "LaseOn", Target, LaserCode, Duration } )
|
self:F( { "LaseOn", Target, LaserCode, Duration } )
|
||||||
|
|
||||||
|
|||||||
@ -1536,7 +1536,7 @@ WAREHOUSE.db = {
|
|||||||
|
|
||||||
--- Warehouse class version.
|
--- Warehouse class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
WAREHOUSE.version="0.5.7"
|
WAREHOUSE.version="0.5.8"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO: Warehouse todo list.
|
-- TODO: Warehouse todo list.
|
||||||
@ -5795,7 +5795,6 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
-- Check if number of requested assets is in stock.
|
-- Check if number of requested assets is in stock.
|
||||||
local _assets,_nassets,_enough=self:_FilterStock(self.stock, request.assetdesc, request.assetdescval, request.nasset, onlymobile)
|
local _assets,_nassets,_enough=self:_FilterStock(self.stock, request.assetdesc, request.assetdescval, request.nasset, onlymobile)
|
||||||
|
|
||||||
local _transports
|
|
||||||
|
|
||||||
-- Check if enough assets are in stock.
|
-- Check if enough assets are in stock.
|
||||||
if not _enough then
|
if not _enough then
|
||||||
@ -5805,13 +5804,17 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
self:T(self.wid..text)
|
self:T(self.wid..text)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local _transports
|
||||||
|
local _assetattribute
|
||||||
|
local _assetcategory
|
||||||
|
|
||||||
-- Check if at least one (cargo) asset is available.
|
-- Check if at least one (cargo) asset is available.
|
||||||
if _nassets>0 then
|
if _nassets>0 then
|
||||||
|
|
||||||
-- Get the attibute of the requested asset.
|
-- Get the attibute of the requested asset.
|
||||||
local _assetattribute=_assets[1].attribute
|
_assetattribute=_assets[1].attribute
|
||||||
local _assetcategory=_assets[1].category
|
_assetcategory=_assets[1].category
|
||||||
|
|
||||||
-- Check available parking for air asset units.
|
-- Check available parking for air asset units.
|
||||||
if self.airbase and (_assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER) then
|
if self.airbase and (_assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER) then
|
||||||
@ -5870,16 +5873,22 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
|
|
||||||
-- Self propelled case. Nothing to do for now.
|
-- Self propelled case. Nothing to do for now.
|
||||||
|
|
||||||
--local dist=self.spawnzone:GetCoordinate():Get2DDistance(self:GetCoordinate())
|
-- Ground asset checks.
|
||||||
local dist=self.warehouse:GetCoordinate():Get2DDistance(request.warehouse.spawnzone:GetCoordinate())
|
if _assetcategory==Group.Category.GROUND then
|
||||||
|
|
||||||
if dist>5000 then
|
-- Distance between warehouse and spawn zone.
|
||||||
-- Not enough or the right transport carriers.
|
local dist=self.warehouse:GetCoordinate():Get2DDistance(request.warehouse.spawnzone:GetCoordinate())
|
||||||
local text=string.format("Warehouse %s: Request denied! Not close enough to spawn zone. Distance = %d m", self.alias, dist)
|
|
||||||
self:_InfoMessage(text, 5)
|
-- Check min dist to spawn zone.
|
||||||
return false
|
if dist>5000 then
|
||||||
|
-- Not close enough to spawn zone.
|
||||||
|
local text=string.format("Warehouse %s: Request denied! Not close enough to spawn zone. Distance = %d m. We need to be at least within 5000 m range to spawn.", self.alias, dist)
|
||||||
|
self:_InfoMessage(text, 5)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user