mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#PLAYERTASK - a target can only be smoked again after 5 mins (that's how long smoke lasts)
#PLAYERTASKCONTROLLER - added option to hide smoke&flare menus
This commit is contained in:
parent
8a9ee747c1
commit
de415384f3
@ -49,6 +49,7 @@ do
|
|||||||
-- @field #table conditionFailure = {},
|
-- @field #table conditionFailure = {},
|
||||||
-- @field Ops.PlayerTask#PLAYERTASKCONTROLLER TaskController
|
-- @field Ops.PlayerTask#PLAYERTASKCONTROLLER TaskController
|
||||||
-- @field #number timestamp
|
-- @field #number timestamp
|
||||||
|
-- @field #number lastsmoketime
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
@ -76,11 +77,12 @@ PLAYERTASK = {
|
|||||||
conditionFailure = {},
|
conditionFailure = {},
|
||||||
TaskController = nil,
|
TaskController = nil,
|
||||||
timestamp = 0,
|
timestamp = 0,
|
||||||
|
lastsmoketime = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASK.version="0.1.2"
|
PLAYERTASK.version="0.1.3"
|
||||||
|
|
||||||
--- Generic task condition.
|
--- Generic task condition.
|
||||||
-- @type PLAYERTASK.Condition
|
-- @type PLAYERTASK.Condition
|
||||||
@ -112,6 +114,7 @@ function PLAYERTASK:New(Type, Target, Repeat, Times, TTSType)
|
|||||||
self.TaskController = nil -- Ops.PlayerTask#PLAYERTASKCONTROLLER
|
self.TaskController = nil -- Ops.PlayerTask#PLAYERTASKCONTROLLER
|
||||||
self.timestamp = timer.getAbsTime()
|
self.timestamp = timer.getAbsTime()
|
||||||
self.TTSType = TTSType or "close air support"
|
self.TTSType = TTSType or "close air support"
|
||||||
|
self.lastsmoketime = 0
|
||||||
|
|
||||||
if Repeat then
|
if Repeat then
|
||||||
self.Repeat = true
|
self.Repeat = true
|
||||||
@ -392,10 +395,13 @@ end
|
|||||||
function PLAYERTASK:SmokeTarget(Color)
|
function PLAYERTASK:SmokeTarget(Color)
|
||||||
self:T(self.lid.."SmokeTarget")
|
self:T(self.lid.."SmokeTarget")
|
||||||
local color = Color or SMOKECOLOR.Red
|
local color = Color or SMOKECOLOR.Red
|
||||||
if self.Target then
|
if not self.lastsmoketime then self.lastsmoketime = 0 end
|
||||||
|
local TDiff = timer.getAbsTime() - self.lastsmoketime
|
||||||
|
if self.Target and TDiff > 299 then
|
||||||
local coordinate = self.Target:GetCoordinate()
|
local coordinate = self.Target:GetCoordinate()
|
||||||
if coordinate then
|
if coordinate then
|
||||||
coordinate:Smoke(color)
|
coordinate:Smoke(color)
|
||||||
|
self.lastsmoketime = timer.getAbsTime()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@ -754,6 +760,7 @@ do
|
|||||||
-- @field #table PlayerFlashMenu
|
-- @field #table PlayerFlashMenu
|
||||||
-- @field #table PlayerJoinMenu
|
-- @field #table PlayerJoinMenu
|
||||||
-- @field #table PlayerInfoMenu
|
-- @field #table PlayerInfoMenu
|
||||||
|
-- @field #boolean noflaresmokemenu
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1055,6 +1062,7 @@ PLAYERTASKCONTROLLER = {
|
|||||||
PlayerFlashMenu = {},
|
PlayerFlashMenu = {},
|
||||||
PlayerJoinMenu = {},
|
PlayerJoinMenu = {},
|
||||||
PlayerInfoMenu = {},
|
PlayerInfoMenu = {},
|
||||||
|
noflaresmokemenu = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1213,7 +1221,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASKCONTROLLER.version="0.1.36"
|
PLAYERTASKCONTROLLER.version="0.1.37"
|
||||||
|
|
||||||
--- Constructor
|
--- Constructor
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
@ -1268,6 +1276,8 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
|
|||||||
self.Keepnumber = false
|
self.Keepnumber = false
|
||||||
self.CallsignTranslations = nil
|
self.CallsignTranslations = nil
|
||||||
|
|
||||||
|
self.noflaresmokemenu = false
|
||||||
|
|
||||||
if ClientFilter then
|
if ClientFilter then
|
||||||
self.ClientSet = SET_CLIENT:New():FilterCoalitions(string.lower(self.CoalitionName)):FilterActive(true):FilterPrefixes(ClientFilter):FilterStart()
|
self.ClientSet = SET_CLIENT:New():FilterCoalitions(string.lower(self.CoalitionName)):FilterActive(true):FilterPrefixes(ClientFilter):FilterStart()
|
||||||
else
|
else
|
||||||
@ -1388,6 +1398,24 @@ function PLAYERTASKCONTROLLER:SetAllowFlashDirection(OnOff)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Do not show menu entries to smoke or flare targets
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:SetDisableSmokeFlareTask()
|
||||||
|
self:T(self.lid.."SetDisableSmokeFlareTask")
|
||||||
|
self.noflaresmokemenu = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [User] Show menu entries to smoke or flare targets (on by default!)
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:SetEnableSmokeFlareTask()
|
||||||
|
self:T(self.lid.."SetEnableSmokeFlareTask")
|
||||||
|
self.noflaresmokemenu = false
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [User] Set callsign options for TTS output. See @{Wrapper.Group#GROUP.GetCustomCallSign}() on how to set customized callsigns.
|
--- [User] Set callsign options for TTS output. See @{Wrapper.Group#GROUP.GetCustomCallSign}() on how to set customized callsigns.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param #boolean ShortCallsign If true, only call out the major flight number
|
-- @param #boolean ShortCallsign If true, only call out the major flight number
|
||||||
@ -2716,8 +2744,8 @@ function PLAYERTASKCONTROLLER:_BuildMenus(Client,enforced,fromsuccess)
|
|||||||
local active = MENU_GROUP_DELAYED:New(group,menuactive,topmenu)
|
local active = MENU_GROUP_DELAYED:New(group,menuactive,topmenu)
|
||||||
local info = MENU_GROUP_COMMAND_DELAYED:New(group,menuinfo,active,self._ActiveTaskInfo,self,group,client)
|
local info = MENU_GROUP_COMMAND_DELAYED:New(group,menuinfo,active,self._ActiveTaskInfo,self,group,client)
|
||||||
local mark = MENU_GROUP_COMMAND_DELAYED:New(group,menumark,active,self._MarkTask,self,group,client)
|
local mark = MENU_GROUP_COMMAND_DELAYED:New(group,menumark,active,self._MarkTask,self,group,client)
|
||||||
if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then
|
if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A or self.noflaresmokemenu then
|
||||||
-- no smoking/flaring here if A2A
|
-- no smoking/flaring here if A2A or designer has set to false
|
||||||
local smoke = MENU_GROUP_COMMAND_DELAYED:New(group,menusmoke,active,self._SmokeTask,self,group,client)
|
local smoke = MENU_GROUP_COMMAND_DELAYED:New(group,menusmoke,active,self._SmokeTask,self,group,client)
|
||||||
local flare = MENU_GROUP_COMMAND_DELAYED:New(group,menuflare,active,self._FlareTask,self,group,client)
|
local flare = MENU_GROUP_COMMAND_DELAYED:New(group,menuflare,active,self._FlareTask,self,group,client)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user