mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#CTLD - If troops or vehicles have a stock set, you can only inject as many as there are in stock. Specifically, when using persistence, the load function will restrict to inject more objects than are in stock, each inject draws on the stock.
This commit is contained in:
@@ -1352,7 +1352,7 @@ CTLD.UnitTypeCapabilities = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.1.23"
|
CTLD.version="1.1.24"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -5512,14 +5512,18 @@ end
|
|||||||
local match = false
|
local match = false
|
||||||
local cgotbl = self.Cargo_Troops
|
local cgotbl = self.Cargo_Troops
|
||||||
local name = cargo:GetName()
|
local name = cargo:GetName()
|
||||||
|
local CargoObject
|
||||||
|
local CargoName
|
||||||
for _,_cgo in pairs (cgotbl) do
|
for _,_cgo in pairs (cgotbl) do
|
||||||
local cname = _cgo:GetName()
|
local cname = _cgo:GetName()
|
||||||
if name == cname then
|
if name == cname then
|
||||||
match = true
|
match = true
|
||||||
|
CargoObject = _cgo
|
||||||
|
CargoName = cname
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return match
|
return match, CargoObject, CargoName
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Cruncher(group,typename,anzahl)
|
local function Cruncher(group,typename,anzahl)
|
||||||
@@ -5565,11 +5569,24 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not IsTroopsMatch(cargo) then
|
local match,CargoObject,CargoName = IsTroopsMatch(cargo)
|
||||||
|
|
||||||
|
if not match then
|
||||||
self.CargoCounter = self.CargoCounter + 1
|
self.CargoCounter = self.CargoCounter + 1
|
||||||
cargo.ID = self.CargoCounter
|
cargo.ID = self.CargoCounter
|
||||||
cargo.Stock = 1
|
cargo.Stock = 1
|
||||||
table.insert(self.Cargo_Troops,cargo)
|
table.insert(self.Cargo_Crates,cargo)
|
||||||
|
end
|
||||||
|
|
||||||
|
if match and CargoObject then
|
||||||
|
local stock = CargoObject:GetStock()
|
||||||
|
if stock ~= -1 and stock ~= nil and stock == 0 then
|
||||||
|
-- stock empty
|
||||||
|
self:T(self.lid.."Stock of "..CargoName.." is empty. Cannot inject.")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
CargoObject:RemoveStock(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
||||||
@@ -5637,14 +5654,18 @@ end
|
|||||||
local match = false
|
local match = false
|
||||||
local cgotbl = self.Cargo_Crates
|
local cgotbl = self.Cargo_Crates
|
||||||
local name = cargo:GetName()
|
local name = cargo:GetName()
|
||||||
|
local CargoObject
|
||||||
|
local CargoName
|
||||||
for _,_cgo in pairs (cgotbl) do
|
for _,_cgo in pairs (cgotbl) do
|
||||||
local cname = _cgo:GetName()
|
local cname = _cgo:GetName()
|
||||||
if name == cname then
|
if name == cname then
|
||||||
match = true
|
match = true
|
||||||
|
CargoObject = _cgo
|
||||||
|
CargoName = cname
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return match
|
return match,CargoObject,CargoName
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Cruncher(group,typename,anzahl)
|
local function Cruncher(group,typename,anzahl)
|
||||||
@@ -5690,13 +5711,26 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not IsVehicMatch(cargo) then
|
local match,CargoObject,CargoName = IsVehicMatch(cargo)
|
||||||
|
|
||||||
|
if not match then
|
||||||
self.CargoCounter = self.CargoCounter + 1
|
self.CargoCounter = self.CargoCounter + 1
|
||||||
cargo.ID = self.CargoCounter
|
cargo.ID = self.CargoCounter
|
||||||
cargo.Stock = 1
|
cargo.Stock = 1
|
||||||
table.insert(self.Cargo_Crates,cargo)
|
table.insert(self.Cargo_Crates,cargo)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if match and CargoObject then
|
||||||
|
local stock = CargoObject:GetStock()
|
||||||
|
if stock ~= -1 and stock ~= nil and stock == 0 then
|
||||||
|
-- stock empty
|
||||||
|
self:T(self.lid.."Stock of "..CargoName.." is empty. Cannot inject.")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
CargoObject:RemoveStock(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
||||||
if (type == CTLD_CARGO.Enum.VEHICLE or type == CTLD_CARGO.Enum.FOB) then
|
if (type == CTLD_CARGO.Enum.VEHICLE or type == CTLD_CARGO.Enum.FOB) then
|
||||||
-- unload
|
-- unload
|
||||||
|
|||||||
Reference in New Issue
Block a user