mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
xx
This commit is contained in:
parent
03cd354f9e
commit
29111e1018
@ -839,6 +839,7 @@ do
|
|||||||
-- my_ctld.TroopUnloadDistGroundHerc = 25 -- On the ground, unload troops this far behind the Hercules
|
-- my_ctld.TroopUnloadDistGroundHerc = 25 -- On the ground, unload troops this far behind the Hercules
|
||||||
-- my_ctld.TroopUnloadDistGroundHook = 15 -- On the ground, unload troops this far behind the Chinook
|
-- my_ctld.TroopUnloadDistGroundHook = 15 -- On the ground, unload troops this far behind the Chinook
|
||||||
-- my_ctld.TroopUnloadDistHoverHook = 5 -- When hovering, unload troops this far behind the Chinook
|
-- my_ctld.TroopUnloadDistHoverHook = 5 -- When hovering, unload troops this far behind the Chinook
|
||||||
|
-- my_ctld.showstockinmenuitems = false -- When set to true, the menu lines will also show the remaining items in stock (that is, if you set any), downside is that the menu for all will be build every 30 seconds anew.
|
||||||
--
|
--
|
||||||
-- ## 2.1 CH-47 Chinook support
|
-- ## 2.1 CH-47 Chinook support
|
||||||
--
|
--
|
||||||
@ -1354,7 +1355,7 @@ CTLD.UnitTypeCapabilities = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.1.26"
|
CTLD.version="1.1.28"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@ -1530,6 +1531,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self.usesubcats = false
|
self.usesubcats = false
|
||||||
self.subcats = {}
|
self.subcats = {}
|
||||||
self.subcatsTroop = {}
|
self.subcatsTroop = {}
|
||||||
|
self.showstockinmenuitems = false
|
||||||
|
|
||||||
-- disallow building in loadzones
|
-- disallow building in loadzones
|
||||||
self.nobuildinloadzones = true
|
self.nobuildinloadzones = true
|
||||||
@ -2428,6 +2430,7 @@ end
|
|||||||
-- landed or hovering over load zone?
|
-- landed or hovering over load zone?
|
||||||
local grounded = not self:IsUnitInAir(Unit)
|
local grounded = not self:IsUnitInAir(Unit)
|
||||||
local hoverload = self:CanHoverLoad(Unit)
|
local hoverload = self:CanHoverLoad(Unit)
|
||||||
|
local hassecondaries = false
|
||||||
|
|
||||||
if not grounded and not hoverload then
|
if not grounded and not hoverload then
|
||||||
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
||||||
@ -2542,7 +2545,7 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- clean up:
|
-- clean up:
|
||||||
local hassecondaries = false
|
hassecondaries = false
|
||||||
if type(Cargotype.Templates) == "table" and Cargotype.Templates[2] then
|
if type(Cargotype.Templates) == "table" and Cargotype.Templates[2] then
|
||||||
for _,_key in pairs (Cargotype.Templates) do
|
for _,_key in pairs (Cargotype.Templates) do
|
||||||
table.insert(secondarygroups,_key)
|
table.insert(secondarygroups,_key)
|
||||||
@ -4077,7 +4080,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local menucount = 0
|
local menucount = 0
|
||||||
local menus = {}
|
local menus = {}
|
||||||
for _, _unitName in pairs(self.CtldUnits) do
|
for _, _unitName in pairs(self.CtldUnits) do
|
||||||
if not self.MenusDone[_unitName] then
|
if (not self.MenusDone[_unitName]) or (self.showstockinmenuitems == true) then
|
||||||
local _unit = UNIT:FindByName(_unitName) -- Wrapper.Unit#UNIT
|
local _unit = UNIT:FindByName(_unitName) -- Wrapper.Unit#UNIT
|
||||||
if _unit then
|
if _unit then
|
||||||
local _group = _unit:GetGroup() -- Wrapper.Group#GROUP
|
local _group = _unit:GetGroup() -- Wrapper.Group#GROUP
|
||||||
@ -4127,18 +4130,28 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local entry = _entry -- #CTLD_CARGO
|
local entry = _entry -- #CTLD_CARGO
|
||||||
local subcat = entry.Subcategory
|
local subcat = entry.Subcategory
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
local menutext = entry.Name
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.." ["..stock.."]"
|
||||||
|
end
|
||||||
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for _,_entry in pairs(self.Cargo_Troops) do
|
for _,_entry in pairs(self.Cargo_Troops) do
|
||||||
local entry = _entry -- #CTLD_CARGO
|
local entry = _entry -- #CTLD_CARGO
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
local menutext = entry.Name
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.." ["..stock.."]"
|
||||||
|
end
|
||||||
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -4164,12 +4177,16 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local subcat = entry.Subcategory
|
local subcat = entry.Subcategory
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
local zone = entry.Location
|
local zone = entry.Location
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||||
if zone then
|
if zone then
|
||||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||||
end
|
end
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.."["..stock.."]"
|
||||||
|
end
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -4178,12 +4195,16 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local subcat = entry.Subcategory
|
local subcat = entry.Subcategory
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
local zone = entry.Location
|
local zone = entry.Location
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||||
if zone then
|
if zone then
|
||||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||||
end
|
end
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.."["..stock.."]"
|
||||||
|
end
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -4192,12 +4213,16 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local entry = _entry -- #CTLD_CARGO
|
local entry = _entry -- #CTLD_CARGO
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
local zone = entry.Location
|
local zone = entry.Location
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||||
if zone then
|
if zone then
|
||||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||||
end
|
end
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.."["..stock.."]"
|
||||||
|
end
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -4205,12 +4230,16 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local entry = _entry -- #CTLD_CARGO
|
local entry = _entry -- #CTLD_CARGO
|
||||||
local noshow = entry.DontShowInMenu
|
local noshow = entry.DontShowInMenu
|
||||||
local zone = entry.Location
|
local zone = entry.Location
|
||||||
|
local stock = _entry:GetStock()
|
||||||
if not noshow then
|
if not noshow then
|
||||||
menucount = menucount + 1
|
menucount = menucount + 1
|
||||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||||
if zone then
|
if zone then
|
||||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||||
end
|
end
|
||||||
|
if stock >= 0 and self.showstockinmenuitems == true then
|
||||||
|
menutext = menutext.."["..stock.."]"
|
||||||
|
end
|
||||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -5369,7 +5398,8 @@ end
|
|||||||
local Stock = {}
|
local Stock = {}
|
||||||
local gentroops = self.Cargo_Crates
|
local gentroops = self.Cargo_Crates
|
||||||
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
||||||
table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
Stock[_troop.Name] = _troop.Stock or -1
|
||||||
|
--table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
||||||
end
|
end
|
||||||
return Stock
|
return Stock
|
||||||
end
|
end
|
||||||
@ -5381,7 +5411,8 @@ end
|
|||||||
local Stock = {}
|
local Stock = {}
|
||||||
local gentroops = self.Cargo_Troops
|
local gentroops = self.Cargo_Troops
|
||||||
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
||||||
table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
Stock[_troop.Name] = _troop.Stock or -1
|
||||||
|
--table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
||||||
end
|
end
|
||||||
return Stock
|
return Stock
|
||||||
end
|
end
|
||||||
@ -5414,7 +5445,8 @@ end
|
|||||||
local Stock = {}
|
local Stock = {}
|
||||||
local gentroops = self.Cargo_Statics
|
local gentroops = self.Cargo_Statics
|
||||||
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
for _id,_troop in pairs (gentroops) do -- #number, #CTLD_CARGO
|
||||||
table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
Stock[_troop.Name] = _troop.Stock or -1
|
||||||
|
-- table.insert(Stock,_troop.Name,_troop.Stock or -1)
|
||||||
end
|
end
|
||||||
return Stock
|
return Stock
|
||||||
end
|
end
|
||||||
@ -5473,6 +5505,33 @@ end
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (User) Get a generic #CTLD_CARGO entry from a group name, works for Troops and Vehicles, FOB, i.e. everything that is spawned as a GROUP object.
|
||||||
|
-- @param #CTLD self
|
||||||
|
-- @param #string GroupName The name to use for the search
|
||||||
|
-- @return #CTLD_CARGO The cargo object or nil if not found
|
||||||
|
function CTLD:GetGenericCargoObjectFromGroupName(GroupName)
|
||||||
|
local Cargotype = nil
|
||||||
|
for k,v in pairs(self.Cargo_Troops) do
|
||||||
|
local comparison = ""
|
||||||
|
if type(v.Templates) == "string" then comparison = v.Templates else comparison = v.Templates[1] end
|
||||||
|
if comparison == GroupName then
|
||||||
|
Cargotype = v
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not Cargotype then
|
||||||
|
for k,v in pairs(self.Cargo_Crates) do
|
||||||
|
local comparison = ""
|
||||||
|
if type(v.Templates) == "string" then comparison = v.Templates else comparison = v.Templates[1] end
|
||||||
|
if comparison == GroupName then
|
||||||
|
Cargotype = v
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Cargotype
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Check on engineering teams
|
--- (Internal) Check on engineering teams
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
@ -5653,7 +5712,7 @@ end
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (User) Pre-populate vehicles in the field.
|
--- (User) Pre-populate vehicles in the field.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param Core.Zone#ZONE Zone The zone where to drop the troops.
|
-- @param Core.Zone#ZONE Zone The zone where to drop the troops.
|
||||||
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user