mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Warehouse 0.1.9
Many bugs spotted
This commit is contained in:
parent
22da329fca
commit
5a2e1f01b4
@ -2116,7 +2116,7 @@ function RAT:_SpawnWithRoute(_departure, _destination, _takeoff, _landing, _live
|
||||
end
|
||||
|
||||
-- Modify the spawn template to follow the flight plan.
|
||||
local successful=self:_ModifySpawnTemplate(waypoints, livery, _lastpos, departure, takeoff)
|
||||
local successful=self:_ModifySpawnTemplate(waypoints, livery, _lastpos, departure, takeoff, parkingdata)
|
||||
if not successful then
|
||||
return nil
|
||||
end
|
||||
|
||||
@ -191,7 +191,7 @@ WAREHOUSE.TransportType = {
|
||||
|
||||
--- Warehouse class version.
|
||||
-- @field #string version
|
||||
WAREHOUSE.version="0.1.8w"
|
||||
WAREHOUSE.version="0.1.9"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO: Warehouse todo list.
|
||||
@ -1118,7 +1118,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
|
||||
CargoTransport = AI_CARGO_DISPATCHER_HELICOPTER:New(TransportSet, CargoGroups, DeployZoneSet)
|
||||
|
||||
-- Home zone.
|
||||
CargoTransport:Setairbase(self.airbase)
|
||||
--CargoTransport:Setairbase(self.airbase)
|
||||
--CargoTransport:SetHomeZone(self.spawnzone)
|
||||
|
||||
elseif Request.transporttype==WAREHOUSE.TransportType.APC then
|
||||
@ -1563,17 +1563,21 @@ end
|
||||
function WAREHOUSE:_RouteAirRat(Aircraft, ToAirbase, Speed)
|
||||
|
||||
if Aircraft and Aircraft:IsAlive()~=nil then
|
||||
|
||||
-- Get parking data of all units.
|
||||
local parkingdata={}
|
||||
|
||||
local units=Aircraft:GetUnits()
|
||||
for _,_unit in pairs(units) do
|
||||
local unit=_unit --Wrapper.Unit#UNIT
|
||||
local _spot,_terminal,_distance=unit:GetCoordinate():GetClosestOccupiedParkingSpot(self.airbase)
|
||||
table.insert(parkingdata, {spot=_spot, TerminalID=_terminal})
|
||||
table.insert(parkingdata, {Coordinate=_spot, TerminalID=_terminal})
|
||||
end
|
||||
env.info("FF parking data")
|
||||
self:E(parkingdata)
|
||||
|
||||
-- Create a RAT object to use its flight plan.
|
||||
local rat=RAT:New(Aircraft)
|
||||
local rat=RAT:New(Aircraft:GetName())
|
||||
|
||||
-- Init some parameters.
|
||||
rat:SetDeparture(self.airbase:GetName())
|
||||
@ -1590,12 +1594,16 @@ function WAREHOUSE:_RouteAirRat(Aircraft, ToAirbase, Speed)
|
||||
Aircraft:Destroy()
|
||||
|
||||
-- Spawn RAT aircraft at specific parking sports.
|
||||
local spawnindex=rat:_SpawnWithRoute(self.airbase:GetName(), ToAirbase:GetName(), RAT.wp.cold, nil, nil, nil, nil, nil, parkingdata)
|
||||
local spawnindex=rat:_SpawnWithRoute(self.airbase:GetName(), ToAirbase:GetName(), RAT.wp.hot, nil, nil, nil, nil, nil, parkingdata)
|
||||
|
||||
-- Get the group and check it's name.
|
||||
local group=rat.ratcraft[spawnindex].group --Wrapper.Group#GROUP
|
||||
self:E(self.wid..string.format("Spawned new RAT aircraft as group %s", group:GetName()))
|
||||
|
||||
group:SmokeBlue()
|
||||
-- Activate group.
|
||||
local bla=group:SetCommand({id='Start', params={}})
|
||||
self:E({bla=bla})
|
||||
return group
|
||||
end
|
||||
|
||||
|
||||
@ -680,6 +680,8 @@ function AIRBASE:FindFreeParkingSpotForAircraft(group, terminaltype, scanradius,
|
||||
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
|
||||
local _termid=parkingspot.TerminalID
|
||||
|
||||
if AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype) then
|
||||
|
||||
-- Very safe uses the DCS getParking() info to check if a spot is free. Unfortunately, the function returns free=false until the aircraft has actually taken-off.
|
||||
if verysafe and (parkingspot.Free==false or parkingspot.TOAC==true) then
|
||||
|
||||
@ -772,7 +774,7 @@ function AIRBASE:FindFreeParkingSpotForAircraft(group, terminaltype, scanradius,
|
||||
if nvalid>=_nspots then
|
||||
return validspots
|
||||
end
|
||||
|
||||
end -- check terminal type
|
||||
end
|
||||
|
||||
-- Retrun spots we found, even if there were not enough.
|
||||
|
||||
@ -119,11 +119,13 @@ end
|
||||
-- @param DCS#Unit DCSUnit An existing DCS Unit object reference.
|
||||
-- @return #UNIT self
|
||||
function UNIT:Find( DCSUnit )
|
||||
|
||||
if DCSUnit then
|
||||
local UnitName = DCSUnit:getName()
|
||||
local UnitFound = _DATABASE:FindUnit( UnitName )
|
||||
return UnitFound
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Find a UNIT in the _DATABASE using the name of an existing DCS Unit.
|
||||
-- @param #UNIT self
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user