mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
902f6dae11
@ -1351,7 +1351,7 @@ CTLD.UnitTypeCapabilities = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.1.21"
|
||||
CTLD.version="1.1.22"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@ -2686,27 +2686,6 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
||||
row = 1
|
||||
startpos:Translate(6,heading,nil,true)
|
||||
end
|
||||
--[[
|
||||
local initialSpacing = IsHerc and 16 or (capabilities.length+2) -- initial spacing of the first crates
|
||||
local crateSpacing = 4 -- further spacing of remaining crates
|
||||
local lateralSpacing = 4 -- lateral spacing of crates
|
||||
local nrSideBySideCrates = 4 -- number of crates that are placed side-by-side
|
||||
|
||||
if cratesneeded == 1 then
|
||||
-- single crate needed spawns straight ahead
|
||||
cratedistance = initialSpacing
|
||||
rheading = math.fmod((heading + addon), 360)
|
||||
else
|
||||
--if (i - 1) % nrSideBySideCrates == 0 then
|
||||
cratedistance = i == 1 and initialSpacing or (cratedistance + crateSpacing)
|
||||
angleOffNose = math.ceil(math.deg(math.atan(lateralSpacing / cratedistance)))
|
||||
self:I("angleOffNose = "..angleOffNose)
|
||||
rheading = heading + addon - angleOffNose
|
||||
--else
|
||||
-- rheading = heading + addon + angleOffNose
|
||||
--end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
--local cratevec2 = cratecoord:GetVec2()
|
||||
@ -4277,7 +4256,7 @@ end
|
||||
-- @param #number PerTroopMass Mass in kg of each soldier
|
||||
-- @param #number Stock Number of groups in stock. Nil for unlimited.
|
||||
-- @param #string SubCategory Name of sub-category (optional).
|
||||
function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock,SubCategory)
|
||||
function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock,SubCategory)
|
||||
self:T(self.lid .. " AddTroopsCargo")
|
||||
self:T({Name,Templates,Type,NoTroops,PerTroopMass,Stock})
|
||||
if not self:_CheckTemplates(Templates) then
|
||||
@ -4288,6 +4267,7 @@ function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock,Sub
|
||||
-- Troops are directly loadable
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,true,NoTroops,nil,nil,PerTroopMass,Stock, SubCategory)
|
||||
table.insert(self.Cargo_Troops,cargo)
|
||||
if SubCategory and self.usesubcats ~= true then self.usesubcats=true end
|
||||
return self
|
||||
end
|
||||
|
||||
@ -4324,6 +4304,7 @@ function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,Sub
|
||||
cargo:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
||||
end
|
||||
table.insert(self.Cargo_Crates,cargo)
|
||||
if SubCategory and self.usesubcats ~= true then self.usesubcats=true end
|
||||
return self
|
||||
end
|
||||
|
||||
@ -4350,6 +4331,7 @@ function CTLD:AddStaticsCargo(Name,Mass,Stock,SubCategory,DontShowInMenu,Locatio
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,template,type,false,false,1,nil,nil,Mass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
cargo:SetStaticResourceMap(ResourceMap)
|
||||
table.insert(self.Cargo_Statics,cargo)
|
||||
if SubCategory and self.usesubcats ~= true then self.usesubcats=true end
|
||||
return cargo
|
||||
end
|
||||
|
||||
@ -6127,7 +6109,7 @@ end
|
||||
|
||||
local statics = nil
|
||||
local statics = {}
|
||||
self:T(self.lid.."Bulding Statics Table for Saving")
|
||||
self:T(self.lid.."Building Statics Table for Saving")
|
||||
for _,_cargo in pairs (stcstable) do
|
||||
local cargo = _cargo -- #CTLD_CARGO
|
||||
local object = cargo:GetPositionable() -- Wrapper.Static#STATIC
|
||||
@ -6162,7 +6144,7 @@ end
|
||||
|
||||
|
||||
--local data = "LoadedData = {\n"
|
||||
local data = "Group,x,y,z,CargoName,CargoTemplates,CargoType,CratesNeeded,CrateMass,Structure\n"
|
||||
local data = "Group,x,y,z,CargoName,CargoTemplates,CargoType,CratesNeeded,CrateMass,Structure,StaticCategory,StaticType,StaticShape\n"
|
||||
local n = 0
|
||||
for _,_grp in pairs(grouptable) do
|
||||
local group = _grp -- Wrapper.Group#GROUP
|
||||
@ -6189,6 +6171,7 @@ end
|
||||
local cgotype = cargo.CargoType
|
||||
local cgoneed = cargo.CratesNeeded
|
||||
local cgomass = cargo.PerCrateMass
|
||||
local scat,stype,sshape = cargo:GetStaticTypeAndShape()
|
||||
local structure = UTILS.GetCountPerTypeName(group)
|
||||
local strucdata = ""
|
||||
for typen,anzahl in pairs (structure) do
|
||||
@ -6205,8 +6188,8 @@ end
|
||||
end
|
||||
|
||||
local location = group:GetVec3()
|
||||
local txt = string.format("%s,%d,%d,%d,%s,%s,%s,%d,%d,%s\n"
|
||||
,template,location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass,strucdata)
|
||||
local txt = string.format("%s,%d,%d,%d,%s,%s,%s,%d,%d,%s,%s,%s,%s\n"
|
||||
,template,location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass,strucdata,scat,stype,sshape or "none")
|
||||
data = data .. txt
|
||||
end
|
||||
end
|
||||
@ -6231,8 +6214,9 @@ end
|
||||
local cgomass = object.PerCrateMass
|
||||
local crateobj = object.Positionable
|
||||
local location = crateobj:GetVec3()
|
||||
local txt = string.format("%s,%d,%d,%d,%s,%s,%s,%d,%d\n"
|
||||
,"STATIC",location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass)
|
||||
local scat,stype,sshape = object:GetStaticTypeAndShape()
|
||||
local txt = string.format("%s,%d,%d,%d,%s,%s,%s,%d,%d,'none',%s,%s,%s\n"
|
||||
,"STATIC",location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass,scat,stype,sshape or "none")
|
||||
data = data .. txt
|
||||
end
|
||||
|
||||
@ -6361,47 +6345,50 @@ end
|
||||
|
||||
for _id,_entry in pairs (loadeddata) do
|
||||
local dataset = UTILS.Split(_entry,",")
|
||||
-- 1=Group,2=x,3=y,4=z,5=CargoName,6=CargoTemplates,7=CargoType,8=CratesNeeded,9=CrateMass,10=Structure
|
||||
-- 1=Group,2=x,3=y,4=z,5=CargoName,6=CargoTemplates,7=CargoType,8=CratesNeeded,9=CrateMass,10=Structure,11=StaticCategory,12=StaticType,13=StaticShape
|
||||
local groupname = dataset[1]
|
||||
local vec2 = {}
|
||||
vec2.x = tonumber(dataset[2])
|
||||
vec2.y = tonumber(dataset[4])
|
||||
local cargoname = dataset[5]
|
||||
local cargotemplates = dataset[6]
|
||||
local cargotype = dataset[7]
|
||||
local size = tonumber(dataset[8])
|
||||
local mass = tonumber(dataset[9])
|
||||
local StaticCategory = dataset[11]
|
||||
local StaticType = dataset[12]
|
||||
local StaticShape = dataset[13]
|
||||
if type(groupname) == "string" and groupname ~= "STATIC" then
|
||||
local cargotemplates = dataset[6]
|
||||
cargotemplates = string.gsub(cargotemplates,"{","")
|
||||
cargotemplates = string.gsub(cargotemplates,"}","")
|
||||
cargotemplates = UTILS.Split(cargotemplates,";")
|
||||
local size = tonumber(dataset[8])
|
||||
local mass = tonumber(dataset[9])
|
||||
local structure = nil
|
||||
if dataset[10] then
|
||||
if dataset[10] and dataset[10] ~= "none" then
|
||||
structure = dataset[10]
|
||||
structure = string.gsub(structure,",","")
|
||||
end
|
||||
-- inject at Vec2
|
||||
local dropzone = ZONE_RADIUS:New("DropZone",vec2,20)
|
||||
if cargotype == CTLD_CARGO.Enum.VEHICLE or cargotype == CTLD_CARGO.Enum.FOB then
|
||||
local injectvehicle = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
local injectvehicle = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
injectvehicle:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape)
|
||||
self:InjectVehicles(dropzone,injectvehicle,self.surfacetypes,self.useprecisecoordloads,structure)
|
||||
elseif cargotype == CTLD_CARGO.Enum.TROOPS or cargotype == CTLD_CARGO.Enum.ENGINEERS then
|
||||
local injecttroops = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
self:InjectTroops(dropzone,injecttroops,self.surfacetypes,self.useprecisecoordloads,structure)
|
||||
end
|
||||
elseif (type(groupname) == "string" and groupname == "STATIC") or cargotype == CTLD_CARGO.Enum.REPAIR then
|
||||
local cargotemplates = dataset[6]
|
||||
local size = tonumber(dataset[8])
|
||||
local mass = tonumber(dataset[9])
|
||||
local dropzone = ZONE_RADIUS:New("DropZone",vec2,20)
|
||||
local injectstatic = nil
|
||||
if cargotype == CTLD_CARGO.Enum.VEHICLE or cargotype == CTLD_CARGO.Enum.FOB then
|
||||
cargotemplates = string.gsub(cargotemplates,"{","")
|
||||
cargotemplates = string.gsub(cargotemplates,"}","")
|
||||
cargotemplates = UTILS.Split(cargotemplates,";")
|
||||
injectstatic = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
injectstatic = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape)
|
||||
elseif cargotype == CTLD_CARGO.Enum.STATIC or cargotype == CTLD_CARGO.Enum.REPAIR then
|
||||
injectstatic = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||
injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape)
|
||||
local map=cargotype:GetStaticResourceMap()
|
||||
injectstatic:SetStaticResourceMap(map)
|
||||
end
|
||||
|
||||
@ -997,6 +997,8 @@ function RECOVERYTANKER:onafterStart(From, Event, To)
|
||||
|
||||
-- Init status updates in 10 seconds.
|
||||
self:__Status(10)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -963,6 +963,8 @@ function RESCUEHELO:onafterStart(From, Event, To)
|
||||
|
||||
-- Init status check
|
||||
self:__Status(1)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- On after Status event. Checks player status.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user