mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 11:40:57 +00:00
CTLD - make container shape configureable
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
-- @module Ops.CTLD
|
-- @module Ops.CTLD
|
||||||
-- @image OPS_CTLD.jpg
|
-- @image OPS_CTLD.jpg
|
||||||
|
|
||||||
-- Date: Dec 2021
|
-- Date: Jan 2022
|
||||||
|
|
||||||
do
|
do
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
@@ -318,8 +318,7 @@ do
|
|||||||
ClassName = "CTLD_CARGO",
|
ClassName = "CTLD_CARGO",
|
||||||
ID = 0,
|
ID = 0,
|
||||||
Name = "none",
|
Name = "none",
|
||||||
Templates = {
|
Templates = {},
|
||||||
},
|
|
||||||
CargoType = "none",
|
CargoType = "none",
|
||||||
HasBeenMoved = false,
|
HasBeenMoved = false,
|
||||||
LoadDirectly = false,
|
LoadDirectly = false,
|
||||||
@@ -349,7 +348,7 @@ do
|
|||||||
-- @param #number ID ID of this #CTLD_CARGO
|
-- @param #number ID ID of this #CTLD_CARGO
|
||||||
-- @param #string Name Name for menu.
|
-- @param #string Name Name for menu.
|
||||||
-- @param #table Templates Table of #POSITIONABLE objects.
|
-- @param #table Templates Table of #POSITIONABLE objects.
|
||||||
-- @param #CTLD_CARGO.Enum SortEnum Enumerator of Type.
|
-- @param #CTLD_CARGO.Enum Sorte Enumerator of Type.
|
||||||
-- @param #boolean HasBeenMoved Flag for moving.
|
-- @param #boolean HasBeenMoved Flag for moving.
|
||||||
-- @param #boolean LoadDirectly Flag for direct loading.
|
-- @param #boolean LoadDirectly Flag for direct loading.
|
||||||
-- @param #number CratesNeeded Crates needed to build.
|
-- @param #number CratesNeeded Crates needed to build.
|
||||||
@@ -358,14 +357,14 @@ do
|
|||||||
-- @param #number PerCrateMass Mass in kg
|
-- @param #number PerCrateMass Mass in kg
|
||||||
-- @param #number Stock Number of builds available, nil for unlimited
|
-- @param #number Stock Number of builds available, nil for unlimited
|
||||||
-- @return #CTLD_CARGO self
|
-- @return #CTLD_CARGO self
|
||||||
function CTLD_CARGO:New( ID, Name, Templates, SortEnum, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock )
|
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock)
|
||||||
-- Inherit everything from BASE class.
|
-- Inherit everything from BASE class.
|
||||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD
|
local self=BASE:Inherit(self, BASE:New()) -- #CTLD
|
||||||
self:T( { ID, Name, Templates, SortEnum, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped } )
|
self:T({ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped})
|
||||||
self.ID = ID or math.random(100000,1000000)
|
self.ID = ID or math.random(100000,1000000)
|
||||||
self.Name = Name or "none" -- #string
|
self.Name = Name or "none" -- #string
|
||||||
self.Templates = Templates or {} -- #table
|
self.Templates = Templates or {} -- #table
|
||||||
self.CargoType = SortEnum or "type" -- #CTLD_CARGO.Enum
|
self.CargoType = Sorte or "type" -- #CTLD_CARGO.Enum
|
||||||
self.HasBeenMoved = HasBeenMoved or false -- #boolean
|
self.HasBeenMoved = HasBeenMoved or false -- #boolean
|
||||||
self.LoadDirectly = LoadDirectly or false -- #boolean
|
self.LoadDirectly = LoadDirectly or false -- #boolean
|
||||||
self.CratesNeeded = CratesNeeded or 0 -- #number
|
self.CratesNeeded = CratesNeeded or 0 -- #number
|
||||||
@@ -502,9 +501,7 @@ do
|
|||||||
if self.Stock then -- Stock nil?
|
if self.Stock then -- Stock nil?
|
||||||
local number = Number or 1
|
local number = Number or 1
|
||||||
self.Stock = self.Stock - number
|
self.Stock = self.Stock - number
|
||||||
if self.Stock < 0 then
|
if self.Stock < 0 then self.Stock = 0 end
|
||||||
self.Stock = 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -557,7 +554,7 @@ do
|
|||||||
-- @field #number coalition Coalition side number, e.g. `coalition.side.RED`.
|
-- @field #number coalition Coalition side number, e.g. `coalition.side.RED`.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Combat Troop & Logistics Deployment (CTLD): Everyone wants to be a POG, until there's POG stuff to be done.* (Mil Saying)
|
--- *Combat Troop & Logistics Deployment (CTLD): Everyone wants to be a POG, until there\'s POG stuff to be done.* (Mil Saying)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -566,7 +563,7 @@ do
|
|||||||
-- # CTLD Concept
|
-- # CTLD Concept
|
||||||
--
|
--
|
||||||
-- * MOOSE-based CTLD for Players.
|
-- * MOOSE-based CTLD for Players.
|
||||||
-- * Object oriented refactoring of Ciribob's fantastic CTLD script.
|
-- * Object oriented refactoring of Ciribob\'s fantastic CTLD script.
|
||||||
-- * No need for extra MIST loading.
|
-- * No need for extra MIST loading.
|
||||||
-- * Additional events to tailor your mission.
|
-- * Additional events to tailor your mission.
|
||||||
-- * ANY late activated group can serve as cargo, either as troops, crates, which have to be build on-location, or static like ammo chests.
|
-- * ANY late activated group can serve as cargo, either as troops, crates, which have to be build on-location, or static like ammo chests.
|
||||||
@@ -574,7 +571,7 @@ do
|
|||||||
--
|
--
|
||||||
-- ## 0. Prerequisites
|
-- ## 0. Prerequisites
|
||||||
--
|
--
|
||||||
-- You need to load an .ogg sound file for the pilot's beacons into the mission, e.g. "beacon.ogg", use a once trigger, "sound to country" for that.
|
-- You need to load an .ogg soundfile for the pilot\'s beacons into the mission, e.g. "beacon.ogg", use a once trigger, "sound to country" for that.
|
||||||
-- Create the late-activated troops, vehicles (no statics at this point!) that will make up your deployable forces.
|
-- Create the late-activated troops, vehicles (no statics at this point!) that will make up your deployable forces.
|
||||||
--
|
--
|
||||||
-- ## 1. Basic Setup
|
-- ## 1. Basic Setup
|
||||||
@@ -601,7 +598,7 @@ do
|
|||||||
-- my_ctld:AddTroopsCargo("Anti-Air",{"AA","AA2"},CTLD_CARGO.Enum.TROOPS,4,nil,2)
|
-- my_ctld:AddTroopsCargo("Anti-Air",{"AA","AA2"},CTLD_CARGO.Enum.TROOPS,4,nil,2)
|
||||||
--
|
--
|
||||||
-- -- add an engineers unit called "Wrenches" using template "Engineers", of type ENGINEERS with size 2. Engineers can be loaded, dropped,
|
-- -- add an engineers unit called "Wrenches" using template "Engineers", of type ENGINEERS with size 2. Engineers can be loaded, dropped,
|
||||||
-- -- and extracted like troops. However, they will seek to build and/or repair crates found in a given radius. Handy if you can't stay
|
-- -- and extracted like troops. However, they will seek to build and/or repair crates found in a given radius. Handy if you can\'t stay
|
||||||
-- -- to build or repair or under fire.
|
-- -- to build or repair or under fire.
|
||||||
-- my_ctld:AddTroopsCargo("Wrenches",{"Engineers"},CTLD_CARGO.Enum.ENGINEERS,4)
|
-- my_ctld:AddTroopsCargo("Wrenches",{"Engineers"},CTLD_CARGO.Enum.ENGINEERS,4)
|
||||||
-- myctld.EngineerSearch = 2000 -- teams will search for crates in this radius.
|
-- myctld.EngineerSearch = 2000 -- teams will search for crates in this radius.
|
||||||
@@ -622,7 +619,7 @@ do
|
|||||||
-- my_ctld.repairtime = 300 -- takes 300 seconds to repair something
|
-- my_ctld.repairtime = 300 -- takes 300 seconds to repair something
|
||||||
--
|
--
|
||||||
-- -- add static cargo objects, e.g ammo chests - the name needs to refer to a STATIC object in the mission editor,
|
-- -- add static cargo objects, e.g ammo chests - the name needs to refer to a STATIC object in the mission editor,
|
||||||
-- -- here: it's the UNIT name (not the GROUP name!), the second parameter is the weight in kg.
|
-- -- here: it\'s the UNIT name (not the GROUP name!), the second parameter is the weight in kg.
|
||||||
-- my_ctld:AddStaticsCargo("Ammunition",500)
|
-- my_ctld:AddStaticsCargo("Ammunition",500)
|
||||||
--
|
--
|
||||||
-- ## 1.3 Add logistics zones
|
-- ## 1.3 Add logistics zones
|
||||||
@@ -675,6 +672,7 @@ do
|
|||||||
-- my_ctld.pilotmustopendoors = false -- force opening of doors
|
-- my_ctld.pilotmustopendoors = false -- force opening of doors
|
||||||
-- my_ctld.SmokeColor = SMOKECOLOR.Red -- color to use when dropping smoke from heli
|
-- my_ctld.SmokeColor = SMOKECOLOR.Red -- color to use when dropping smoke from heli
|
||||||
-- my_ctld.FlareColor = FLARECOLOR.Red -- color to use when flaring from heli
|
-- my_ctld.FlareColor = FLARECOLOR.Red -- color to use when flaring from heli
|
||||||
|
-- my_ctld.basetype = "container_cargo" -- default shape of the cargo container
|
||||||
--
|
--
|
||||||
-- ## 2.1 User functions
|
-- ## 2.1 User functions
|
||||||
--
|
--
|
||||||
@@ -699,6 +697,7 @@ do
|
|||||||
-- ["Mi-24V"] = {type="Mi-24V", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
-- ["Mi-24V"] = {type="Mi-24V", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
||||||
-- ["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25},
|
-- ["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25},
|
||||||
--
|
--
|
||||||
|
--
|
||||||
-- ### 2.1.2 Activate and deactivate zones
|
-- ### 2.1.2 Activate and deactivate zones
|
||||||
--
|
--
|
||||||
-- Activate a zone:
|
-- Activate a zone:
|
||||||
@@ -986,12 +985,13 @@ do
|
|||||||
["Ka-50"] = {type="Ka-50", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 15},
|
["Ka-50"] = {type="Ka-50", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 15},
|
||||||
["Mi-24P"] = {type="Mi-24P", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
["Mi-24P"] = {type="Mi-24P", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
||||||
["Mi-24V"] = {type="Mi-24V", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
["Mi-24V"] = {type="Mi-24V", crates=true, troops=true, cratelimit = 2, trooplimit = 8, length = 18},
|
||||||
["Hercules"] = { type = "Hercules", crates = true, troops = true, cratelimit = 7, trooplimit = 64, length = 25 }, -- 19t cargo, 64 paratroopers. Actually it's longer, but the center coord is off-center of the model.
|
["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25}, -- 19t cargo, 64 paratroopers.
|
||||||
|
--Actually it's longer, but the center coord is off-center of the model.
|
||||||
}
|
}
|
||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version = "1.0.1"
|
CTLD.version="1.0.2"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -1156,6 +1156,7 @@ do
|
|||||||
|
|
||||||
-- slingload
|
-- slingload
|
||||||
self.enableslingload = false
|
self.enableslingload = false
|
||||||
|
self.basetype = "container_cargo" -- shape of the container
|
||||||
|
|
||||||
-- Smokes and Flares
|
-- Smokes and Flares
|
||||||
self.SmokeColor = SMOKECOLOR.Red
|
self.SmokeColor = SMOKECOLOR.Red
|
||||||
@@ -1350,6 +1351,7 @@ do
|
|||||||
return capabilities
|
return capabilities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- (Internal) Function to generate valid UHF Frequencies
|
--- (Internal) Function to generate valid UHF Frequencies
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
function CTLD:_GenerateUHFrequencies()
|
function CTLD:_GenerateUHFrequencies()
|
||||||
@@ -1454,19 +1456,13 @@ do
|
|||||||
end
|
end
|
||||||
if not inzone then
|
if not inzone then
|
||||||
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
|
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
elseif not grounded and not hoverload then
|
elseif not grounded and not hoverload then
|
||||||
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
elseif self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
elseif self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
self:_SendMessage("You need to open the door(s) to load troops!", 10, false, Group)
|
self:_SendMessage("You need to open the door(s) to load troops!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- load troops into heli
|
-- load troops into heli
|
||||||
local group = Group -- Wrapper.Group#GROUP
|
local group = Group -- Wrapper.Group#GROUP
|
||||||
@@ -1550,9 +1546,7 @@ do
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if type(String) == "string" then
|
if type(String) == "string" then
|
||||||
if string.find( String, Table ) then
|
if string.find(String,Table) then match = true end
|
||||||
match = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return match
|
return match
|
||||||
@@ -1593,9 +1587,7 @@ do
|
|||||||
local NearestGroup, CargoType = self:_FindRepairNearby(Group,Unit,Repairtype) -- Wrapper.Group#GROUP, #CTLD_CARGO
|
local NearestGroup, CargoType = self:_FindRepairNearby(Group,Unit,Repairtype) -- Wrapper.Group#GROUP, #CTLD_CARGO
|
||||||
--self:I({Repairtype=Repairtype, CargoType=CargoType, NearestGroup=NearestGroup})
|
--self:I({Repairtype=Repairtype, CargoType=CargoType, NearestGroup=NearestGroup})
|
||||||
if NearestGroup ~= nil then
|
if NearestGroup ~= nil then
|
||||||
if self.repairtime < 2 then
|
if self.repairtime < 2 then self.repairtime = 30 end -- noob catch
|
||||||
self.repairtime = 30
|
|
||||||
end -- noob catch
|
|
||||||
if not Engineering then
|
if not Engineering then
|
||||||
self:_SendMessage(string.format("Repair started using %s taking %d secs", build.Name, self.repairtime), 10, false, Group)
|
self:_SendMessage(string.format("Repair started using %s taking %d secs", build.Name, self.repairtime), 10, false, Group)
|
||||||
end
|
end
|
||||||
@@ -1613,9 +1605,7 @@ do
|
|||||||
object.CanBuild = true
|
object.CanBuild = true
|
||||||
object.Type = ctype -- #CTLD_CARGO.Enum
|
object.Type = ctype -- #CTLD_CARGO.Enum
|
||||||
self:_CleanUpCrates(Crates,Build,Number)
|
self:_CleanUpCrates(Crates,Build,Number)
|
||||||
local desttimer = TIMER:New( function()
|
local desttimer = TIMER:New(function() NearestGroup:Destroy(false) end, self)
|
||||||
NearestGroup:Destroy( false )
|
|
||||||
end, self )
|
|
||||||
desttimer:Start(self.repairtime - 1)
|
desttimer:Start(self.repairtime - 1)
|
||||||
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,object,true,NearestGroup:GetCoordinate())
|
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,object,true,NearestGroup:GetCoordinate())
|
||||||
buildtimer:Start(self.repairtime)
|
buildtimer:Start(self.repairtime)
|
||||||
@@ -1642,15 +1632,11 @@ do
|
|||||||
|
|
||||||
if not grounded and not hoverload then
|
if not grounded and not hoverload then
|
||||||
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
self:_SendMessage("You need to open the door(s) to extract troops!", 10, false, Group)
|
self:_SendMessage("You need to open the door(s) to extract troops!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- load troops into heli
|
-- load troops into heli
|
||||||
local unit = Unit -- Wrapper.Unit#UNIT
|
local unit = Unit -- Wrapper.Unit#UNIT
|
||||||
@@ -1697,11 +1683,7 @@ do
|
|||||||
local Cargotype = nil
|
local Cargotype = nil
|
||||||
for k,v in pairs(self.Cargo_Troops) do
|
for k,v in pairs(self.Cargo_Troops) do
|
||||||
local comparison = ""
|
local comparison = ""
|
||||||
if type( v.Templates ) == "string" then
|
if type(v.Templates) == "string" then comparison = v.Templates else comparison = v.Templates[1] end
|
||||||
comparison = v.Templates
|
|
||||||
else
|
|
||||||
comparison = v.Templates[1]
|
|
||||||
end
|
|
||||||
if comparison == groupType then
|
if comparison == groupType then
|
||||||
Cargotype = v
|
Cargotype = v
|
||||||
break
|
break
|
||||||
@@ -1771,7 +1753,7 @@ do
|
|||||||
-- @param Wrapper.Unit#UNIT Unit
|
-- @param Wrapper.Unit#UNIT Unit
|
||||||
-- @param #CTLD_CARGO Cargo
|
-- @param #CTLD_CARGO Cargo
|
||||||
-- @param #number number Number of crates to generate (for dropping)
|
-- @param #number number Number of crates to generate (for dropping)
|
||||||
-- @param #boolean drop If true we're dropping from heli rather than loading.
|
-- @param #boolean drop If true we\'re dropping from heli rather than loading.
|
||||||
function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
||||||
self:T(self.lid .. " _GetCrates")
|
self:T(self.lid .. " _GetCrates")
|
||||||
if not drop then
|
if not drop then
|
||||||
@@ -1804,9 +1786,7 @@ do
|
|||||||
|
|
||||||
if not inzone then
|
if not inzone then
|
||||||
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
|
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- avoid crate spam
|
-- avoid crate spam
|
||||||
@@ -1850,9 +1830,7 @@ do
|
|||||||
local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000))
|
local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000))
|
||||||
if not self.placeCratesAhead then
|
if not self.placeCratesAhead then
|
||||||
cratedistance = (i-1)*2.5 + capabilities.length
|
cratedistance = (i-1)*2.5 + capabilities.length
|
||||||
if cratedistance > self.CrateDistance then
|
if cratedistance > self.CrateDistance then cratedistance = self.CrateDistance end
|
||||||
cratedistance = self.CrateDistance
|
|
||||||
end
|
|
||||||
-- altered heading logic
|
-- altered heading logic
|
||||||
-- DONE: right standard deviation?
|
-- DONE: right standard deviation?
|
||||||
rheading = UTILS.RandomGaussian(0,30,-90,90,100)
|
rheading = UTILS.RandomGaussian(0,30,-90,90,100)
|
||||||
@@ -1880,7 +1858,7 @@ do
|
|||||||
local cratecoord = position:Translate(cratedistance,rheading)
|
local cratecoord = position:Translate(cratedistance,rheading)
|
||||||
local cratevec2 = cratecoord:GetVec2()
|
local cratevec2 = cratecoord:GetVec2()
|
||||||
self.CrateCounter = self.CrateCounter + 1
|
self.CrateCounter = self.CrateCounter + 1
|
||||||
local basetype = "container_cargo"
|
local basetype = self.basetype or "container_cargo"
|
||||||
if isstatic then
|
if isstatic then
|
||||||
basetype = cratetemplate
|
basetype = cratetemplate
|
||||||
end
|
end
|
||||||
@@ -1893,7 +1871,8 @@ do
|
|||||||
dist = dist - (20 + math.random(1,10))
|
dist = dist - (20 + math.random(1,10))
|
||||||
local width = width / 2
|
local width = width / 2
|
||||||
local Offy = math.random(-width,width)
|
local Offy = math.random(-width,width)
|
||||||
self.Spawned_Crates[self.CrateCounter] = SPAWNSTATIC:NewFromType( basetype, "Cargos", self.cratecountry ) -- :InitCoordinate(cratecoord)
|
self.Spawned_Crates[self.CrateCounter] = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry)
|
||||||
|
--:InitCoordinate(cratecoord)
|
||||||
:InitCargoMass(cgomass)
|
:InitCargoMass(cgomass)
|
||||||
:InitCargo(self.enableslingload)
|
:InitCargo(self.enableslingload)
|
||||||
:InitLinkToUnit(Ship,dist,Offy,0)
|
:InitLinkToUnit(Ship,dist,Offy,0)
|
||||||
@@ -1902,7 +1881,8 @@ do
|
|||||||
self.Spawned_Crates[self.CrateCounter] = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry)
|
self.Spawned_Crates[self.CrateCounter] = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry)
|
||||||
:InitCoordinate(cratecoord)
|
:InitCoordinate(cratecoord)
|
||||||
:InitCargoMass(cgomass)
|
:InitCargoMass(cgomass)
|
||||||
:InitCargo( self.enableslingload ) -- :InitLinkToUnit(Unit,OffsetX,OffsetY,OffsetAngle)
|
:InitCargo(self.enableslingload)
|
||||||
|
--:InitLinkToUnit(Unit,OffsetX,OffsetY,OffsetAngle)
|
||||||
:Spawn(270,cratealias)
|
:Spawn(270,cratealias)
|
||||||
end
|
end
|
||||||
local templ = cargotype:GetTemplates()
|
local templ = cargotype:GetTemplates()
|
||||||
@@ -1956,7 +1936,7 @@ do
|
|||||||
cratetemplate = cargotype:GetTemplates()
|
cratetemplate = cargotype:GetTemplates()
|
||||||
isstatic = true
|
isstatic = true
|
||||||
end
|
end
|
||||||
local basetype = "container_cargo"
|
local basetype = self.basetype or "container_cargo"
|
||||||
if isstatic then
|
if isstatic then
|
||||||
basetype = cratetemplate
|
basetype = cratetemplate
|
||||||
end
|
end
|
||||||
@@ -2098,7 +2078,7 @@ do
|
|||||||
local grounded = not self:IsUnitInAir(Unit)
|
local grounded = not self:IsUnitInAir(Unit)
|
||||||
local canhoverload = self:CanHoverLoad(Unit)
|
local canhoverload = self:CanHoverLoad(Unit)
|
||||||
--- cases -------------------------------
|
--- cases -------------------------------
|
||||||
-- Chopper can't do crates - bark & return
|
-- Chopper can\'t do crates - bark & return
|
||||||
-- Chopper can do crates -
|
-- Chopper can do crates -
|
||||||
-- --> hover if forcedhover or bark and return
|
-- --> hover if forcedhover or bark and return
|
||||||
-- --> hover or land if not forcedhover
|
-- --> hover or land if not forcedhover
|
||||||
@@ -2418,9 +2398,7 @@ do
|
|||||||
local canunload = true
|
local canunload = true
|
||||||
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
self:_SendMessage("You need to open the door(s) to unload troops!", 10, false, Group)
|
self:_SendMessage("You need to open the door(s) to unload troops!", 10, false, Group)
|
||||||
if not self.debug then
|
if not self.debug then return self end
|
||||||
return self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
|
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
|
||||||
if not inzone then
|
if not inzone then
|
||||||
@@ -2430,13 +2408,13 @@ do
|
|||||||
droppingatbase = true
|
droppingatbase = true
|
||||||
end
|
end
|
||||||
-- check for hover unload
|
-- check for hover unload
|
||||||
local hoverunload = self:IsCorrectHover( Unit ) -- if true we're hovering in parameters
|
local hoverunload = self:IsCorrectHover(Unit) --if true we\'re hovering in parameters
|
||||||
local IsHerc = self:IsHercules(Unit)
|
local IsHerc = self:IsHercules(Unit)
|
||||||
if IsHerc then
|
if IsHerc then
|
||||||
-- no hover but airdrop here
|
-- no hover but airdrop here
|
||||||
hoverunload = self:IsCorrectFlightParameters(Unit)
|
hoverunload = self:IsCorrectFlightParameters(Unit)
|
||||||
end
|
end
|
||||||
-- check if we're landed
|
-- check if we\'re landed
|
||||||
local grounded = not self:IsUnitInAir(Unit)
|
local grounded = not self:IsUnitInAir(Unit)
|
||||||
-- Get what we have loaded
|
-- Get what we have loaded
|
||||||
local unitname = Unit:GetName()
|
local unitname = Unit:GetName()
|
||||||
@@ -2514,9 +2492,7 @@ do
|
|||||||
if _troop.Name == name then
|
if _troop.Name == name then
|
||||||
local stock = _troop:GetStock()
|
local stock = _troop:GetStock()
|
||||||
-- avoid making unlimited stock limited
|
-- avoid making unlimited stock limited
|
||||||
if stock and tonumber( stock ) >= 0 then
|
if stock and tonumber(stock) >= 0 then _troop:AddStock() end
|
||||||
_troop:AddStock()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2553,13 +2529,13 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- check for hover unload
|
-- check for hover unload
|
||||||
local hoverunload = self:IsCorrectHover( Unit ) -- if true we're hovering in parameters
|
local hoverunload = self:IsCorrectHover(Unit) --if true we\'re hovering in parameters
|
||||||
local IsHerc = self:IsHercules(Unit)
|
local IsHerc = self:IsHercules(Unit)
|
||||||
if IsHerc then
|
if IsHerc then
|
||||||
-- no hover but airdrop here
|
-- no hover but airdrop here
|
||||||
hoverunload = self:IsCorrectFlightParameters(Unit)
|
hoverunload = self:IsCorrectFlightParameters(Unit)
|
||||||
end
|
end
|
||||||
-- check if we're landed
|
-- check if we\'re landed
|
||||||
local grounded = not self:IsUnitInAir(Unit)
|
local grounded = not self:IsUnitInAir(Unit)
|
||||||
-- Get what we have loaded
|
-- Get what we have loaded
|
||||||
local unitname = Unit:GetName()
|
local unitname = Unit:GetName()
|
||||||
@@ -2659,7 +2635,7 @@ do
|
|||||||
self:T({buildables = buildables})
|
self:T({buildables = buildables})
|
||||||
end -- end dropped
|
end -- end dropped
|
||||||
end -- end crate loop
|
end -- end crate loop
|
||||||
-- ok let's list what we have
|
-- ok let\'s list what we have
|
||||||
local report = REPORT:New("Checklist Buildable Crates")
|
local report = REPORT:New("Checklist Buildable Crates")
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
for _,_build in pairs(buildables) do
|
for _,_build in pairs(buildables) do
|
||||||
@@ -2674,9 +2650,7 @@ do
|
|||||||
local text = string.format("Type: %s | Required %d | Found %d | Can Build %s", name, needed, found, txtok)
|
local text = string.format("Type: %s | Required %d | Found %d | Can Build %s", name, needed, found, txtok)
|
||||||
report:Add(text)
|
report:Add(text)
|
||||||
end -- end list buildables
|
end -- end list buildables
|
||||||
if not foundbuilds then
|
if not foundbuilds then report:Add(" --- None Found ---") end
|
||||||
report:Add( " --- None Found ---" )
|
|
||||||
end
|
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
local text = report:Text()
|
local text = report:Text()
|
||||||
if not Engineering then
|
if not Engineering then
|
||||||
@@ -2684,7 +2658,7 @@ do
|
|||||||
else
|
else
|
||||||
self:T(text)
|
self:T(text)
|
||||||
end
|
end
|
||||||
-- let's get going
|
-- let\'s get going
|
||||||
if canbuild then
|
if canbuild then
|
||||||
-- loop again
|
-- loop again
|
||||||
for _,_build in pairs(buildables) do
|
for _,_build in pairs(buildables) do
|
||||||
@@ -2696,9 +2670,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not Engineering then
|
if not Engineering then self:_SendMessage(string.format("No crates within %d meters!",finddist), 10, false, Group) end
|
||||||
self:_SendMessage( string.format( "No crates within %d meters!", finddist ), 10, false, Group )
|
|
||||||
end
|
|
||||||
end -- number > 0
|
end -- number > 0
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2747,7 +2719,7 @@ do
|
|||||||
self:T({repair = buildables})
|
self:T({repair = buildables})
|
||||||
end -- end dropped
|
end -- end dropped
|
||||||
end -- end crate loop
|
end -- end crate loop
|
||||||
-- ok let's list what we have
|
-- ok let\'s list what we have
|
||||||
local report = REPORT:New("Checklist Repairs")
|
local report = REPORT:New("Checklist Repairs")
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
for _,_build in pairs(buildables) do
|
for _,_build in pairs(buildables) do
|
||||||
@@ -2762,9 +2734,7 @@ do
|
|||||||
local text = string.format("Type: %s | Required %d | Found %d | Can Repair %s", name, needed, found, txtok)
|
local text = string.format("Type: %s | Required %d | Found %d | Can Repair %s", name, needed, found, txtok)
|
||||||
report:Add(text)
|
report:Add(text)
|
||||||
end -- end list buildables
|
end -- end list buildables
|
||||||
if not foundbuilds then
|
if not foundbuilds then report:Add(" --- None Found ---") end
|
||||||
report:Add( " --- None Found ---" )
|
|
||||||
end
|
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
local text = report:Text()
|
local text = report:Text()
|
||||||
if not Engineering then
|
if not Engineering then
|
||||||
@@ -2772,7 +2742,7 @@ do
|
|||||||
else
|
else
|
||||||
self:T(text)
|
self:T(text)
|
||||||
end
|
end
|
||||||
-- let's get going
|
-- let\'s get going
|
||||||
if canbuild then
|
if canbuild then
|
||||||
-- loop again
|
-- loop again
|
||||||
for _,_build in pairs(buildables) do
|
for _,_build in pairs(buildables) do
|
||||||
@@ -2783,9 +2753,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not Engineering then
|
if not Engineering then self:_SendMessage(string.format("No crates within %d meters!",finddist), 10, false, Group) end
|
||||||
self:_SendMessage( string.format( "No crates within %d meters!", finddist ), 10, false, Group )
|
|
||||||
end
|
|
||||||
end -- number > 0
|
end -- number > 0
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2806,9 +2774,7 @@ do
|
|||||||
local name = Build.Name
|
local name = Build.Name
|
||||||
local ctype = Build.Type -- #CTLD_CARGO.Enum
|
local ctype = Build.Type -- #CTLD_CARGO.Enum
|
||||||
local canmove = false
|
local canmove = false
|
||||||
if ctype == CTLD_CARGO.Enum.VEHICLE then
|
if ctype == CTLD_CARGO.Enum.VEHICLE then canmove = true end
|
||||||
canmove = true
|
|
||||||
end
|
|
||||||
if ctype == CTLD_CARGO.Enum.STATIC then
|
if ctype == CTLD_CARGO.Enum.STATIC then
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2903,9 +2869,7 @@ do
|
|||||||
nowcrate.Positionable = nil
|
nowcrate.Positionable = nil
|
||||||
nowcrate.HasBeenDropped = false
|
nowcrate.HasBeenDropped = false
|
||||||
end
|
end
|
||||||
if found == numberdest then
|
if found == numberdest then break end -- got enough
|
||||||
break
|
|
||||||
end -- got enough
|
|
||||||
end
|
end
|
||||||
-- loop and remove from real world representation
|
-- loop and remove from real world representation
|
||||||
self:_CleanupTrackedCrates(destIDs)
|
self:_CleanupTrackedCrates(destIDs)
|
||||||
@@ -3118,7 +3082,7 @@ do
|
|||||||
function CTLD:ActivateZone(Name,ZoneType,NewState)
|
function CTLD:ActivateZone(Name,ZoneType,NewState)
|
||||||
self:T(self.lid .. " AddZone")
|
self:T(self.lid .. " AddZone")
|
||||||
local newstate = true
|
local newstate = true
|
||||||
-- set optional in case we're deactivating
|
-- set optional in case we\'re deactivating
|
||||||
if NewState ~= nil then
|
if NewState ~= nil then
|
||||||
newstate = NewState
|
newstate = NewState
|
||||||
end
|
end
|
||||||
@@ -3145,6 +3109,7 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- User function - Deactivate Name #CTLD.CargoZoneType ZoneType for this CTLD instance.
|
--- User function - Deactivate Name #CTLD.CargoZoneType ZoneType for this CTLD instance.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param #string Name Name of the zone to change in the ME.
|
-- @param #string Name Name of the zone to change in the ME.
|
||||||
@@ -3216,6 +3181,7 @@ do
|
|||||||
return beacon
|
return beacon
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- User function - Crates and adds a #CTLD.CargoZone zone for this CTLD instance.
|
--- User function - Crates and adds a #CTLD.CargoZone zone for this CTLD instance.
|
||||||
-- Zones of type LOAD: Players load crates and troops here.
|
-- Zones of type LOAD: Players load crates and troops here.
|
||||||
-- Zones of type DROP: Players can drop crates here. Note that troops can be unloaded anywhere.
|
-- Zones of type DROP: Players can drop crates here. Note that troops can be unloaded anywhere.
|
||||||
@@ -3325,9 +3291,7 @@ do
|
|||||||
local zones = {[1] = self.pickupZones, [2] = self.wpZones, [3] = self.dropOffZones, [4] = self.shipZones}
|
local zones = {[1] = self.pickupZones, [2] = self.wpZones, [3] = self.dropOffZones, [4] = self.shipZones}
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local IsShip = false
|
local IsShip = false
|
||||||
if i == 4 then
|
if i == 4 then IsShip = true end
|
||||||
IsShip = true
|
|
||||||
end
|
|
||||||
for index,cargozone in pairs(zones[i]) do
|
for index,cargozone in pairs(zones[i]) do
|
||||||
-- Get Beacon object from zone
|
-- Get Beacon object from zone
|
||||||
local czone = cargozone -- #CTLD.CargoZone
|
local czone = cargozone -- #CTLD.CargoZone
|
||||||
@@ -3373,7 +3337,7 @@ do
|
|||||||
else
|
else
|
||||||
zonetable = self.wpZones -- #table
|
zonetable = self.wpZones -- #table
|
||||||
end
|
end
|
||||||
--- now see if we're in
|
--- now see if we\'re in
|
||||||
local zonecoord = nil
|
local zonecoord = nil
|
||||||
local colorret = nil
|
local colorret = nil
|
||||||
local maxdist = 1000000 -- 100km
|
local maxdist = 1000000 -- 100km
|
||||||
@@ -3468,19 +3432,15 @@ do
|
|||||||
local color = CZone.color
|
local color = CZone.color
|
||||||
local distance = self:_GetDistance(zonecoord,unitcoord)
|
local distance = self:_GetDistance(zonecoord,unitcoord)
|
||||||
if distance < smokedistance and active then
|
if distance < smokedistance and active then
|
||||||
-- smoke zone since we're nearby
|
-- smoke zone since we\'re nearby
|
||||||
if not Flare then
|
if not Flare then
|
||||||
zonecoord:Smoke(color or SMOKECOLOR.White)
|
zonecoord:Smoke(color or SMOKECOLOR.White)
|
||||||
else
|
else
|
||||||
if color == SMOKECOLOR.Blue then
|
if color == SMOKECOLOR.Blue then color = FLARECOLOR.White end
|
||||||
color = FLARECOLOR.White
|
|
||||||
end
|
|
||||||
zonecoord:Flare(color or FLARECOLOR.White)
|
zonecoord:Flare(color or FLARECOLOR.White)
|
||||||
end
|
end
|
||||||
local txt = "smoking"
|
local txt = "smoking"
|
||||||
if Flare then
|
if Flare then txt = "flaring" end
|
||||||
txt = "flaring"
|
|
||||||
end
|
|
||||||
self:_SendMessage(string.format("Roger, %s zone %s!",txt, zonename), 10, false, Group)
|
self:_SendMessage(string.format("Roger, %s zone %s!",txt, zonename), 10, false, Group)
|
||||||
smoked = true
|
smoked = true
|
||||||
end
|
end
|
||||||
@@ -3588,9 +3548,7 @@ do
|
|||||||
function CTLD:_ShowHoverParams(Group,Unit)
|
function CTLD:_ShowHoverParams(Group,Unit)
|
||||||
local inhover = self:IsCorrectHover(Unit)
|
local inhover = self:IsCorrectHover(Unit)
|
||||||
local htxt = "true"
|
local htxt = "true"
|
||||||
if not inhover then
|
if not inhover then htxt = "false" end
|
||||||
htxt = "false"
|
|
||||||
end
|
|
||||||
local text = ""
|
local text = ""
|
||||||
if _SETTINGS:IsMetric() then
|
if _SETTINGS:IsMetric() then
|
||||||
text = string.format("Hover parameters (autoload/drop):\n - Min height %dm \n - Max height %dm \n - Max speed 2mps \n - In parameter: %s", self.minimumHoverHeight, self.maximumHoverHeight, htxt)
|
text = string.format("Hover parameters (autoload/drop):\n - Min height %dm \n - Max height %dm \n - Max speed 2mps \n - In parameter: %s", self.minimumHoverHeight, self.maximumHoverHeight, htxt)
|
||||||
@@ -3610,9 +3568,7 @@ do
|
|||||||
function CTLD:_ShowFlightParams(Group,Unit)
|
function CTLD:_ShowFlightParams(Group,Unit)
|
||||||
local inhover = self:IsCorrectFlightParameters(Unit)
|
local inhover = self:IsCorrectFlightParameters(Unit)
|
||||||
local htxt = "true"
|
local htxt = "true"
|
||||||
if not inhover then
|
if not inhover then htxt = "false" end
|
||||||
htxt = "false"
|
|
||||||
end
|
|
||||||
local text = ""
|
local text = ""
|
||||||
if _SETTINGS:IsImperial() then
|
if _SETTINGS:IsImperial() then
|
||||||
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
|
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
|
||||||
@@ -3627,15 +3583,14 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- (Internal) Check if a unit is in a load zone and is hovering in parameters.
|
--- (Internal) Check if a unit is in a load zone and is hovering in parameters.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param Wrapper.Unit#UNIT Unit
|
-- @param Wrapper.Unit#UNIT Unit
|
||||||
-- @return #boolean Outcome
|
-- @return #boolean Outcome
|
||||||
function CTLD:CanHoverLoad(Unit)
|
function CTLD:CanHoverLoad(Unit)
|
||||||
self:T(self.lid .. " CanHoverLoad")
|
self:T(self.lid .. " CanHoverLoad")
|
||||||
if self:IsHercules( Unit ) then
|
if self:IsHercules(Unit) then return false end
|
||||||
return false
|
|
||||||
end
|
|
||||||
local outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) and self:IsCorrectHover(Unit)
|
local outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) and self:IsCorrectHover(Unit)
|
||||||
if not outcome then
|
if not outcome then
|
||||||
outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP) --and self:IsCorrectHover(Unit)
|
outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP) --and self:IsCorrectHover(Unit)
|
||||||
@@ -3701,9 +3656,7 @@ do
|
|||||||
if self.hoverautoloading then
|
if self.hoverautoloading then
|
||||||
for _,_pilot in pairs (self.CtldUnits) do
|
for _,_pilot in pairs (self.CtldUnits) do
|
||||||
local Unit = UNIT:FindByName(_pilot)
|
local Unit = UNIT:FindByName(_pilot)
|
||||||
if self:CanHoverLoad( Unit ) then
|
if self:CanHoverLoad(Unit) then self:AutoHoverLoad(Unit) end
|
||||||
self:AutoHoverLoad( Unit )
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -3958,9 +3911,7 @@ do
|
|||||||
local randomcoord = zone:GetRandomCoordinate(10,30*factor):GetVec2()
|
local randomcoord = zone:GetRandomCoordinate(10,30*factor):GetVec2()
|
||||||
cargo:SetWasDropped(true)
|
cargo:SetWasDropped(true)
|
||||||
local canmove = false
|
local canmove = false
|
||||||
if type == CTLD_CARGO.Enum.VEHICLE then
|
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
|
||||||
canmove = true
|
|
||||||
end
|
|
||||||
for _,_template in pairs(temptable) do
|
for _,_template in pairs(temptable) do
|
||||||
self.TroopCounter = self.TroopCounter + 1
|
self.TroopCounter = self.TroopCounter + 1
|
||||||
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
||||||
@@ -4146,6 +4097,7 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- (Internal) FSM Function onbeforeTroopsDeployed.
|
--- (Internal) FSM Function onbeforeTroopsDeployed.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param #string From State.
|
-- @param #string From State.
|
||||||
@@ -4268,7 +4220,7 @@ do
|
|||||||
|
|
||||||
local statics = nil
|
local statics = nil
|
||||||
local statics = {}
|
local statics = {}
|
||||||
self:I( self.lid .. "Bulding Statics Table for Saving" )
|
self:T(self.lid.."Bulding Statics Table for Saving")
|
||||||
for _,_cargo in pairs (stcstable) do
|
for _,_cargo in pairs (stcstable) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo -- #CTLD_CARGO
|
||||||
local object = cargo:GetPositionable() -- Wrapper.Static#STATIC
|
local object = cargo:GetPositionable() -- Wrapper.Static#STATIC
|
||||||
@@ -4296,13 +4248,12 @@ do
|
|||||||
cargo = thiscargo
|
cargo = thiscargo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if match then
|
if match then break end
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return match, cargo
|
return match, cargo
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--local data = "LoadedData = {\n"
|
--local data = "LoadedData = {\n"
|
||||||
local data = "Group,x,y,z,CargoName,CargoTemplates,CargoType,CratesNeeded,CrateMass\n"
|
local data = "Group,x,y,z,CargoName,CargoTemplates,CargoType,CratesNeeded,CrateMass\n"
|
||||||
local n = 0
|
local n = 0
|
||||||
@@ -4339,7 +4290,8 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local location = group:GetVec3()
|
local location = group:GetVec3()
|
||||||
local txt = string.format( "%s,%d,%d,%d,%s,%s,%s,%d,%d\n", template, location.x, location.y, location.z, cgoname, cgotemp, cgotype, cgoneed, cgomass )
|
local txt = string.format("%s,%d,%d,%d,%s,%s,%s,%d,%d\n"
|
||||||
|
,template,location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass)
|
||||||
data = data .. txt
|
data = data .. txt
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4364,7 +4316,8 @@ do
|
|||||||
local cgomass = object.PerCrateMass
|
local cgomass = object.PerCrateMass
|
||||||
local crateobj = object.Positionable
|
local crateobj = object.Positionable
|
||||||
local location = crateobj:GetVec3()
|
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 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)
|
||||||
data = data .. txt
|
data = data .. txt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user