mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
- Fixed payload not reduced
This commit is contained in:
parent
d027113b0b
commit
0948f418cd
@ -152,7 +152,7 @@ AIRWING = {
|
|||||||
|
|
||||||
--- AIRWING class version.
|
--- AIRWING class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRWING.version="0.5.0"
|
AIRWING.version="0.5.1"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@ -472,11 +472,19 @@ function AIRWING:FetchPayloadFromStock(UnitType, MissionType, Payloads)
|
|||||||
return nil
|
return nil
|
||||||
elseif #payloads==1 then
|
elseif #payloads==1 then
|
||||||
-- Only one payload anyway.
|
-- Only one payload anyway.
|
||||||
return payloads[1]
|
local payload=payloads[1] --#AIRWING.Payload
|
||||||
|
if not payload.unlimited then
|
||||||
|
payload.navail=payload.navail-1
|
||||||
|
end
|
||||||
|
return payload
|
||||||
else
|
else
|
||||||
-- Sort payloads.
|
-- Sort payloads.
|
||||||
table.sort(payloads, sortpayloads)
|
table.sort(payloads, sortpayloads)
|
||||||
return payloads[1]
|
local payload=payloads[1] --#AIRWING.Payload
|
||||||
|
if not payload.unlimited then
|
||||||
|
payload.navail=payload.navail-1
|
||||||
|
end
|
||||||
|
return payload
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -69,8 +69,10 @@ ARMYGROUP.version="0.3.0"
|
|||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- TODO: Suppression of fire.
|
||||||
-- TODO: Check if group is mobile.
|
-- TODO: Check if group is mobile.
|
||||||
-- TODO: Rearm. Specify a point where to go and wait until ammo is full.
|
-- TODO: F10 menu.
|
||||||
|
-- DONE: Rearm. Specify a point where to go and wait until ammo is full.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Constructor
|
-- Constructor
|
||||||
|
|||||||
@ -1957,7 +1957,7 @@ function AUFTRAG:IsReadyToCancel()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Evaluate failure condition. One is enough.
|
||||||
local failure=self:EvalConditionsAny(self.conditionFailure)
|
local failure=self:EvalConditionsAny(self.conditionFailure)
|
||||||
|
|
||||||
if failure then
|
if failure then
|
||||||
@ -1965,6 +1965,7 @@ function AUFTRAG:IsReadyToCancel()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Evaluate success consitions. One is enough.
|
||||||
local success=self:EvalConditionsAny(self.conditionSuccess)
|
local success=self:EvalConditionsAny(self.conditionSuccess)
|
||||||
|
|
||||||
if success then
|
if success then
|
||||||
|
|||||||
@ -320,15 +320,15 @@ OPSGROUP.TaskType={
|
|||||||
|
|
||||||
--- NavyGroup version.
|
--- NavyGroup version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
OPSGROUP.version="0.6.0"
|
OPSGROUP.version="0.7.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- TODO: Suppression of fire.
|
|
||||||
-- TODO: AI on/off.
|
-- TODO: AI on/off.
|
||||||
-- TODO: Invisible/immortal.
|
-- TODO: Invisible/immortal.
|
||||||
|
-- TODO: F10 menu.
|
||||||
-- TODO: Add pseudo function.
|
-- TODO: Add pseudo function.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -525,13 +525,13 @@ end
|
|||||||
--- Set LASER parameters.
|
--- Set LASER parameters.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #number Code Laser code. Default 1688.
|
-- @param #number Code Laser code. Default 1688.
|
||||||
-- @param #boolean CheckLOS Check if lasing unit has line of sight to target coordinate.
|
-- @param #boolean CheckLOS Check if lasing unit has line of sight to target coordinate. Default is `true`.
|
||||||
-- @param #boolean IROff If true, then dont switch on the additional IR pointer.
|
-- @param #boolean IROff If true, then dont switch on the additional IR pointer.
|
||||||
-- @param #number UpdateTime Time interval in seconds the beam gets up for moving targets. Default every 0.5 sec.
|
-- @param #number UpdateTime Time interval in seconds the beam gets up for moving targets. Default every 0.5 sec.
|
||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
function OPSGROUP:SetLaser(Code, CheckLOS, IROff, UpdateTime)
|
function OPSGROUP:SetLaser(Code, CheckLOS, IROff, UpdateTime)
|
||||||
self.spot.Code=Code or 1688
|
self.spot.Code=Code or 1688
|
||||||
self.spot.CheckLOS=CheckLOS
|
self.spot.CheckLOS=CheckLOS and CheckLOS or true
|
||||||
self.spot.IRon=not IROff
|
self.spot.IRon=not IROff
|
||||||
self.spot.dt=UpdateTime or 0.5
|
self.spot.dt=UpdateTime or 0.5
|
||||||
return self
|
return self
|
||||||
@ -3052,7 +3052,6 @@ function OPSGROUP:onafterDetectedUnit(From, Event, To, Unit)
|
|||||||
-- Debug.
|
-- Debug.
|
||||||
self:T2(self.lid..string.format("Detected unit %s", unitname))
|
self:T2(self.lid..string.format("Detected unit %s", unitname))
|
||||||
|
|
||||||
|
|
||||||
if self.detectedunits:FindUnit(unitname) then
|
if self.detectedunits:FindUnit(unitname) then
|
||||||
-- Unit is already in the detected unit set ==> Trigger "DetectedUnitKnown" event.
|
-- Unit is already in the detected unit set ==> Trigger "DetectedUnitKnown" event.
|
||||||
self:DetectedUnitKnown(Unit)
|
self:DetectedUnitKnown(Unit)
|
||||||
@ -3070,6 +3069,8 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Wrapper.Unit#UNIT Unit The detected unit.
|
-- @param Wrapper.Unit#UNIT Unit The detected unit.
|
||||||
function OPSGROUP:onafterDetectedUnitNew(From, Event, To, Unit)
|
function OPSGROUP:onafterDetectedUnitNew(From, Event, To, Unit)
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Detected New unit %s", Unit:GetName()))
|
self:T(self.lid..string.format("Detected New unit %s", Unit:GetName()))
|
||||||
|
|
||||||
-- Add unit to detected unit set.
|
-- Add unit to detected unit set.
|
||||||
@ -3087,9 +3088,8 @@ function OPSGROUP:onafterDetectedGroup(From, Event, To, Group)
|
|||||||
-- Get group name.
|
-- Get group name.
|
||||||
local groupname=Group and Group:GetName() or "unknown"
|
local groupname=Group and Group:GetName() or "unknown"
|
||||||
|
|
||||||
-- Debug.
|
-- Debug info.
|
||||||
self:I(self.lid..string.format("Detected group %s", groupname))
|
self:T(self.lid..string.format("Detected group %s", groupname))
|
||||||
|
|
||||||
|
|
||||||
if self.detectedgroups:FindGroup(groupname) then
|
if self.detectedgroups:FindGroup(groupname) then
|
||||||
-- Group is already in the detected set ==> Trigger "DetectedGroupKnown" event.
|
-- Group is already in the detected set ==> Trigger "DetectedGroupKnown" event.
|
||||||
@ -3108,7 +3108,9 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Wrapper.Group#GROUP Group The detected group.
|
-- @param Wrapper.Group#GROUP Group The detected group.
|
||||||
function OPSGROUP:onafterDetectedGroupNew(From, Event, To, Group)
|
function OPSGROUP:onafterDetectedGroupNew(From, Event, To, Group)
|
||||||
self:I(self.lid..string.format("Detected New group %s", Group:GetName()))
|
|
||||||
|
-- Debug info.
|
||||||
|
self:T(self.lid..string.format("Detected New group %s", Group:GetName()))
|
||||||
|
|
||||||
-- Add unit to detected unit set.
|
-- Add unit to detected unit set.
|
||||||
self.detectedgroups:AddGroup(Group)
|
self.detectedgroups:AddGroup(Group)
|
||||||
@ -3382,6 +3384,8 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSGROUP:onafterLaserLostLOS(From, Event, To)
|
function OPSGROUP:onafterLaserLostLOS(From, Event, To)
|
||||||
|
|
||||||
|
--env.info("FF lost LOS")
|
||||||
|
|
||||||
-- No of sight.
|
-- No of sight.
|
||||||
self.spot.LOS=false
|
self.spot.LOS=false
|
||||||
|
|
||||||
@ -3390,6 +3394,8 @@ function OPSGROUP:onafterLaserLostLOS(From, Event, To)
|
|||||||
|
|
||||||
if self.spot.On then
|
if self.spot.On then
|
||||||
|
|
||||||
|
--env.info("FF lost LOS ==> pause laser")
|
||||||
|
|
||||||
-- Switch laser off.
|
-- Switch laser off.
|
||||||
self:LaserPause()
|
self:LaserPause()
|
||||||
|
|
||||||
@ -3407,18 +3413,18 @@ function OPSGROUP:onafterLaserGotLOS(From, Event, To)
|
|||||||
-- Has line of sight.
|
-- Has line of sight.
|
||||||
self.spot.LOS=true
|
self.spot.LOS=true
|
||||||
|
|
||||||
env.info("FF Laser Got LOS")
|
--env.info("FF Laser Got LOS")
|
||||||
|
|
||||||
if self.spot.lostLOS then
|
if self.spot.lostLOS then
|
||||||
|
|
||||||
-- Did not loose LOS anymore.
|
-- Did not loose LOS anymore.
|
||||||
self.spot.lostLOS=false
|
self.spot.lostLOS=false
|
||||||
|
|
||||||
env.info("FF had lost LOS and regained it")
|
--env.info("FF had lost LOS and regained it")
|
||||||
|
|
||||||
-- Resume laser if currently paused.
|
-- Resume laser if currently paused.
|
||||||
if self.spot.Paused then
|
if self.spot.Paused then
|
||||||
env.info("FF laser was paused ==> resume")
|
--env.info("FF laser was paused ==> resume")
|
||||||
self:LaserResume()
|
self:LaserResume()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3565,7 +3571,7 @@ function OPSGROUP:_UpdateLaser()
|
|||||||
-- Check current LOS.
|
-- Check current LOS.
|
||||||
local los=self:HasLoS(self.spot.Coordinate, self.spot.element, self.spot.offset)
|
local los=self:HasLoS(self.spot.Coordinate, self.spot.element, self.spot.offset)
|
||||||
|
|
||||||
env.info(string.format("FF check LOS current=%s previous=%s", tostring(los), tostring(self.spot.LOS)))
|
--env.info(string.format("FF check LOS current=%s previous=%s", tostring(los), tostring(self.spot.LOS)))
|
||||||
|
|
||||||
if los then
|
if los then
|
||||||
-- Got LOS
|
-- Got LOS
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user