mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 06:20:55 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
@@ -1423,7 +1423,7 @@ CTLD.FixedWingTypes = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.3.39"
|
CTLD.version="1.3.40"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -2273,6 +2273,12 @@ function CTLD:_FindCratesCargoObject(Name)
|
|||||||
return cargo
|
return cargo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for _,_cargo in pairs(self.Cargo_Statics)do
|
||||||
|
local cargo = _cargo -- #CTLD_CARGO
|
||||||
|
if cargo.Name == Name then
|
||||||
|
return cargo
|
||||||
|
end
|
||||||
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2840,14 +2846,16 @@ end
|
|||||||
-- @param #table stockSummary Optional pooled stock summary.
|
-- @param #table stockSummary Optional pooled stock summary.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSummary)
|
function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSummary)
|
||||||
|
self:T("_AddCrateQuantityMenus "..cargoObj.Name)
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local stockEntry = self:_GetCrateStockEntry(cargoObj, stockSummary)
|
local stockEntry = self:_GetCrateStockEntry(cargoObj, stockSummary)
|
||||||
local stock = nil
|
local stock = 0
|
||||||
if stockEntry and type(stockEntry.Stock) == "number" then
|
if stockEntry and type(stockEntry.Stock) == "number" then
|
||||||
stock = stockEntry.Stock
|
stock = stockEntry.Stock
|
||||||
else
|
else
|
||||||
stock = cargoObj:GetStock()
|
stock = cargoObj:GetStock()
|
||||||
end
|
end
|
||||||
|
self:T("_AddCrateQuantityMenus "..cargoObj.Name.." Stock: "..tostring(stock))
|
||||||
local maxQuantity = self.maxCrateMenuQuantity or 1
|
local maxQuantity = self.maxCrateMenuQuantity or 1
|
||||||
local availableSets = nil
|
local availableSets = nil
|
||||||
if type(stock) == "number" and stock >= 0 then
|
if type(stock) == "number" and stock >= 0 then
|
||||||
@@ -2861,6 +2869,7 @@ function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSum
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
maxQuantity = math.floor(maxQuantity)
|
maxQuantity = math.floor(maxQuantity)
|
||||||
|
self:T("_AddCrateQuantityMenus maxQuantity "..maxQuantity)
|
||||||
if maxQuantity < 1 then
|
if maxQuantity < 1 then
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2896,6 +2905,7 @@ function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSum
|
|||||||
maxQuantity = 1
|
maxQuantity = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self:T("_AddCrateQuantityMenus maxQuantity "..maxQuantity.." allowLoad "..tostring(allowLoad))
|
||||||
local maxMassSets = nil
|
local maxMassSets = nil
|
||||||
if Unit then
|
if Unit then
|
||||||
local maxload = self:_GetMaxLoadableMass(Unit)
|
local maxload = self:_GetMaxLoadableMass(Unit)
|
||||||
@@ -2911,10 +2921,14 @@ function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSum
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self:T("_AddCrateQuantityMenus maxQuantity "..maxQuantity.." allowLoad "..tostring(allowLoad))
|
||||||
if maxQuantity < 1 then
|
if maxQuantity < 1 then
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
if maxQuantity == 1 then
|
if maxQuantity == 1 then
|
||||||
|
self:T("_AddCrateQuantityMenus maxQuantity "..maxQuantity.." Menu for MaxQ=1 ".."parentMenu.MenuText = "..parentMenu.MenuText)
|
||||||
|
--parentMenu.MenuText
|
||||||
MENU_GROUP_COMMAND:New(Group, "Get", parentMenu, self._GetCrateQuantity, self, Group, Unit, cargoObj, 1)
|
MENU_GROUP_COMMAND:New(Group, "Get", parentMenu, self._GetCrateQuantity, self, Group, Unit, cargoObj, 1)
|
||||||
local canLoad = (allowLoad and (not capacitySets or capacitySets >= 1) and (not maxMassSets or maxMassSets >= 1))
|
local canLoad = (allowLoad and (not capacitySets or capacitySets >= 1) and (not maxMassSets or maxMassSets >= 1))
|
||||||
if canLoad then
|
if canLoad then
|
||||||
@@ -2928,10 +2942,14 @@ function CTLD:_AddCrateQuantityMenus(Group, Unit, parentMenu, cargoObj, stockSum
|
|||||||
end
|
end
|
||||||
MENU_GROUP_COMMAND:New(Group, msg, parentMenu, self._SendMessage, self, msg, 10, false, Group)
|
MENU_GROUP_COMMAND:New(Group, msg, parentMenu, self._SendMessage, self, msg, 10, false, Group)
|
||||||
end
|
end
|
||||||
|
parentMenu:Refresh()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
for quantity = 1, maxQuantity do
|
for quantity = 1, maxQuantity do
|
||||||
|
self:T("_AddCrateQuantityMenus maxQuantity "..maxQuantity.." Menu for MaxQ>1")
|
||||||
local label = tostring(quantity)
|
local label = tostring(quantity)
|
||||||
|
self:T("_AddCrateQuantityMenus Label "..label)
|
||||||
local qMenu = MENU_GROUP:New(Group, label, parentMenu)
|
local qMenu = MENU_GROUP:New(Group, label, parentMenu)
|
||||||
MENU_GROUP_COMMAND:New(Group, "Get", qMenu, self._GetCrateQuantity, self, Group, Unit, cargoObj, quantity)
|
MENU_GROUP_COMMAND:New(Group, "Get", qMenu, self._GetCrateQuantity, self, Group, Unit, cargoObj, quantity)
|
||||||
local canLoad = (allowLoad and (not capacitySets or capacitySets >= quantity) and (not maxMassSets or maxMassSets >= quantity))
|
local canLoad = (allowLoad and (not capacitySets or capacitySets >= quantity) and (not maxMassSets or maxMassSets >= quantity))
|
||||||
@@ -4767,26 +4785,26 @@ function CTLD:_RefreshCrateQuantityMenus(Group, Unit, CargoObj)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if CargoObj and Group and Unit then
|
if CargoObj and Group and Unit then
|
||||||
local uname = Unit:GetName() or "none"
|
local uname = Unit:GetName() or "none"
|
||||||
local cap = (self:_GetUnitCapabilities(Unit).cratelimit or 0)
|
local cap = (self:_GetUnitCapabilities(Unit).cratelimit or 0)
|
||||||
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Cratesloaded) or 0
|
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Cratesloaded) or 0
|
||||||
local avail = math.max(0, cap - loaded)
|
local avail = math.max(0, cap - loaded)
|
||||||
local per = CargoObj:GetCratesNeeded() or 1
|
local per = CargoObj:GetCratesNeeded() or 1
|
||||||
if per < 1 then per = 1 end
|
if per < 1 then per = 1 end
|
||||||
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
||||||
local s = CargoObj:GetStock()
|
local s = CargoObj:GetStock()
|
||||||
self._qtySnap = self._qtySnap or {}
|
self._qtySnap = self._qtySnap or {}
|
||||||
self._qtySnap[uname] = self._qtySnap[uname] or {}
|
self._qtySnap[uname] = self._qtySnap[uname] or {}
|
||||||
local k = "C:"..(CargoObj:GetName() or "none")
|
local k = "C:"..(CargoObj:GetName() or "none")
|
||||||
local snap = tostring(type(s)=="number" and s or -1)..":"..tostring(unitAvail)
|
local snap = tostring(type(s)=="number" and s or -1)..":"..tostring(unitAvail)
|
||||||
if self._qtySnap[uname][k] ~= snap then
|
if self._qtySnap[uname][k] ~= snap then
|
||||||
self._qtySnap[uname][k] = snap
|
self._qtySnap[uname][k] = snap
|
||||||
if type(s)=="number" and s>=0 and s<unitAvail then
|
if type(s)=="number" and s>=0 and s<unitAvail then
|
||||||
self:_RefreshQuantityMenusForGroup(Group, Unit)
|
self:_RefreshQuantityMenusForGroup(Group, Unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4817,26 +4835,26 @@ function CTLD:_RefreshTroopQuantityMenus(Group, Unit, CargoObj)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if CargoObj and Group and Unit then
|
if CargoObj and Group and Unit then
|
||||||
local uname = Unit:GetName() or "none"
|
local uname = Unit:GetName() or "none"
|
||||||
local cap = (self:_GetUnitCapabilities(Unit).trooplimit or 0)
|
local cap = (self:_GetUnitCapabilities(Unit).trooplimit or 0)
|
||||||
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Troopsloaded) or 0
|
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Troopsloaded) or 0
|
||||||
local avail = math.max(0, cap - loaded)
|
local avail = math.max(0, cap - loaded)
|
||||||
local per = CargoObj:GetCratesNeeded() or 1
|
local per = CargoObj:GetCratesNeeded() or 1
|
||||||
if per < 1 then per = 1 end
|
if per < 1 then per = 1 end
|
||||||
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
||||||
local s = CargoObj:GetStock()
|
local s = CargoObj:GetStock()
|
||||||
self._qtySnap = self._qtySnap or {}
|
self._qtySnap = self._qtySnap or {}
|
||||||
self._qtySnap[uname] = self._qtySnap[uname] or {}
|
self._qtySnap[uname] = self._qtySnap[uname] or {}
|
||||||
local k = "T:"..(CargoObj:GetName() or "none")
|
local k = "T:"..(CargoObj:GetName() or "none")
|
||||||
local snap = tostring(type(s)=="number" and s or -1)..":"..tostring(unitAvail)
|
local snap = tostring(type(s)=="number" and s or -1)..":"..tostring(unitAvail)
|
||||||
if self._qtySnap[uname][k] ~= snap then
|
if self._qtySnap[uname][k] ~= snap then
|
||||||
self._qtySnap[uname][k] = snap
|
self._qtySnap[uname][k] = snap
|
||||||
if type(s)=="number" and s>=0 and s<unitAvail then
|
if type(s)=="number" and s>=0 and s<unitAvail then
|
||||||
self:_RefreshQuantityMenusForGroup(Group, Unit)
|
self:_RefreshQuantityMenusForGroup(Group, Unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4869,81 +4887,81 @@ function CTLD:_RefreshQuantityMenusForGroup(_group, _unit)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
self._qtySnap=self._qtySnap or {}
|
self._qtySnap=self._qtySnap or {}
|
||||||
for uname,_ in pairs(self._qtySnap) do
|
for uname,_ in pairs(self._qtySnap) do
|
||||||
if not (self.CtldUnits and self.CtldUnits[uname]) then
|
if not (self.CtldUnits and self.CtldUnits[uname]) then
|
||||||
self._qtySnap[uname]=nil
|
self._qtySnap[uname]=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for name,_ in pairs(self.CtldUnits or {}) do
|
for name,_ in pairs(self.CtldUnits or {}) do
|
||||||
local u = UNIT:FindByName(name) or CLIENT:FindByName(name)
|
local u = UNIT:FindByName(name) or CLIENT:FindByName(name)
|
||||||
if u and u:IsAlive() then
|
if u and u:IsAlive() then
|
||||||
local g = u:GetGroup()
|
local g = u:GetGroup()
|
||||||
if g then
|
if g then
|
||||||
local caps = self:_GetUnitCapabilities(u)
|
local caps = self:_GetUnitCapabilities(u)
|
||||||
local needCrate, needTroop = false, false
|
local needCrate, needTroop = false, false
|
||||||
|
|
||||||
if g.CTLD_CrateMenus then
|
if g.CTLD_CrateMenus then
|
||||||
local cap = caps.cratelimit or 0
|
local cap = caps.cratelimit or 0
|
||||||
for item,_ in pairs(g.CTLD_CrateMenus) do
|
for item,_ in pairs(g.CTLD_CrateMenus) do
|
||||||
local obj = self:_FindCratesCargoObject(item)
|
local obj = self:_FindCratesCargoObject(item)
|
||||||
if obj then
|
if obj then
|
||||||
local per = obj:GetCratesNeeded() or 1
|
local per = obj:GetCratesNeeded() or 1
|
||||||
if per < 1 then per = 1 end
|
if per < 1 then per = 1 end
|
||||||
local uname = u:GetName() or "none"
|
local uname = u:GetName() or "none"
|
||||||
local cap = caps.cratelimit or 0
|
local cap = caps.cratelimit or 0
|
||||||
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Cratesloaded) or 0
|
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Cratesloaded) or 0
|
||||||
local avail = math.max(0, cap - loaded)
|
local avail = math.max(0, cap - loaded)
|
||||||
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
||||||
local s = obj:GetStock()
|
local s = obj:GetStock()
|
||||||
if type(s)=="number" and s>=0 and s<unitAvail then needCrate = true break end
|
if type(s)=="number" and s>=0 and s<unitAvail then needCrate = true break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if g.CTLD_TroopMenus then
|
if g.CTLD_TroopMenus then
|
||||||
local cap = caps.trooplimit or 0
|
local cap = caps.trooplimit or 0
|
||||||
for item,_ in pairs(g.CTLD_TroopMenus) do
|
for item,_ in pairs(g.CTLD_TroopMenus) do
|
||||||
local obj = self:_FindTroopsCargoObject(item)
|
local obj = self:_FindTroopsCargoObject(item)
|
||||||
if obj then
|
if obj then
|
||||||
local per = obj:GetCratesNeeded() or 1
|
local per = obj:GetCratesNeeded() or 1
|
||||||
if per < 1 then per = 1 end
|
if per < 1 then per = 1 end
|
||||||
local uname = u:GetName() or "none"
|
local uname = u:GetName() or "none"
|
||||||
local cap = caps.trooplimit or 0
|
local cap = caps.trooplimit or 0
|
||||||
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Troopsloaded) or 0
|
local loaded = (self.Loaded_Cargo[uname] and self.Loaded_Cargo[uname].Troopsloaded) or 0
|
||||||
local avail = math.max(0, cap - loaded)
|
local avail = math.max(0, cap - loaded)
|
||||||
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
local unitAvail = math.max(0, math.min(self.maxCrateMenuQuantity or 1, math.floor(avail/per)))
|
||||||
local s = obj:GetStock()
|
local s = obj:GetStock()
|
||||||
if type(s)=="number" and s>=0 and s<unitAvail then needTroop = true break end
|
if type(s)=="number" and s>=0 and s<unitAvail then needTroop = true break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if needCrate or needTroop then
|
if needCrate or needTroop then
|
||||||
local stockSummary = self.showstockinmenuitems and self:_CountStockPlusInHeloPlusAliveGroups(false) or nil
|
local stockSummary = self.showstockinmenuitems and self:_CountStockPlusInHeloPlusAliveGroups(false) or nil
|
||||||
if needCrate and g.CTLD_CrateMenus then
|
if needCrate and g.CTLD_CrateMenus then
|
||||||
for item,menu in pairs(g.CTLD_CrateMenus) do
|
for item,menu in pairs(g.CTLD_CrateMenus) do
|
||||||
if menu and menu.RemoveSubMenus then
|
if menu and menu.RemoveSubMenus then
|
||||||
menu:RemoveSubMenus()
|
menu:RemoveSubMenus()
|
||||||
local obj = self:_FindCratesCargoObject(item)
|
local obj = self:_FindCratesCargoObject(item)
|
||||||
if obj then self:_AddCrateQuantityMenus(g, u, menu, obj, stockSummary) end
|
if obj then self:_AddCrateQuantityMenus(g, u, menu, obj, stockSummary) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if needTroop and g.CTLD_TroopMenus then
|
if needTroop and g.CTLD_TroopMenus then
|
||||||
for item,menu in pairs(g.CTLD_TroopMenus) do
|
for item,menu in pairs(g.CTLD_TroopMenus) do
|
||||||
if menu and menu.RemoveSubMenus then
|
if menu and menu.RemoveSubMenus then
|
||||||
menu:RemoveSubMenus()
|
menu:RemoveSubMenus()
|
||||||
local obj = self:_FindTroopsCargoObject(item)
|
local obj = self:_FindTroopsCargoObject(item)
|
||||||
if obj then self:_AddTroopQuantityMenus(g, u, menu, obj) end
|
if obj then self:_AddTroopQuantityMenus(g, u, menu, obj) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
--- (Internal) Housekeeping - Function to refresh F10 menus.
|
--- (Internal) Housekeeping - Function to refresh F10 menus.
|
||||||
@@ -5105,7 +5123,12 @@ function CTLD:_RefreshF10Menus()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
local txt
|
||||||
|
if needed > 1 then
|
||||||
|
txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
else
|
||||||
|
txt = string.format("%s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
end
|
||||||
if cargoObj.Location then txt = txt.."[R]" end
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
if self.showstockinmenuitems then
|
if self.showstockinmenuitems then
|
||||||
local suffix = self:_FormatCrateStockSuffix(cargoObj,crateStockSummary)
|
local suffix = self:_FormatCrateStockSuffix(cargoObj,crateStockSummary)
|
||||||
@@ -5116,7 +5139,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
self:_AddCrateQuantityMenus(_group,_unit,mSet,cargoObj,crateStockSummary)
|
self:_AddCrateQuantityMenus(_group,_unit,mSet,cargoObj,crateStockSummary)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.usesubcats then
|
if self.usesubcats == true then
|
||||||
local subcatmenus = {}
|
local subcatmenus = {}
|
||||||
for catName,_ in pairs(self.subcats) do
|
for catName,_ in pairs(self.subcats) do
|
||||||
subcatmenus[catName] = MENU_GROUP:New(_group,catName,cratesmenu)
|
subcatmenus[catName] = MENU_GROUP:New(_group,catName,cratesmenu)
|
||||||
@@ -5144,7 +5167,12 @@ function CTLD:_RefreshF10Menus()
|
|||||||
for _, cargoObj in pairs(self.Cargo_Crates) do
|
for _, cargoObj in pairs(self.Cargo_Crates) do
|
||||||
if not cargoObj.DontShowInMenu then
|
if not cargoObj.DontShowInMenu then
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local txt = string.format("%d crate%s %s (%dkg)", needed, needed==1 and "" or "s", cargoObj.Name, cargoObj.PerCrateMass or 0)
|
local txt
|
||||||
|
if needed > 1 then
|
||||||
|
txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
else
|
||||||
|
txt = string.format("%s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
end
|
||||||
if cargoObj.Location then txt = txt.."[R]" end
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
local stock = cargoObj:GetStock()
|
local stock = cargoObj:GetStock()
|
||||||
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
@@ -5154,7 +5182,12 @@ function CTLD:_RefreshF10Menus()
|
|||||||
for _, cargoObj in pairs(self.Cargo_Statics) do
|
for _, cargoObj in pairs(self.Cargo_Statics) do
|
||||||
if not cargoObj.DontShowInMenu then
|
if not cargoObj.DontShowInMenu then
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local txt = string.format("%d crate%s %s (%dkg)", needed, needed==1 and "" or "s", cargoObj.Name, cargoObj.PerCrateMass or 0)
|
local txt
|
||||||
|
if needed > 1 then
|
||||||
|
txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
else
|
||||||
|
txt = string.format("%s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
end
|
||||||
if cargoObj.Location then txt = txt.."[R]" end
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
local stock = cargoObj:GetStock()
|
local stock = cargoObj:GetStock()
|
||||||
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
@@ -5165,7 +5198,12 @@ function CTLD:_RefreshF10Menus()
|
|||||||
for _, cargoObj in pairs(self.Cargo_Crates) do
|
for _, cargoObj in pairs(self.Cargo_Crates) do
|
||||||
if not cargoObj.DontShowInMenu then
|
if not cargoObj.DontShowInMenu then
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local txt = string.format("%d crate%s %s (%dkg)", needed, needed==1 and "" or "s", cargoObj.Name, cargoObj.PerCrateMass or 0)
|
local txt
|
||||||
|
if needed > 1 then
|
||||||
|
txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
else
|
||||||
|
txt = string.format("%s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
end
|
||||||
if cargoObj.Location then txt = txt.."[R]" end
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
local stock = cargoObj:GetStock()
|
local stock = cargoObj:GetStock()
|
||||||
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
@@ -5175,7 +5213,12 @@ function CTLD:_RefreshF10Menus()
|
|||||||
for _, cargoObj in pairs(self.Cargo_Statics) do
|
for _, cargoObj in pairs(self.Cargo_Statics) do
|
||||||
if not cargoObj.DontShowInMenu then
|
if not cargoObj.DontShowInMenu then
|
||||||
local needed = cargoObj:GetCratesNeeded() or 1
|
local needed = cargoObj:GetCratesNeeded() or 1
|
||||||
local txt = string.format("%d crate%s %s (%dkg)", needed, needed==1 and "" or "s", cargoObj.Name, cargoObj.PerCrateMass or 0)
|
local txt
|
||||||
|
if needed > 1 then
|
||||||
|
txt = string.format("%d crate%s %s (%dkg)",needed,needed==1 and "" or "s",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
else
|
||||||
|
txt = string.format("%s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
end
|
||||||
if cargoObj.Location then txt = txt.."[R]" end
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
local stock = cargoObj:GetStock()
|
local stock = cargoObj:GetStock()
|
||||||
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
if stock >= 0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
@@ -8655,10 +8698,11 @@ do
|
|||||||
-- TODO CTLD_HERCULES
|
-- TODO CTLD_HERCULES
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- This script will only work for the Herculus mod by Anubis, and only for **Air Dropping** cargo from the Hercules.
|
-- This script will only work for the Herculus mod by Anubis, and only for **Air Dropping** cargo from the Hercules.
|
||||||
|
-- It *DOES NOT* work with the purchaseable Hercules module from ED.
|
||||||
-- Use the standard Moose CTLD if you want to unload on the ground.
|
-- Use the standard Moose CTLD if you want to unload on the ground.
|
||||||
-- Payloads carried by pylons 11, 12 and 13 need to be declared in the Herculus_Loadout.lua file
|
-- Payloads carried by pylons 11, 12 and 13 need to be declared in the Herculus_Loadout.lua file
|
||||||
-- Except for Ammo pallets, this script will spawn whatever payload gets launched from pylons 11, 12 and 13
|
-- Except for Ammo pallets, this script will spawn whatever payload gets launched from pylons 11, 12 and 13
|
||||||
-- Pylons 11, 12 and 13 are moveable within the Herculus cargobay area
|
-- Pylons 11, 12 and 13 are moveable within the Hercules cargobay area
|
||||||
-- Ammo pallets can only be jettisoned from these pylons with no benefit to DCS world
|
-- Ammo pallets can only be jettisoned from these pylons with no benefit to DCS world
|
||||||
-- To benefit DCS world, Ammo pallets need to be off/on loaded using DCS arming and refueling window
|
-- To benefit DCS world, Ammo pallets need to be off/on loaded using DCS arming and refueling window
|
||||||
-- Cargo_Container_Enclosed = true: Cargo enclosed in container with parachute, need to be dropped from 100m (300ft) or more, except when parked on ground
|
-- Cargo_Container_Enclosed = true: Cargo enclosed in container with parachute, need to be dropped from 100m (300ft) or more, except when parked on ground
|
||||||
|
|||||||
Reference in New Issue
Block a user