Merge remote-tracking branch 'origin/master' into branch

# Conflicts:
#	Moose Development/Moose/Ops/AirWing.lua
This commit is contained in:
Applevangelist
2025-12-29 18:20:01 +01:00
5 changed files with 105 additions and 9 deletions
+5
View File
@@ -3521,6 +3521,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
max = 18
ctable = CALLSIGN.F15E
end
if SpawnTemplate.units[1].type == "A6E" then
min = 4
max = 18
ctable = CALLSIGN.Intruder
end
local callsignnr = math.random(min,max)
local callsignname = "Enfield"
for name, value in pairs(ctable) do
@@ -334,6 +334,31 @@ function SPAWNSTATIC:InitCargo(IsCargo)
return self
end
--- Hide the static on the map view (visible to game master slots!).
-- @param #SPAWN self
-- @param #boolean OnOff Defaults to true
-- @return #SPAWN The SPAWN object
function SPAWNSTATIC:InitHiddenOnMap(OnOff)
self.SpawnHiddenOnMap = OnOff == false and false or true
return self
end
--- Hide the static on MFDs (visible to game master slots!).
-- @param #SPAWN self
-- @return #SPAWN The SPAWN object
function SPAWNSTATIC:InitHiddenOnMFD()
self.SpawnHiddenOnMFD = true
return self
end
--- Hide the static on planner (visible to game master slots!).
-- @param #SPAWN self
-- @return #SPAWN The SPAWN object
function SPAWNSTATIC:InitHiddenOnPlanner()
self.SpawnHiddenOnPlanner = true
return self
end
--- Initialize as dead.
-- @param #SPAWNSTATIC self
-- @param #boolean IsDead If true, this static is dead.
@@ -533,6 +558,19 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
Template.mass=self.InitStaticCargoMass
end
-- hiding options
if self.SpawnHiddenOnPlanner then
Template.hiddenOnPlanner=true
end
if self.SpawnHiddenOnMFD then
Template.hiddenOnMFD=true
end
if self.SpawnHiddenOnMap then
Template.hidden=self.SpawnHiddenOnMap
end
if self.InitLinkUnit then
Template.linkUnit=self.InitLinkUnit:GetID()
Template.linkOffset=true
+1 -1
View File
@@ -340,7 +340,7 @@ function AIRWING:AddSquadron(Squadron)
local NAssets = Squadron.Ngroups * Nunits
local storage = STORAGE:New(airbasename)
--self:T(self.lid.."Adding "..typename.." #"..NAssets)
if storage and storage:IsLimitedAircraft() and typename ~= "none" then
if storage and storage.warehouse and storage:IsLimitedAircraft() and typename ~= "none" then
local NInStore = storage:GetItemAmount(typename) or 0
if NAssets > NInStore then
storage:AddItem(typename,NAssets)
+60 -8
View File
@@ -25,7 +25,7 @@
-- @module Ops.CTLD
-- @image OPS_CTLD.jpg
-- Last Update Oct 2025
-- Last Update Dec 2025
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1513,7 +1513,7 @@ CTLD.FixedWingTypes = {
--- CTLD class version.
-- @field #string version
CTLD.version="1.3.41"
CTLD.version="1.3.42"
--- Instantiate a new CTLD.
-- @param #CTLD self
@@ -3256,6 +3256,23 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
return self
end
--- (User) Hook to allow mission-specific crate restrictions.
-- Override this in your mission to perform custom checks (e.g. warehouse stock) before crates spawn.
-- Return `true` to allow the request, or `false` to block it. When blocked, `_GetCrates` exits silently.
-- @param #CTLD self
-- @param Wrapper.Group#GROUP Group Requesting player group.
-- @param Wrapper.Unit#UNIT Unit Requesting unit.
-- @param #CTLD_CARGO Cargo Cargo type being requested.
-- @param #number number Number of crates requested (raw quantity, not sets).
-- @param #boolean drop Drop-mode request flag.
-- @param #boolean pack Pack-mode request flag.
-- @param #boolean quiet Quiet flag from menu call.
-- @param #boolean suppressGetEvent If true, `_GetCrates` will not emit the `GetCrates` event.
-- @return #boolean Allow crate spawning.
function CTLD:CanGetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppressGetEvent)
return true
end
--- (Internal) Function to spawn crates in front of the heli.
-- @param #CTLD self
-- @param Wrapper.Group#GROUP Group
@@ -3326,7 +3343,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
if not location:IsCoordinateInZone(unitcoord) then
-- no we're not at the right spot
self:_SendMessage("The requested cargo is not available in this zone!", 10, false, Group)
if not self.debug then return self end
if not self.debug then return false end
end
end
end
@@ -3341,6 +3358,9 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
return false
end
if not self:CanGetCrates(Group, Unit, Cargo, requestNumber, drop, pack, quiet, suppressGetEvent) then
return false
end
-- spawn crates in front of helicopter
local IsHerc = self:IsFixedWing(Unit) -- Herc, Bronco and Hook load from behind
local IsHook = self:IsHook(Unit) -- Herc, Bronco and Hook load from behind
@@ -4118,16 +4138,16 @@ function CTLD:_ListCargo(Group, Unit)
report:Add(" N O N E")
end
if hercInnerCount > 0 then
local hercMass = 0
local hercMass = 0
for _,_cargo in pairs(hercInnerCrates or {}) do
local cargo = _cargo
local type = cargo:GetType()
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS then
report:Add(string.format("Crate: %s size 1",cargo:GetName()))
hercMass = hercMass + cargo:GetMass()
hercMass = hercMass + cargo:GetMass()
end
end
loadedmass = loadedmass + hercMass
loadedmass = loadedmass + hercMass
end
--[[
if loadedno > 0 then
@@ -4551,6 +4571,21 @@ function CTLD:_UnloadCrates(Group, Unit)
return self
end
--- (User) Hook to allow mission-specific build restrictions.
-- Override this in your mission to perform custom checks (e.g. warehouse/credits rules) before crates are built.
-- Return `true` to allow the build, or `false` to block it. When blocked, `_BuildCrates` exits silently.
-- @param #CTLD self
-- @param Wrapper.Group#GROUP Group Requesting player group.
-- @param Wrapper.Unit#UNIT Unit Requesting unit.
-- @param #table crates Table of nearby crate cargo objects returned by `_FindCratesNearby`.
-- @param #number number Number of nearby crates.
-- @param #boolean Engineering If true build is by an engineering team.
-- @param #boolean MultiDrop If true and not engineering or FOB, vary position a bit.
-- @return #boolean Allow building.
function CTLD:CanBuildCrates(Group, Unit, crates, number, Engineering, MultiDrop)
return true
end
--- (Internal) Function to build nearby crates.
-- @param #CTLD self
-- @param Wrapper.Group#GROUP Group
@@ -4587,6 +4622,11 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop)
local buildables = {}
local foundbuilds = false
local canbuild = false
if not self:CanBuildCrates(Group, Unit, crates, number, Engineering, MultiDrop) then
return self
end
if number > 0 then
-- get dropped crates
for _,_crate in pairs(crates) do
@@ -5087,6 +5127,18 @@ function CTLD:_GetAndLoad(Group, Unit, cargoObj, quantity, LoadAnyWay)
count = capacitySets
end
end
local inzone = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
if not inzone then
local ship = nil
local width = 20
local distance = nil
local zone = nil
inzone, ship, zone, distance, width = self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP)
end
if not inzone then
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
return self
end
local total = needed * count
local ok = self:_GetCrates(Group, Unit, cargoObj, total, false, false, true, true)
if ok then
@@ -5577,8 +5629,8 @@ function CTLD:_RefreshF10Menus()
if self.usesubcats then
local subcatmenus = {}
for _,cargoObj in pairs(self.Cargo_Crates) do
addCrateMenuEntry(cargoObj,cratesmenu,subcatmenus)
@@ -529,6 +529,7 @@ ENUMS.ReportingName =
Orion = "P-3C",
Viking = "S-3B",
Osprey = "V-22",
Intruder = "A6E",
-- Bomber Rus
Badger = "H6-J",
Bear_J = "Tu-142", -- also Tu-95