mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
AUTOLASE - less menu builds
This commit is contained in:
parent
7c0605e82f
commit
09372df86d
@ -325,12 +325,15 @@ end
|
||||
function AUTOLASE:SetPilotMenu()
|
||||
if self.usepilotset then
|
||||
local pilottable = self.pilotset:GetSetObjects() or {}
|
||||
local grouptable = {}
|
||||
for _,_unit in pairs (pilottable) do
|
||||
local Unit = _unit -- Wrapper.Unit#UNIT
|
||||
if Unit and Unit:IsAlive() then
|
||||
local Group = Unit:GetGroup()
|
||||
local GroupName = Group:GetName() or "none"
|
||||
local unitname = Unit:GetName()
|
||||
if self.playermenus[unitname] then self.playermenus[unitname]:Remove() end
|
||||
if not grouptable[GroupName] == true then
|
||||
if self.playermenus[unitname] then self.playermenus[unitname]:Remove() end -- menus
|
||||
local lasetopm = MENU_GROUP:New(Group,"Autolase",nil)
|
||||
self.playermenus[unitname] = lasetopm
|
||||
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Status",lasetopm,self.ShowStatus,self,Group,Unit)
|
||||
@ -338,14 +341,14 @@ function AUTOLASE:SetPilotMenu()
|
||||
local smoke = (self.smoketargets == true) and "off" or "on"
|
||||
local smoketext = string.format("Switch smoke targets to %s",smoke)
|
||||
local smokemenu = MENU_GROUP_COMMAND:New(Group,smoketext,lasetopm,self.SetSmokeTargets,self,(not self.smoketargets))
|
||||
end
|
||||
end -- smokement
|
||||
if self.threatmenu then
|
||||
local threatmenutop = MENU_GROUP:New(Group,"Set min lasing threat",lasetopm)
|
||||
for i=0,10,2 do
|
||||
local text = "Threatlevel "..tostring(i)
|
||||
local threatmenu = MENU_GROUP_COMMAND:New(Group,text,threatmenutop,self.SetMinThreatLevel,self,i)
|
||||
end
|
||||
end
|
||||
end -- threatlevel
|
||||
end -- threatmenu
|
||||
for _,_grp in pairs(self.RecceSet.Set) do
|
||||
local grp = _grp -- Wrapper.Group#GROUP
|
||||
local unit = grp:GetUnit(1)
|
||||
@ -359,12 +362,14 @@ function AUTOLASE:SetPilotMenu()
|
||||
local text = tostring(_code)
|
||||
if _code == code then text = text.."(*)" end
|
||||
local changemenu = MENU_GROUP_COMMAND:New(Group,text,unittop,self.SetRecceLaserCode,self,name,_code,true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end -- Codes
|
||||
end -- unit alive
|
||||
end -- Recceset
|
||||
grouptable[GroupName] = true
|
||||
end -- grouptable[GroupName]
|
||||
--lasemenu:Refresh()
|
||||
end
|
||||
end
|
||||
end -- unit alive
|
||||
end -- pilot loop
|
||||
else
|
||||
if not self.NoMenus then
|
||||
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user