mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#CTLD - Added option to inject cargo objects which will not show up in the menu - for inject and move around purposes.
This commit is contained in:
parent
c85f575888
commit
1f9725530f
@ -2997,7 +2997,7 @@ do -- SET_UNIT
|
||||
local velocity = self:GetVelocity() or 0
|
||||
Coordinate:SetHeading( heading )
|
||||
Coordinate:SetVelocity( velocity )
|
||||
self:I(UTILS.PrintTableToLog(Coordinate))
|
||||
self:T(UTILS.PrintTableToLog(Coordinate))
|
||||
end
|
||||
|
||||
return Coordinate
|
||||
@ -4521,7 +4521,7 @@ do -- SET_CLIENT
|
||||
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
-- CA Slot entered
|
||||
local ObjectName, Object = self:AddInDatabase( Event )
|
||||
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||
self:T( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||
if Object and self:IsIncludeObject( Object ) then
|
||||
self:Add( ObjectName, Object )
|
||||
end
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
-- @module Ops.CTLD
|
||||
-- @image OPS_CTLD.jpg
|
||||
|
||||
-- Last Update December 2023
|
||||
-- Last Update February 2024
|
||||
|
||||
do
|
||||
|
||||
@ -44,6 +44,7 @@ do
|
||||
-- @field #number PerCrateMass Mass in kg.
|
||||
-- @field #number Stock Number of builds available, -1 for unlimited.
|
||||
-- @field #string Subcategory Sub-category name.
|
||||
-- @field #boolean DontShowInMenu Show this item in menu or not.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
@ -62,6 +63,7 @@ CTLD_CARGO = {
|
||||
PerCrateMass = 0,
|
||||
Stock = nil,
|
||||
Mark = nil,
|
||||
DontShowInMenu = false,
|
||||
}
|
||||
|
||||
--- Define cargo types.
|
||||
@ -97,8 +99,9 @@ CTLD_CARGO = {
|
||||
-- @param #number PerCrateMass Mass in kg
|
||||
-- @param #number Stock Number of builds available, nil for unlimited
|
||||
-- @param #string Subcategory Name of subcategory, handy if using > 10 types to load.
|
||||
-- @param #boolean DontShowInMenu Show this item in menu or not (default: false == show it).
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory)
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory,DontShowInMenu)
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD_CARGO
|
||||
self:T({ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped})
|
||||
@ -115,6 +118,7 @@ CTLD_CARGO = {
|
||||
self.Stock = Stock or nil --#number
|
||||
self.Mark = nil
|
||||
self.Subcategory = Subcategory or "Other"
|
||||
self.DontShowInMenu = DontShowInMenu or false
|
||||
return self
|
||||
end
|
||||
|
||||
@ -1228,7 +1232,7 @@ CTLD.UnitTypeCapabilities = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.0.45"
|
||||
CTLD.version="1.0.46"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@ -1433,7 +1437,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
--- Triggers the FSM event "Start". Starts the CTLD. Initializes parameters and starts event handlers.
|
||||
--- Triggers the FSM event "Start". Starts the CTLD. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#CTLD] Start
|
||||
-- @param #CTLD self
|
||||
|
||||
@ -3024,7 +3028,7 @@ end
|
||||
function CTLD:_GetUnitPositions(Coordinate,Radius,Heading,Template)
|
||||
local Positions = {}
|
||||
local template = _DATABASE:GetGroupTemplate(Template)
|
||||
UTILS.PrintTableToLog(template)
|
||||
--UTILS.PrintTableToLog(template)
|
||||
local numbertroops = #template.units
|
||||
local newcenter = Coordinate:Translate(Radius,((Heading+270)%360))
|
||||
for i=1,360,math.floor(360/numbertroops) do
|
||||
@ -3038,7 +3042,7 @@ function CTLD:_GetUnitPositions(Coordinate,Radius,Heading,Template)
|
||||
}
|
||||
table.insert(Positions,p1t)
|
||||
end
|
||||
UTILS.PrintTableToLog(Positions)
|
||||
--UTILS.PrintTableToLog(Positions)
|
||||
return Positions
|
||||
end
|
||||
|
||||
@ -3700,14 +3704,20 @@ function CTLD:_RefreshF10Menus()
|
||||
for _,_entry in pairs(self.Cargo_Troops) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
else
|
||||
for _,_entry in pairs(self.Cargo_Troops) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
local unloadmenu1 = MENU_GROUP_COMMAND:New(_group,"Drop troops",toptroops, self._UnloadTroops, self, _group, _unit):Refresh()
|
||||
@ -3728,33 +3738,45 @@ function CTLD:_RefreshF10Menus()
|
||||
for _,_entry in pairs(self.Cargo_Crates) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
for _,_entry in pairs(self.Cargo_Statics) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
else
|
||||
for _,_entry in pairs(self.Cargo_Crates) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
for _,_entry in pairs(self.Cargo_Statics) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
listmenu = MENU_GROUP_COMMAND:New(_group,"List crates nearby",topcrates, self._ListCratesNearby, self, _group, _unit)
|
||||
removecrates = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||
local removecrates = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||
local unloadmenu = MENU_GROUP_COMMAND:New(_group,"Drop crates",topcrates, self._UnloadCrates, self, _group, _unit)
|
||||
if not self.nobuildmenu then
|
||||
local buildmenu = MENU_GROUP_COMMAND:New(_group,"Build crates",topcrates, self._BuildCrates, self, _group, _unit)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user