mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
141d00e160
@ -270,7 +270,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
|
|||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.11"
|
CSAR.version="1.0.13"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@ -613,6 +613,19 @@ function CSAR:_DoubleEjection(_unitname)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (User) Add a PLAYERTASK - FSM events will check success
|
||||||
|
-- @param #CSAR self
|
||||||
|
-- @param Ops.PlayerTask#PLAYERTASK PlayerTask
|
||||||
|
-- @return #CSAR self
|
||||||
|
function CSAR:AddPlayerTask(PlayerTask)
|
||||||
|
self:T(self.lid .. " AddPlayerTask")
|
||||||
|
if not self.PlayerTaskQueue then
|
||||||
|
self.PlayerTaskQueue = FIFO:New()
|
||||||
|
end
|
||||||
|
self.PlayerTaskQueue:Push(PlayerTask,PlayerTask.PlayerTaskNr)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Spawn a downed pilot
|
--- (Internal) Spawn a downed pilot
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param #number country Country for template.
|
-- @param #number country Country for template.
|
||||||
@ -1447,7 +1460,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
|||||||
end
|
end
|
||||||
|
|
||||||
if _heliUnit:InAir() and _unitsInHelicopter + 1 <= _maxUnits then
|
if _heliUnit:InAir() and _unitsInHelicopter + 1 <= _maxUnits then
|
||||||
-- TODO - make variable
|
-- DONE - make variable
|
||||||
if _distance < self.rescuehoverdistance then
|
if _distance < self.rescuehoverdistance then
|
||||||
|
|
||||||
--check height!
|
--check height!
|
||||||
@ -1455,7 +1468,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
|||||||
if leaderheight < 0 then leaderheight = 0 end
|
if leaderheight < 0 then leaderheight = 0 end
|
||||||
local _height = _heliUnit:GetHeight() - leaderheight
|
local _height = _heliUnit:GetHeight() - leaderheight
|
||||||
|
|
||||||
-- TODO - make variable
|
-- DONE - make variable
|
||||||
if _height <= self.rescuehoverheight then
|
if _height <= self.rescuehoverheight then
|
||||||
|
|
||||||
local _time = self.hoverStatus[_lookupKeyHeli]
|
local _time = self.hoverStatus[_lookupKeyHeli]
|
||||||
@ -2282,6 +2295,29 @@ end
|
|||||||
function CSAR:onbeforeBoarded(From, Event, To, Heliname, Woundedgroupname)
|
function CSAR:onbeforeBoarded(From, Event, To, Heliname, Woundedgroupname)
|
||||||
self:T({From, Event, To, Heliname, Woundedgroupname})
|
self:T({From, Event, To, Heliname, Woundedgroupname})
|
||||||
self:_ScheduledSARFlight(Heliname,Woundedgroupname)
|
self:_ScheduledSARFlight(Heliname,Woundedgroupname)
|
||||||
|
local Unit = UNIT:FindByName(Heliname)
|
||||||
|
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
||||||
|
local playername = Unit:GetPlayerName()
|
||||||
|
local dropcoord = Unit:GetCoordinate() or COORDINATE:New(0,0,0)
|
||||||
|
local dropvec2 = dropcoord:GetVec2()
|
||||||
|
self.PlayerTaskQueue:ForEach(
|
||||||
|
function (Task)
|
||||||
|
local task = Task -- Ops.PlayerTask#PLAYERTASK
|
||||||
|
local subtype = task:GetSubType()
|
||||||
|
-- right subtype?
|
||||||
|
if Event == subtype and not task:IsDone() then
|
||||||
|
local targetzone = task.Target:GetObject() -- Core.Zone#ZONE should be a zone in this case ....
|
||||||
|
if (targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and targetzone:IsVec2InZone(dropvec2))
|
||||||
|
or (string.find(task.CSARPilotName,Woundedgroupname)) then
|
||||||
|
if task.Clients:HasUniqueID(playername) then
|
||||||
|
-- success
|
||||||
|
task:__Success(-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2311,6 +2347,23 @@ function CSAR:onbeforeRescued(From, Event, To, HeliUnit, HeliName, PilotsSaved)
|
|||||||
self:T({From, Event, To, HeliName, HeliUnit})
|
self:T({From, Event, To, HeliName, HeliUnit})
|
||||||
self.rescues = self.rescues + 1
|
self.rescues = self.rescues + 1
|
||||||
self.rescuedpilots = self.rescuedpilots + PilotsSaved
|
self.rescuedpilots = self.rescuedpilots + PilotsSaved
|
||||||
|
local Unit = HeliUnit or UNIT:FindByName(HeliName)
|
||||||
|
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
||||||
|
local playername = Unit:GetPlayerName()
|
||||||
|
self.PlayerTaskQueue:ForEach(
|
||||||
|
function (Task)
|
||||||
|
local task = Task -- Ops.PlayerTask#PLAYERTASK
|
||||||
|
local subtype = task:GetSubType()
|
||||||
|
-- right subtype?
|
||||||
|
if Event == subtype and not task:IsDone() then
|
||||||
|
if task.Clients:HasUniqueID(playername) then
|
||||||
|
-- success
|
||||||
|
task:__Success(-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user