CTLD - make container shape configureable

This commit is contained in:
Applevangelist
2022-01-15 11:34:23 +01:00
parent e847b92cce
commit 964831becf
+76 -123
View File
@@ -22,7 +22,7 @@
-- @module Ops.CTLD
-- @image OPS_CTLD.jpg
-- Date: Dec 2021
-- Date: Jan 2022
do
------------------------------------------------------
@@ -318,8 +318,7 @@ do
ClassName = "CTLD_CARGO",
ID = 0,
Name = "none",
Templates = {
},
Templates = {},
CargoType = "none",
HasBeenMoved = false,
LoadDirectly = false,
@@ -349,7 +348,7 @@ do
-- @param #number ID ID of this #CTLD_CARGO
-- @param #string Name Name for menu.
-- @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 LoadDirectly Flag for direct loading.
-- @param #number CratesNeeded Crates needed to build.
@@ -358,14 +357,14 @@ do
-- @param #number PerCrateMass Mass in kg
-- @param #number Stock Number of builds available, nil for unlimited
-- @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.
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.Name = Name or "none" -- #string
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.LoadDirectly = LoadDirectly or false -- #boolean
self.CratesNeeded = CratesNeeded or 0 -- #number
@@ -502,9 +501,7 @@ do
if self.Stock then -- Stock nil?
local number = Number or 1
self.Stock = self.Stock - number
if self.Stock < 0 then
self.Stock = 0
end
if self.Stock < 0 then self.Stock = 0 end
end
return self
end
@@ -557,7 +554,7 @@ do
-- @field #number coalition Coalition side number, e.g. `coalition.side.RED`.
-- @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
--
-- * 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.
-- * 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.
@@ -574,7 +571,7 @@ do
--
-- ## 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.
--
-- ## 1. Basic Setup
@@ -601,7 +598,7 @@ do
-- 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,
-- -- 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.
-- my_ctld:AddTroopsCargo("Wrenches",{"Engineers"},CTLD_CARGO.Enum.ENGINEERS,4)
-- 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
--
-- -- 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)
--
-- ## 1.3 Add logistics zones
@@ -675,6 +672,7 @@ do
-- my_ctld.pilotmustopendoors = false -- force opening of doors
-- 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.basetype = "container_cargo" -- default shape of the cargo container
--
-- ## 2.1 User functions
--
@@ -699,6 +697,7 @@ do
-- ["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},
--
--
-- ### 2.1.2 Activate and deactivate zones
--
-- Activate a zone:
@@ -986,12 +985,13 @@ do
["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-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.
-- @field #string version
CTLD.version = "1.0.1"
CTLD.version="1.0.2"
--- Instantiate a new CTLD.
-- @param #CTLD self
@@ -1156,6 +1156,7 @@ do
-- slingload
self.enableslingload = false
self.basetype = "container_cargo" -- shape of the container
-- Smokes and Flares
self.SmokeColor = SMOKECOLOR.Red
@@ -1350,6 +1351,7 @@ do
return capabilities
end
--- (Internal) Function to generate valid UHF Frequencies
-- @param #CTLD self
function CTLD:_GenerateUHFrequencies()
@@ -1454,19 +1456,13 @@ do
end
if not inzone then
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
if not self.debug then
return self
end
if not self.debug then return self end
elseif not grounded and not hoverload then
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
if not self.debug then
return self
end
if not self.debug then return self end
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)
if not self.debug then
return self
end
if not self.debug then return self end
end
-- load troops into heli
local group = Group -- Wrapper.Group#GROUP
@@ -1550,9 +1546,7 @@ do
end
else
if type(String) == "string" then
if string.find( String, Table ) then
match = true
end
if string.find(String,Table) then match = true end
end
end
return match
@@ -1593,9 +1587,7 @@ do
local NearestGroup, CargoType = self:_FindRepairNearby(Group,Unit,Repairtype) -- Wrapper.Group#GROUP, #CTLD_CARGO
--self:I({Repairtype=Repairtype, CargoType=CargoType, NearestGroup=NearestGroup})
if NearestGroup ~= nil then
if self.repairtime < 2 then
self.repairtime = 30
end -- noob catch
if self.repairtime < 2 then self.repairtime = 30 end -- noob catch
if not Engineering then
self:_SendMessage(string.format("Repair started using %s taking %d secs", build.Name, self.repairtime), 10, false, Group)
end
@@ -1613,9 +1605,7 @@ do
object.CanBuild = true
object.Type = ctype -- #CTLD_CARGO.Enum
self:_CleanUpCrates(Crates,Build,Number)
local desttimer = TIMER:New( function()
NearestGroup:Destroy( false )
end, self )
local desttimer = TIMER:New(function() NearestGroup:Destroy(false) end, self)
desttimer:Start(self.repairtime - 1)
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,object,true,NearestGroup:GetCoordinate())
buildtimer:Start(self.repairtime)
@@ -1642,15 +1632,11 @@ do
if not grounded and not hoverload then
self:_SendMessage("You need to land or hover in position to load!", 10, false, Group)
if not self.debug then
return self
end
if not self.debug then return self end
end
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)
if not self.debug then
return self
end
if not self.debug then return self end
end
-- load troops into heli
local unit = Unit -- Wrapper.Unit#UNIT
@@ -1697,11 +1683,7 @@ do
local Cargotype = nil
for k,v in pairs(self.Cargo_Troops) do
local comparison = ""
if type( v.Templates ) == "string" then
comparison = v.Templates
else
comparison = v.Templates[1]
end
if type(v.Templates) == "string" then comparison = v.Templates else comparison = v.Templates[1] end
if comparison == groupType then
Cargotype = v
break
@@ -1771,7 +1753,7 @@ do
-- @param Wrapper.Unit#UNIT Unit
-- @param #CTLD_CARGO Cargo
-- @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)
self:T(self.lid .. " _GetCrates")
if not drop then
@@ -1804,9 +1786,7 @@ do
if not inzone then
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
if not self.debug then
return self
end
if not self.debug then return self end
end
-- avoid crate spam
@@ -1850,9 +1830,7 @@ do
local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000))
if not self.placeCratesAhead then
cratedistance = (i-1)*2.5 + capabilities.length
if cratedistance > self.CrateDistance then
cratedistance = self.CrateDistance
end
if cratedistance > self.CrateDistance then cratedistance = self.CrateDistance end
-- altered heading logic
-- DONE: right standard deviation?
rheading = UTILS.RandomGaussian(0,30,-90,90,100)
@@ -1880,7 +1858,7 @@ do
local cratecoord = position:Translate(cratedistance,rheading)
local cratevec2 = cratecoord:GetVec2()
self.CrateCounter = self.CrateCounter + 1
local basetype = "container_cargo"
local basetype = self.basetype or "container_cargo"
if isstatic then
basetype = cratetemplate
end
@@ -1893,7 +1871,8 @@ do
dist = dist - (20 + math.random(1,10))
local width = width / 2
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)
:InitCargo(self.enableslingload)
:InitLinkToUnit(Ship,dist,Offy,0)
@@ -1902,7 +1881,8 @@ do
self.Spawned_Crates[self.CrateCounter] = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry)
:InitCoordinate(cratecoord)
:InitCargoMass(cgomass)
:InitCargo( self.enableslingload ) -- :InitLinkToUnit(Unit,OffsetX,OffsetY,OffsetAngle)
:InitCargo(self.enableslingload)
--:InitLinkToUnit(Unit,OffsetX,OffsetY,OffsetAngle)
:Spawn(270,cratealias)
end
local templ = cargotype:GetTemplates()
@@ -1956,7 +1936,7 @@ do
cratetemplate = cargotype:GetTemplates()
isstatic = true
end
local basetype = "container_cargo"
local basetype = self.basetype or "container_cargo"
if isstatic then
basetype = cratetemplate
end
@@ -2098,7 +2078,7 @@ do
local grounded = not self:IsUnitInAir(Unit)
local canhoverload = self:CanHoverLoad(Unit)
--- cases -------------------------------
-- Chopper can't do crates - bark & return
-- Chopper can\'t do crates - bark & return
-- Chopper can do crates -
-- --> hover if forcedhover or bark and return
-- --> hover or land if not forcedhover
@@ -2418,9 +2398,7 @@ do
local canunload = true
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)
if not self.debug then
return self
end
if not self.debug then return self end
end
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
if not inzone then
@@ -2430,13 +2408,13 @@ do
droppingatbase = true
end
-- 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)
if IsHerc then
-- no hover but airdrop here
hoverunload = self:IsCorrectFlightParameters(Unit)
end
-- check if we're landed
-- check if we\'re landed
local grounded = not self:IsUnitInAir(Unit)
-- Get what we have loaded
local unitname = Unit:GetName()
@@ -2514,9 +2492,7 @@ do
if _troop.Name == name then
local stock = _troop:GetStock()
-- avoid making unlimited stock limited
if stock and tonumber( stock ) >= 0 then
_troop:AddStock()
end
if stock and tonumber(stock) >= 0 then _troop:AddStock() end
end
end
end
@@ -2553,13 +2529,13 @@ do
end
end
-- 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)
if IsHerc then
-- no hover but airdrop here
hoverunload = self:IsCorrectFlightParameters(Unit)
end
-- check if we're landed
-- check if we\'re landed
local grounded = not self:IsUnitInAir(Unit)
-- Get what we have loaded
local unitname = Unit:GetName()
@@ -2659,7 +2635,7 @@ do
self:T({buildables = buildables})
end -- end dropped
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")
report:Add("------------------------------------------------------------")
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)
report:Add(text)
end -- end list buildables
if not foundbuilds then
report:Add( " --- None Found ---" )
end
if not foundbuilds then report:Add(" --- None Found ---") end
report:Add("------------------------------------------------------------")
local text = report:Text()
if not Engineering then
@@ -2684,7 +2658,7 @@ do
else
self:T(text)
end
-- let's get going
-- let\'s get going
if canbuild then
-- loop again
for _,_build in pairs(buildables) do
@@ -2696,9 +2670,7 @@ do
end
end
else
if not Engineering then
self:_SendMessage( string.format( "No crates within %d meters!", finddist ), 10, false, Group )
end
if not Engineering then self:_SendMessage(string.format("No crates within %d meters!",finddist), 10, false, Group) end
end -- number > 0
return self
end
@@ -2747,7 +2719,7 @@ do
self:T({repair = buildables})
end -- end dropped
end -- end crate loop
-- ok let's list what we have
-- ok let\'s list what we have
local report = REPORT:New("Checklist Repairs")
report:Add("------------------------------------------------------------")
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)
report:Add(text)
end -- end list buildables
if not foundbuilds then
report:Add( " --- None Found ---" )
end
if not foundbuilds then report:Add(" --- None Found ---") end
report:Add("------------------------------------------------------------")
local text = report:Text()
if not Engineering then
@@ -2772,7 +2742,7 @@ do
else
self:T(text)
end
-- let's get going
-- let\'s get going
if canbuild then
-- loop again
for _,_build in pairs(buildables) do
@@ -2783,9 +2753,7 @@ do
end
end
else
if not Engineering then
self:_SendMessage( string.format( "No crates within %d meters!", finddist ), 10, false, Group )
end
if not Engineering then self:_SendMessage(string.format("No crates within %d meters!",finddist), 10, false, Group) end
end -- number > 0
return self
end
@@ -2806,9 +2774,7 @@ do
local name = Build.Name
local ctype = Build.Type -- #CTLD_CARGO.Enum
local canmove = false
if ctype == CTLD_CARGO.Enum.VEHICLE then
canmove = true
end
if ctype == CTLD_CARGO.Enum.VEHICLE then canmove = true end
if ctype == CTLD_CARGO.Enum.STATIC then
return self
end
@@ -2903,9 +2869,7 @@ do
nowcrate.Positionable = nil
nowcrate.HasBeenDropped = false
end
if found == numberdest then
break
end -- got enough
if found == numberdest then break end -- got enough
end
-- loop and remove from real world representation
self:_CleanupTrackedCrates(destIDs)
@@ -3118,7 +3082,7 @@ do
function CTLD:ActivateZone(Name,ZoneType,NewState)
self:T(self.lid .. " AddZone")
local newstate = true
-- set optional in case we're deactivating
-- set optional in case we\'re deactivating
if NewState ~= nil then
newstate = NewState
end
@@ -3145,6 +3109,7 @@ do
return self
end
--- User function - Deactivate Name #CTLD.CargoZoneType ZoneType for this CTLD instance.
-- @param #CTLD self
-- @param #string Name Name of the zone to change in the ME.
@@ -3216,6 +3181,7 @@ do
return beacon
end
--- 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 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}
for i=1,4 do
local IsShip = false
if i == 4 then
IsShip = true
end
if i == 4 then IsShip = true end
for index,cargozone in pairs(zones[i]) do
-- Get Beacon object from zone
local czone = cargozone -- #CTLD.CargoZone
@@ -3373,7 +3337,7 @@ do
else
zonetable = self.wpZones -- #table
end
--- now see if we're in
--- now see if we\'re in
local zonecoord = nil
local colorret = nil
local maxdist = 1000000 -- 100km
@@ -3468,19 +3432,15 @@ do
local color = CZone.color
local distance = self:_GetDistance(zonecoord,unitcoord)
if distance < smokedistance and active then
-- smoke zone since we're nearby
-- smoke zone since we\'re nearby
if not Flare then
zonecoord:Smoke(color or SMOKECOLOR.White)
else
if color == SMOKECOLOR.Blue then
color = FLARECOLOR.White
end
if color == SMOKECOLOR.Blue then color = FLARECOLOR.White end
zonecoord:Flare(color or FLARECOLOR.White)
end
local txt = "smoking"
if Flare then
txt = "flaring"
end
if Flare then txt = "flaring" end
self:_SendMessage(string.format("Roger, %s zone %s!",txt, zonename), 10, false, Group)
smoked = true
end
@@ -3588,9 +3548,7 @@ do
function CTLD:_ShowHoverParams(Group,Unit)
local inhover = self:IsCorrectHover(Unit)
local htxt = "true"
if not inhover then
htxt = "false"
end
if not inhover then htxt = "false" end
local text = ""
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)
@@ -3610,9 +3568,7 @@ do
function CTLD:_ShowFlightParams(Group,Unit)
local inhover = self:IsCorrectFlightParameters(Unit)
local htxt = "true"
if not inhover then
htxt = "false"
end
if not inhover then htxt = "false" end
local text = ""
if _SETTINGS:IsImperial() then
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
@@ -3627,15 +3583,14 @@ do
return self
end
--- (Internal) Check if a unit is in a load zone and is hovering in parameters.
-- @param #CTLD self
-- @param Wrapper.Unit#UNIT Unit
-- @return #boolean Outcome
function CTLD:CanHoverLoad(Unit)
self:T(self.lid .. " CanHoverLoad")
if self:IsHercules( Unit ) then
return false
end
if self:IsHercules(Unit) then return false end
local outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) and self:IsCorrectHover(Unit)
if not outcome then
outcome = self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP) --and self:IsCorrectHover(Unit)
@@ -3701,9 +3656,7 @@ do
if self.hoverautoloading then
for _,_pilot in pairs (self.CtldUnits) do
local Unit = UNIT:FindByName(_pilot)
if self:CanHoverLoad( Unit ) then
self:AutoHoverLoad( Unit )
end
if self:CanHoverLoad(Unit) then self:AutoHoverLoad(Unit) end
end
end
return self
@@ -3958,9 +3911,7 @@ do
local randomcoord = zone:GetRandomCoordinate(10,30*factor):GetVec2()
cargo:SetWasDropped(true)
local canmove = false
if type == CTLD_CARGO.Enum.VEHICLE then
canmove = true
end
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
for _,_template in pairs(temptable) do
self.TroopCounter = self.TroopCounter + 1
local alias = string.format("%s-%d", _template, math.random(1,100000))
@@ -4146,6 +4097,7 @@ do
return self
end
--- (Internal) FSM Function onbeforeTroopsDeployed.
-- @param #CTLD self
-- @param #string From State.
@@ -4268,7 +4220,7 @@ do
local statics = nil
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
local cargo = _cargo -- #CTLD_CARGO
local object = cargo:GetPositionable() -- Wrapper.Static#STATIC
@@ -4296,13 +4248,12 @@ do
cargo = thiscargo
end
end
if match then
break
end
if match then break end
end
return match, cargo
end
--local data = "LoadedData = {\n"
local data = "Group,x,y,z,CargoName,CargoTemplates,CargoType,CratesNeeded,CrateMass\n"
local n = 0
@@ -4339,7 +4290,8 @@ do
end
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
end
end
@@ -4364,7 +4316,8 @@ do
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 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
end