mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update CTLD.lua
This commit is contained in:
parent
f3af0262df
commit
8c07573f8f
@ -119,6 +119,7 @@ CTLD_CARGO = {
|
|||||||
-- @param #boolean DontShowInMenu Show this item in menu or not (default: false == show it).
|
-- @param #boolean DontShowInMenu Show this item in menu or not (default: false == show it).
|
||||||
-- @param Core.Zone#ZONE Location (optional) Where the cargo is available (one location only).
|
-- @param Core.Zone#ZONE Location (optional) Where the cargo is available (one location only).
|
||||||
-- @return #CTLD_CARGO self
|
-- @return #CTLD_CARGO self
|
||||||
|
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory, DontShowInMenu, Location)
|
||||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory, DontShowInMenu, Location)
|
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory, DontShowInMenu, Location)
|
||||||
-- Inherit everything from BASE class.
|
-- Inherit everything from BASE class.
|
||||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD_CARGO
|
local self=BASE:Inherit(self, BASE:New()) -- #CTLD_CARGO
|
||||||
@ -147,6 +148,7 @@ CTLD_CARGO = {
|
|||||||
Location = ZONE:New(Location)
|
Location = ZONE:New(Location)
|
||||||
end
|
end
|
||||||
self.Location = Location
|
self.Location = Location
|
||||||
|
self.NoMoveToZone = false
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -5460,8 +5462,8 @@ function CTLD:AddCratesCargoNoMove(Name,Templates,Type,NoCrates,PerCrateMass,Sto
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
self.CargoCounter = self.CargoCounter + 1
|
self.CargoCounter = self.CargoCounter + 1
|
||||||
-- Crates are not directly loadable
|
|
||||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
||||||
|
cargo.NoMoveToZone = true
|
||||||
if UnitTypes then
|
if UnitTypes then
|
||||||
cargo:AddUnitTypeName(UnitTypes)
|
cargo:AddUnitTypeName(UnitTypes)
|
||||||
end
|
end
|
||||||
@ -5470,13 +5472,15 @@ function CTLD:AddCratesCargoNoMove(Name,Templates,Type,NoCrates,PerCrateMass,Sto
|
|||||||
cargo:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
cargo:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
||||||
end
|
end
|
||||||
table.insert(self.Cargo_Crates,cargo)
|
table.insert(self.Cargo_Crates,cargo)
|
||||||
if SubCategory and self.usesubcats ~= true then self.usesubcats=true end
|
self.templateToCargoName = self.templateToCargoName or {}
|
||||||
self.nomovetozone_templates = self.nomovetozone_templates or {}
|
|
||||||
if type(Templates)=="table" then
|
if type(Templates)=="table" then
|
||||||
for _,t in pairs(Templates) do self.nomovetozone_templates[t] = true end
|
for _,t in pairs(Templates) do self.templateToCargoName[t] = Name end
|
||||||
else
|
else
|
||||||
self.nomovetozone_templates[Templates] = true
|
self.templateToCargoName[Templates] = Name
|
||||||
end
|
end
|
||||||
|
self.nomovetozone_names = self.nomovetozone_names or {}
|
||||||
|
self.nomovetozone_names[Name] = true
|
||||||
|
if SubCategory and self.usesubcats ~= true then self.usesubcats=true end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -7548,16 +7552,12 @@ end
|
|||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:onafterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
function CTLD:onafterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
if self.movetroopstowpzone then
|
if self.movetroopstowpzone and Vehicle then
|
||||||
local gname = Vehicle and Vehicle:GetName() or nil
|
local cg = self:GetGenericCargoObjectFromGroupName(Vehicle:GetName())
|
||||||
local block = false
|
if not (cg and (cg.NoMoveToZone or (self.nomovetozone_names and self.nomovetozone_names[cg:GetName()]))) then
|
||||||
if gname and self.nomovetozone_templates then
|
self:_MoveGroupToZone(Vehicle)
|
||||||
for t,_ in pairs(self.nomovetozone_templates) do
|
|
||||||
if gname==t or string.sub(gname,1,#t+1)==t.."-" then block = true break end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not block then self:_MoveGroupToZone(Vehicle) end
|
|
||||||
end
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user