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 max = 18
ctable = CALLSIGN.F15E ctable = CALLSIGN.F15E
end end
if SpawnTemplate.units[1].type == "A6E" then
min = 4
max = 18
ctable = CALLSIGN.Intruder
end
local callsignnr = math.random(min,max) local callsignnr = math.random(min,max)
local callsignname = "Enfield" local callsignname = "Enfield"
for name, value in pairs(ctable) do for name, value in pairs(ctable) do
@@ -334,6 +334,31 @@ function SPAWNSTATIC:InitCargo(IsCargo)
return self return self
end 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. --- Initialize as dead.
-- @param #SPAWNSTATIC self -- @param #SPAWNSTATIC self
-- @param #boolean IsDead If true, this static is dead. -- @param #boolean IsDead If true, this static is dead.
@@ -533,6 +558,19 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
Template.mass=self.InitStaticCargoMass Template.mass=self.InitStaticCargoMass
end 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 if self.InitLinkUnit then
Template.linkUnit=self.InitLinkUnit:GetID() Template.linkUnit=self.InitLinkUnit:GetID()
Template.linkOffset=true Template.linkOffset=true
+1 -1
View File
@@ -340,7 +340,7 @@ function AIRWING:AddSquadron(Squadron)
local NAssets = Squadron.Ngroups * Nunits local NAssets = Squadron.Ngroups * Nunits
local storage = STORAGE:New(airbasename) local storage = STORAGE:New(airbasename)
--self:T(self.lid.."Adding "..typename.." #"..NAssets) --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 local NInStore = storage:GetItemAmount(typename) or 0
if NAssets > NInStore then if NAssets > NInStore then
storage:AddItem(typename,NAssets) storage:AddItem(typename,NAssets)
+55 -3
View File
@@ -25,7 +25,7 @@
-- @module Ops.CTLD -- @module Ops.CTLD
-- @image OPS_CTLD.jpg -- @image OPS_CTLD.jpg
-- Last Update Oct 2025 -- Last Update Dec 2025
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1513,7 +1513,7 @@ CTLD.FixedWingTypes = {
--- CTLD class version. --- CTLD class version.
-- @field #string version -- @field #string version
CTLD.version="1.3.41" CTLD.version="1.3.42"
--- Instantiate a new CTLD. --- Instantiate a new CTLD.
-- @param #CTLD self -- @param #CTLD self
@@ -3256,6 +3256,23 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
return self return self
end 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. --- (Internal) Function to spawn crates in front of the heli.
-- @param #CTLD self -- @param #CTLD self
-- @param Wrapper.Group#GROUP Group -- @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 if not location:IsCoordinateInZone(unitcoord) then
-- no we're not at the right spot -- no we're not at the right spot
self:_SendMessage("The requested cargo is not available in this zone!", 10, false, Group) 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 end
end end
@@ -3341,6 +3358,9 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
return false return false
end end
if not self:CanGetCrates(Group, Unit, Cargo, requestNumber, drop, pack, quiet, suppressGetEvent) then
return false
end
-- spawn crates in front of helicopter -- spawn crates in front of helicopter
local IsHerc = self:IsFixedWing(Unit) -- Herc, Bronco and Hook load from behind local IsHerc = self:IsFixedWing(Unit) -- Herc, Bronco and Hook load from behind
local IsHook = self:IsHook(Unit) -- Herc, Bronco and Hook load from behind local IsHook = self:IsHook(Unit) -- Herc, Bronco and Hook load from behind
@@ -4551,6 +4571,21 @@ function CTLD:_UnloadCrates(Group, Unit)
return self return self
end 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. --- (Internal) Function to build nearby crates.
-- @param #CTLD self -- @param #CTLD self
-- @param Wrapper.Group#GROUP Group -- @param Wrapper.Group#GROUP Group
@@ -4587,6 +4622,11 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop)
local buildables = {} local buildables = {}
local foundbuilds = false local foundbuilds = false
local canbuild = false local canbuild = false
if not self:CanBuildCrates(Group, Unit, crates, number, Engineering, MultiDrop) then
return self
end
if number > 0 then if number > 0 then
-- get dropped crates -- get dropped crates
for _,_crate in pairs(crates) do for _,_crate in pairs(crates) do
@@ -5087,6 +5127,18 @@ function CTLD:_GetAndLoad(Group, Unit, cargoObj, quantity, LoadAnyWay)
count = capacitySets count = capacitySets
end end
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 total = needed * count
local ok = self:_GetCrates(Group, Unit, cargoObj, total, false, false, true, true) local ok = self:_GetCrates(Group, Unit, cargoObj, total, false, false, true, true)
if ok then if ok then
@@ -529,6 +529,7 @@ ENUMS.ReportingName =
Orion = "P-3C", Orion = "P-3C",
Viking = "S-3B", Viking = "S-3B",
Osprey = "V-22", Osprey = "V-22",
Intruder = "A6E",
-- Bomber Rus -- Bomber Rus
Badger = "H6-J", Badger = "H6-J",
Bear_J = "Tu-142", -- also Tu-95 Bear_J = "Tu-142", -- also Tu-95