mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
@@ -2847,7 +2847,7 @@ function AIRBOSS:SetGlideslopeErrorThresholds(_max,_min, High, HIGH, Low, LOW)
|
||||
|
||||
--Check if V/STOL Carrier
|
||||
if self.carriertype == AIRBOSS.CarrierType.INVINCIBLE or self.carriertype == AIRBOSS.CarrierType.HERMES or self.carriertype == AIRBOSS.CarrierType.TARAWA or self.carriertype == AIRBOSS.CarrierType.AMERICA or self.carriertype == AIRBOSS.CarrierType.JCARLOS or self.carriertype == AIRBOSS.CarrierType.CANBERRA then
|
||||
|
||||
|
||||
-- allow a larger GSE for V/STOL operations --Pene Testing
|
||||
self.gle._max=_max or 0.7
|
||||
self.gle.High=High or 1.4
|
||||
@@ -2864,7 +2864,7 @@ function AIRBOSS:SetGlideslopeErrorThresholds(_max,_min, High, HIGH, Low, LOW)
|
||||
self.gle.Low=Low or -0.6
|
||||
self.gle.LOW=LOW or -0.9
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -2884,7 +2884,7 @@ function AIRBOSS:SetLineupErrorThresholds(_max,_min, Left, LeftMed, LEFT, Right,
|
||||
|
||||
--Check if V/STOL Carrier -- Pene testing
|
||||
if self.carriertype == AIRBOSS.CarrierType.INVINCIBLE or self.carriertype == AIRBOSS.CarrierType.HERMES or self.carriertype == AIRBOSS.CarrierType.TARAWA or self.carriertype == AIRBOSS.CarrierType.AMERICA or self.carriertype == AIRBOSS.CarrierType.JCARLOS or self.carriertype == AIRBOSS.CarrierType.CANBERRA then
|
||||
|
||||
|
||||
-- V/STOL Values -- allow a larger LUE for V/STOL operations
|
||||
self.lue._max=_max or 1.8
|
||||
self.lue._min=_min or -1.8
|
||||
@@ -2905,7 +2905,7 @@ function AIRBOSS:SetLineupErrorThresholds(_max,_min, Left, LeftMed, LEFT, Right,
|
||||
self.lue.RightMed=RightMed or 2.0
|
||||
self.lue.RIGHT=RIGHT or 3.0
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -3268,7 +3268,7 @@ function AIRBOSS:SetExtraVoiceOversAI(status)
|
||||
self.xtVoiceOversAI=status
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Do not handle AI aircraft.
|
||||
-- @param #AIRBOSS self
|
||||
-- @return #AIRBOSS self
|
||||
@@ -3383,9 +3383,9 @@ end
|
||||
-- @param #string Host Host. Default `"127.0.0.1"`.
|
||||
-- @return #AIRBOSS self
|
||||
function AIRBOSS:SetFunkManOn(Port, Host)
|
||||
|
||||
|
||||
self.funkmanSocket=SOCKET:New(Port, Host)
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -6364,7 +6364,7 @@ function AIRBOSS:_LandAI( flight )
|
||||
-- Aircraft speed when flying the pattern.
|
||||
local Speed = UTILS.KnotsToKmph( 200 )
|
||||
|
||||
if flight.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
if flight.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
or flight.actype == AIRBOSS.AircraftCarrier.FA18C
|
||||
or flight.actype == AIRBOSS.AircraftCarrier.RHINOE
|
||||
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
|
||||
@@ -8115,6 +8115,8 @@ function AIRBOSS:OnEventBirth( EventData )
|
||||
return
|
||||
end
|
||||
|
||||
if EventData.IniObjectCategory ~= Object.Category.UNIT then return end
|
||||
|
||||
local _unitName = EventData.IniUnitName
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
@@ -9192,9 +9194,9 @@ function AIRBOSS:_DirtyUp( playerData )
|
||||
self:_PlayerHint( playerData )
|
||||
|
||||
-- Radio call "Say/Fly needles". Delayed by 10/15 seconds.
|
||||
if playerData.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.F14A
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.F14B
|
||||
if playerData.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.F14A
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.F14B
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.RHINOE
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.RHINOF
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.GROWLER
|
||||
@@ -9791,24 +9793,24 @@ function AIRBOSS:_Groove( playerData )
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Long V/STOL groove time Wave Off over 75 seconds to IC - TOPGUN level Only. --pene testing (WIP)--- Need to think more about this.
|
||||
|
||||
end
|
||||
|
||||
-- Long V/STOL groove time Wave Off over 75 seconds to IC - TOPGUN level Only. --pene testing (WIP)--- Need to think more about this.
|
||||
|
||||
--if rho>=RAR and rho<=RIC and not playerData.waveoff and playerData.difficulty==AIRBOSS.Difficulty.HARD and playerData.actype== AIRBOSS.AircraftCarrier.AV8B then
|
||||
-- Get groove time
|
||||
--local vSlow=groovedata.time
|
||||
-- If too slow wave off.
|
||||
-- If too slow wave off.
|
||||
--if vSlow >75 then
|
||||
|
||||
|
||||
-- LSO Wave off!
|
||||
--self:RadioTransmission(self.LSORadio, self.LSOCall.WAVEOFF, nil, nil, nil, true)
|
||||
--playerData.Tlso=timer.getTime()
|
||||
|
||||
|
||||
-- Player was waved Off
|
||||
--playerData.waveoff=true
|
||||
--return
|
||||
--end
|
||||
--end
|
||||
--end
|
||||
|
||||
-- Groovedata step.
|
||||
@@ -10006,7 +10008,7 @@ function AIRBOSS:_CheckWaveOff( glideslopeError, lineupError, AoA, playerData )
|
||||
waveoff = true
|
||||
end
|
||||
|
||||
-- Too slow or too fast? Only for pros.
|
||||
-- Too slow or too fast? Only for pros.
|
||||
|
||||
if playerData.difficulty == AIRBOSS.Difficulty.HARD and playerData.actype ~= AIRBOSS.AircraftCarrier.AV8B then
|
||||
-- Get aircraft specific AoA values. Not for AV-8B due to transition to Stable Hover.
|
||||
@@ -10162,7 +10164,7 @@ function AIRBOSS:_GetSternCoord()
|
||||
elseif case==2 or case==1 then
|
||||
-- V/Stol: Translate 8 meters port.
|
||||
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
|
||||
end
|
||||
end
|
||||
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
||||
-- Stennis: translate 7 meters starboard wrt Final bearing.
|
||||
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )
|
||||
@@ -10311,7 +10313,7 @@ function AIRBOSS:_Trapped( playerData )
|
||||
|
||||
-- Get current wire (estimate). This now based on the position where the player comes to a standstill which should reflect the trapped wire better.
|
||||
local dcorr = 100
|
||||
if playerData.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
if playerData.actype == AIRBOSS.AircraftCarrier.HORNET
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.RHINOE
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.RHINOF
|
||||
or playerData.actype == AIRBOSS.AircraftCarrier.GROWLER then
|
||||
@@ -10836,7 +10838,7 @@ function AIRBOSS:_GetZoneAbeamLandingSpot()
|
||||
|
||||
-- Coordinate array. Pene Testing extended Abeam landing spot V/STOL.
|
||||
local p={}
|
||||
|
||||
|
||||
-- Points.
|
||||
p[1] = S:Translate( 15, FB ):Translate( 15, FB + 90 ) -- Top-Right
|
||||
p[2] = S:Translate( -45, FB ):Translate( 15, FB + 90 ) -- Bottom-Right
|
||||
@@ -11284,7 +11286,7 @@ function AIRBOSS:_GetOptLandingCoordinate()
|
||||
|
||||
-- set Case III V/STOL abeam landing spot over deck -- Pene Testing
|
||||
if self.carriertype==AIRBOSS.CarrierType.INVINCIBLE or self.carriertype==AIRBOSS.CarrierType.HERMES or self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS or self.carriertype==AIRBOSS.CarrierType.CANBERRA then
|
||||
|
||||
|
||||
if case==3 then
|
||||
|
||||
-- Landing coordinate.
|
||||
@@ -11292,7 +11294,7 @@ function AIRBOSS:_GetOptLandingCoordinate()
|
||||
|
||||
-- Altitude 120ft -- is this corect for Case III?
|
||||
self.landingcoord:SetAltitude(UTILS.FeetToMeters(120))
|
||||
|
||||
|
||||
elseif case==2 or case==1 then
|
||||
|
||||
-- Landing 100 ft abeam, 120 ft alt.
|
||||
@@ -11302,7 +11304,7 @@ function AIRBOSS:_GetOptLandingCoordinate()
|
||||
self.landingcoord:SetAltitude(UTILS.FeetToMeters(120))
|
||||
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
|
||||
-- Ideally we want to land between 2nd and 3rd wire.
|
||||
@@ -11897,7 +11899,7 @@ function AIRBOSS:_LSOgrade( playerData )
|
||||
local nS=count(G, '%(')
|
||||
local nN=N-nS-nL
|
||||
local nNv=Nv-nS-nL
|
||||
|
||||
|
||||
-- Groove time 15-18.99 sec for a unicorn. Or 60-65 for V/STOL unicorn.
|
||||
local Tgroove=playerData.Tgroove
|
||||
local TgrooveUnicorn=Tgroove and (Tgroove>=15.0 and Tgroove<=18.99) or false
|
||||
@@ -12014,7 +12016,7 @@ function AIRBOSS:_LSOgrade( playerData )
|
||||
|
||||
elseif not playerData.hover and playerData.actype == AIRBOSS.AircraftCarrier.AV8B then
|
||||
-------------------------------
|
||||
-- AV-8B not cleared to land -- -- Landing clearence is carrier from LC to Landing
|
||||
-- AV-8B not cleared to land -- -- Landing clearence is carrier from LC to Landing
|
||||
-------------------------------
|
||||
if playerData.landed then
|
||||
-- AIRBOSS wants your balls!
|
||||
@@ -15244,13 +15246,13 @@ end
|
||||
-- @param #string modex Tail number.
|
||||
function AIRBOSS:_MarshallInboundCall(unit, modex)
|
||||
|
||||
-- Calculate
|
||||
-- Calculate
|
||||
local vectorCarrier = self:GetCoordinate():GetDirectionVec3(unit:GetCoordinate())
|
||||
local bearing = UTILS.Round(unit:GetCoordinate():GetAngleDegrees( vectorCarrier ), 0)
|
||||
local distance = UTILS.Round(UTILS.MetersToNM(unit:GetCoordinate():Get2DDistance(self:GetCoordinate())),0)
|
||||
local angels = UTILS.Round(UTILS.MetersToFeet(unit:GetHeight()/1000),0)
|
||||
local state = UTILS.Round(self:_GetFuelState(unit)/1000,1)
|
||||
|
||||
|
||||
-- Pilot: "Marshall, [modex], marking mom's [bearing] for [distance], angels [XX], state [X.X]"
|
||||
local text=string.format("Marshal, %s, marking mom's %d for %d, angels %d, state %.1f", modex, bearing, distance, angels, state)
|
||||
-- Debug message.
|
||||
@@ -16077,8 +16079,8 @@ function AIRBOSS:_RequestMarshal( _unitName )
|
||||
-- Voice over of inbound call (regardless of airboss rejecting it or not)
|
||||
if self.xtVoiceOvers then
|
||||
self:_MarshallInboundCall(_unit, playerData.onboard)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Check if player is in CCA
|
||||
local inCCA = playerData.unit:IsInZone( self.zoneCCA )
|
||||
|
||||
@@ -16326,12 +16328,12 @@ function AIRBOSS:_RequestCommence( _unitName )
|
||||
local playerData = self.players[_playername] -- #AIRBOSS.PlayerData
|
||||
|
||||
if playerData then
|
||||
|
||||
|
||||
-- Voice over of Commencing call (regardless of Airboss will rejected or not)
|
||||
if self.xtVoiceOvers then
|
||||
self:_CommencingCall(_unit, playerData.onboard)
|
||||
end
|
||||
|
||||
|
||||
-- Check if unit is in CCA.
|
||||
local text = ""
|
||||
local cleared = false
|
||||
|
||||
@@ -24,6 +24,299 @@
|
||||
|
||||
-- Last Update Apr 2023
|
||||
|
||||
do
|
||||
|
||||
------------------------------------------------------
|
||||
--- **CTLD_CARGO** class, extends Core.Base#BASE
|
||||
-- @type CTLD_CARGO
|
||||
-- @field #string ClassName Class name.
|
||||
-- @field #number ID ID of this cargo.
|
||||
-- @field #string Name Name for menu.
|
||||
-- @field #table Templates Table of #POSITIONABLE objects.
|
||||
-- @field #string CargoType Enumerator of Type.
|
||||
-- @field #boolean HasBeenMoved Flag for moving.
|
||||
-- @field #boolean LoadDirectly Flag for direct loading.
|
||||
-- @field #number CratesNeeded Crates needed to build.
|
||||
-- @field Wrapper.Positionable#POSITIONABLE Positionable Representation of cargo in the mission.
|
||||
-- @field #boolean HasBeenDropped True if dropped from heli.
|
||||
-- @field #number PerCrateMass Mass in kg.
|
||||
-- @field #number Stock Number of builds available, -1 for unlimited.
|
||||
-- @field #string Subcategory Sub-category name.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
-- @field #CTLD_CARGO CTLD_CARGO
|
||||
CTLD_CARGO = {
|
||||
ClassName = "CTLD_CARGO",
|
||||
ID = 0,
|
||||
Name = "none",
|
||||
Templates = {},
|
||||
CargoType = "none",
|
||||
HasBeenMoved = false,
|
||||
LoadDirectly = false,
|
||||
CratesNeeded = 0,
|
||||
Positionable = nil,
|
||||
HasBeenDropped = false,
|
||||
PerCrateMass = 0,
|
||||
Stock = nil,
|
||||
Mark = nil,
|
||||
}
|
||||
|
||||
--- Define cargo types.
|
||||
-- @type CTLD_CARGO.Enum
|
||||
-- @field #string VEHICLE
|
||||
-- @field #string TROOPS
|
||||
-- @field #string FOB
|
||||
-- @field #string CRATE
|
||||
-- @field #string REPAIR
|
||||
-- @field #string ENGINEERS
|
||||
-- @field #string STATIC
|
||||
CTLD_CARGO.Enum = {
|
||||
VEHICLE = "Vehicle", -- #string vehicles
|
||||
TROOPS = "Troops", -- #string troops
|
||||
FOB = "FOB", -- #string FOB
|
||||
CRATE = "Crate", -- #string crate
|
||||
REPAIR = "Repair", -- #string repair
|
||||
ENGINEERS = "Engineers", -- #string engineers
|
||||
STATIC = "Static", -- #string statics
|
||||
}
|
||||
|
||||
--- Function to create new CTLD_CARGO object.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @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 Sorte Enumerator of Type.
|
||||
-- @param #boolean HasBeenMoved Flag for moving.
|
||||
-- @param #boolean LoadDirectly Flag for direct loading.
|
||||
-- @param #number CratesNeeded Crates needed to build.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE Positionable Representation of cargo in the mission.
|
||||
-- @param #boolean Dropped Cargo/Troops have been unloaded from a chopper.
|
||||
-- @param #number PerCrateMass Mass in kg
|
||||
-- @param #number Stock Number of builds available, nil for unlimited
|
||||
-- @param #string Subcategory Name of subcategory, handy if using > 10 types to load.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory)
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD_CARGO
|
||||
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 = Sorte or "type" -- #CTLD_CARGO.Enum
|
||||
self.HasBeenMoved = HasBeenMoved or false -- #boolean
|
||||
self.LoadDirectly = LoadDirectly or false -- #boolean
|
||||
self.CratesNeeded = CratesNeeded or 0 -- #number
|
||||
self.Positionable = Positionable or nil -- Wrapper.Positionable#POSITIONABLE
|
||||
self.HasBeenDropped = Dropped or false --#boolean
|
||||
self.PerCrateMass = PerCrateMass or 0 -- #number
|
||||
self.Stock = Stock or nil --#number
|
||||
self.Mark = nil
|
||||
self.Subcategory = Subcategory or "Other"
|
||||
return self
|
||||
end
|
||||
|
||||
--- Query ID.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number ID
|
||||
function CTLD_CARGO:GetID()
|
||||
return self.ID
|
||||
end
|
||||
|
||||
--- Query Subcategory
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string SubCategory
|
||||
function CTLD_CARGO:GetSubCat()
|
||||
return self.Subcategory
|
||||
end
|
||||
|
||||
--- Query Mass.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Mass in kg
|
||||
function CTLD_CARGO:GetMass()
|
||||
return self.PerCrateMass
|
||||
end
|
||||
|
||||
--- Query Name.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string Name
|
||||
function CTLD_CARGO:GetName()
|
||||
return self.Name
|
||||
end
|
||||
|
||||
--- Query Templates.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #table Templates
|
||||
function CTLD_CARGO:GetTemplates()
|
||||
return self.Templates
|
||||
end
|
||||
|
||||
--- Query has moved.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean Has moved
|
||||
function CTLD_CARGO:HasMoved()
|
||||
return self.HasBeenMoved
|
||||
end
|
||||
|
||||
--- Query was dropped.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean Has been dropped.
|
||||
function CTLD_CARGO:WasDropped()
|
||||
return self.HasBeenDropped
|
||||
end
|
||||
|
||||
--- Query directly loadable.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean loadable
|
||||
function CTLD_CARGO:CanLoadDirectly()
|
||||
return self.LoadDirectly
|
||||
end
|
||||
|
||||
--- Query number of crates or troopsize.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Crates or size of troops.
|
||||
function CTLD_CARGO:GetCratesNeeded()
|
||||
return self.CratesNeeded
|
||||
end
|
||||
|
||||
--- Query type.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO.Enum Type
|
||||
function CTLD_CARGO:GetType()
|
||||
return self.CargoType
|
||||
end
|
||||
|
||||
--- Query type.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return Wrapper.Positionable#POSITIONABLE Positionable
|
||||
function CTLD_CARGO:GetPositionable()
|
||||
return self.Positionable
|
||||
end
|
||||
|
||||
--- Set HasMoved.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean moved
|
||||
function CTLD_CARGO:SetHasMoved(moved)
|
||||
self.HasBeenMoved = moved or false
|
||||
end
|
||||
|
||||
--- Query if cargo has been loaded.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean loaded
|
||||
function CTLD_CARGO:Isloaded()
|
||||
if self.HasBeenMoved and not self.WasDropped() then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Set WasDropped.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean dropped
|
||||
function CTLD_CARGO:SetWasDropped(dropped)
|
||||
self.HasBeenDropped = dropped or false
|
||||
end
|
||||
|
||||
--- Get Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Stock
|
||||
function CTLD_CARGO:GetStock()
|
||||
if self.Stock then
|
||||
return self.Stock
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
--- Add Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to add, none if nil.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:AddStock(Number)
|
||||
if self.Stock then -- Stock nil?
|
||||
local number = Number or 1
|
||||
self.Stock = self.Stock + number
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to reduce, none if nil.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:RemoveStock(Number)
|
||||
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
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to set, nil means unlimited.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:SetStock(Number)
|
||||
self.Stock = Number
|
||||
return self
|
||||
end
|
||||
|
||||
--- Query crate type for REPAIR
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean
|
||||
function CTLD_CARGO:IsRepair()
|
||||
if self.CargoType == "Repair" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Query crate type for STATIC
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean
|
||||
function CTLD_CARGO:IsStatic()
|
||||
if self.CargoType == "Static" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Add mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:AddMark(Mark)
|
||||
self.Mark = Mark
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string Mark
|
||||
function CTLD_CARGO:GetMark(Mark)
|
||||
return self.Mark
|
||||
end
|
||||
|
||||
--- Wipe mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:WipeMark()
|
||||
self.Mark = nil
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get overall mass of a cargo object, i.e. crates needed x mass per crate
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number mass
|
||||
function CTLD_CARGO:GetNetMass()
|
||||
return self.CratesNeeded * self.PerCrateMass
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do
|
||||
|
||||
------------------------------------------------------
|
||||
@@ -40,7 +333,7 @@ do
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
-- @field #CTLD_ENGINEERING
|
||||
-- @field #CTLD_ENGINEERING CTLD_ENGINEERING
|
||||
CTLD_ENGINEERING = {
|
||||
ClassName = "CTLD_ENGINEERING",
|
||||
lid = "",
|
||||
@@ -287,300 +580,6 @@ CTLD_ENGINEERING = {
|
||||
|
||||
end
|
||||
|
||||
|
||||
do
|
||||
|
||||
------------------------------------------------------
|
||||
--- **CTLD_CARGO** class, extends Core.Base#BASE
|
||||
-- @type CTLD_CARGO
|
||||
-- @field #string ClassName Class name.
|
||||
-- @field #number ID ID of this cargo.
|
||||
-- @field #string Name Name for menu.
|
||||
-- @field #table Templates Table of #POSITIONABLE objects.
|
||||
-- @field #string CargoType Enumerator of Type.
|
||||
-- @field #boolean HasBeenMoved Flag for moving.
|
||||
-- @field #boolean LoadDirectly Flag for direct loading.
|
||||
-- @field #number CratesNeeded Crates needed to build.
|
||||
-- @field Wrapper.Positionable#POSITIONABLE Positionable Representation of cargo in the mission.
|
||||
-- @field #boolean HasBeenDropped True if dropped from heli.
|
||||
-- @field #number PerCrateMass Mass in kg.
|
||||
-- @field #number Stock Number of builds available, -1 for unlimited.
|
||||
-- @field #string Subcategory Sub-category name.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
-- @field #CTLD_CARGO CTLD_CARGO
|
||||
CTLD_CARGO = {
|
||||
ClassName = "CTLD_CARGO",
|
||||
ID = 0,
|
||||
Name = "none",
|
||||
Templates = {},
|
||||
CargoType = "none",
|
||||
HasBeenMoved = false,
|
||||
LoadDirectly = false,
|
||||
CratesNeeded = 0,
|
||||
Positionable = nil,
|
||||
HasBeenDropped = false,
|
||||
PerCrateMass = 0,
|
||||
Stock = nil,
|
||||
Mark = nil,
|
||||
}
|
||||
|
||||
--- Define cargo types.
|
||||
-- @type CTLD_CARGO.Enum
|
||||
-- @field #string VEHICLE
|
||||
-- @field #string TROOPS
|
||||
-- @field #string FOB
|
||||
-- @field #string CRATE
|
||||
-- @field #string REPAIR
|
||||
-- @field #string ENGINEERS
|
||||
-- @field #string STATIC
|
||||
CTLD_CARGO.Enum = {
|
||||
VEHICLE = "Vehicle", -- #string vehicles
|
||||
TROOPS = "Troops", -- #string troops
|
||||
FOB = "FOB", -- #string FOB
|
||||
CRATE = "Crate", -- #string crate
|
||||
REPAIR = "Repair", -- #string repair
|
||||
ENGINEERS = "Engineers", -- #string engineers
|
||||
STATIC = "Static", -- #string statics
|
||||
}
|
||||
|
||||
--- Function to create new CTLD_CARGO object.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @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 Sorte Enumerator of Type.
|
||||
-- @param #boolean HasBeenMoved Flag for moving.
|
||||
-- @param #boolean LoadDirectly Flag for direct loading.
|
||||
-- @param #number CratesNeeded Crates needed to build.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE Positionable Representation of cargo in the mission.
|
||||
-- @param #boolean Dropped Cargo/Troops have been unloaded from a chopper.
|
||||
-- @param #number PerCrateMass Mass in kg
|
||||
-- @param #number Stock Number of builds available, nil for unlimited
|
||||
-- @param #string Subcategory Name of subcategory, handy if using > 10 types to load.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory)
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD
|
||||
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 = Sorte or "type" -- #CTLD_CARGO.Enum
|
||||
self.HasBeenMoved = HasBeenMoved or false -- #boolean
|
||||
self.LoadDirectly = LoadDirectly or false -- #boolean
|
||||
self.CratesNeeded = CratesNeeded or 0 -- #number
|
||||
self.Positionable = Positionable or nil -- Wrapper.Positionable#POSITIONABLE
|
||||
self.HasBeenDropped = Dropped or false --#boolean
|
||||
self.PerCrateMass = PerCrateMass or 0 -- #number
|
||||
self.Stock = Stock or nil --#number
|
||||
self.Mark = nil
|
||||
self.Subcategory = Subcategory or "Other"
|
||||
return self
|
||||
end
|
||||
|
||||
--- Query ID.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number ID
|
||||
function CTLD_CARGO:GetID()
|
||||
return self.ID
|
||||
end
|
||||
|
||||
--- Query Subcategory
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string SubCategory
|
||||
function CTLD_CARGO:GetSubCat()
|
||||
return self.Subcategory
|
||||
end
|
||||
|
||||
--- Query Mass.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Mass in kg
|
||||
function CTLD_CARGO:GetMass()
|
||||
return self.PerCrateMass
|
||||
end
|
||||
|
||||
--- Query Name.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string Name
|
||||
function CTLD_CARGO:GetName()
|
||||
return self.Name
|
||||
end
|
||||
|
||||
--- Query Templates.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #table Templates
|
||||
function CTLD_CARGO:GetTemplates()
|
||||
return self.Templates
|
||||
end
|
||||
|
||||
--- Query has moved.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean Has moved
|
||||
function CTLD_CARGO:HasMoved()
|
||||
return self.HasBeenMoved
|
||||
end
|
||||
|
||||
--- Query was dropped.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean Has been dropped.
|
||||
function CTLD_CARGO:WasDropped()
|
||||
return self.HasBeenDropped
|
||||
end
|
||||
|
||||
--- Query directly loadable.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean loadable
|
||||
function CTLD_CARGO:CanLoadDirectly()
|
||||
return self.LoadDirectly
|
||||
end
|
||||
|
||||
--- Query number of crates or troopsize.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Crates or size of troops.
|
||||
function CTLD_CARGO:GetCratesNeeded()
|
||||
return self.CratesNeeded
|
||||
end
|
||||
|
||||
--- Query type.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO.Enum Type
|
||||
function CTLD_CARGO:GetType()
|
||||
return self.CargoType
|
||||
end
|
||||
|
||||
--- Query type.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return Wrapper.Positionable#POSITIONABLE Positionable
|
||||
function CTLD_CARGO:GetPositionable()
|
||||
return self.Positionable
|
||||
end
|
||||
|
||||
--- Set HasMoved.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean moved
|
||||
function CTLD_CARGO:SetHasMoved(moved)
|
||||
self.HasBeenMoved = moved or false
|
||||
end
|
||||
|
||||
--- Query if cargo has been loaded.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean loaded
|
||||
function CTLD_CARGO:Isloaded()
|
||||
if self.HasBeenMoved and not self.WasDropped() then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Set WasDropped.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean dropped
|
||||
function CTLD_CARGO:SetWasDropped(dropped)
|
||||
self.HasBeenDropped = dropped or false
|
||||
end
|
||||
|
||||
--- Get Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number Stock
|
||||
function CTLD_CARGO:GetStock()
|
||||
if self.Stock then
|
||||
return self.Stock
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
--- Add Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to add, none if nil.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:AddStock(Number)
|
||||
if self.Stock then -- Stock nil?
|
||||
local number = Number or 1
|
||||
self.Stock = self.Stock + number
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to reduce, none if nil.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:RemoveStock(Number)
|
||||
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
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set Stock.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #number Number to set, nil means unlimited.
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:SetStock(Number)
|
||||
self.Stock = Number
|
||||
return self
|
||||
end
|
||||
|
||||
--- Query crate type for REPAIR
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @param #boolean
|
||||
function CTLD_CARGO:IsRepair()
|
||||
if self.CargoType == "Repair" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Query crate type for STATIC
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #boolean
|
||||
function CTLD_CARGO:IsStatic()
|
||||
if self.CargoType == "Static" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Add mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:AddMark(Mark)
|
||||
self.Mark = Mark
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #string Mark
|
||||
function CTLD_CARGO:GetMark(Mark)
|
||||
return self.Mark
|
||||
end
|
||||
|
||||
--- Wipe mark
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:WipeMark()
|
||||
self.Mark = nil
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get overall mass of a cargo object, i.e. crates needed x mass per crate
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return #number mass
|
||||
function CTLD_CARGO:GetNetMass()
|
||||
return self.CratesNeeded * self.PerCrateMass
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO CTLD
|
||||
@@ -1220,7 +1219,7 @@ CTLD.UnitTypes = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.0.34"
|
||||
CTLD.version="1.0.35"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@@ -4731,6 +4730,7 @@ end
|
||||
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
||||
-- @param #table Surfacetypes (Optional) Table of surface types. Can also be a single surface type. We will try max 1000 times to find the right type!
|
||||
-- @param #boolean PreciseLocation (Optional) Don't try to get a random position in the zone but use the dead center. Caution not to stack up stuff on another!
|
||||
-- @param #string Structure (Optional) String object describing the current structure of the injected group; mainly for load/save to keep current state setup.
|
||||
-- @return #CTLD self
|
||||
-- @usage Use this function to pre-populate the field with Troops or Engineers at a random coordinate in a zone:
|
||||
-- -- create a matching #CTLD_CARGO type
|
||||
@@ -4739,7 +4739,7 @@ end
|
||||
-- local dropzone = ZONE:New("InjectZone") -- Core.Zone#ZONE
|
||||
-- -- and go:
|
||||
-- my_ctld:InjectTroops(dropzone,InjectTroopsType,{land.SurfaceType.LAND})
|
||||
function CTLD:InjectTroops(Zone,Cargo,Surfacetypes,PreciseLocation)
|
||||
function CTLD:InjectTroops(Zone,Cargo,Surfacetypes,PreciseLocation,Structure)
|
||||
self:T(self.lid.." InjectTroops")
|
||||
local cargo = Cargo -- #CTLD_CARGO
|
||||
|
||||
@@ -4757,6 +4757,49 @@ end
|
||||
return match
|
||||
end
|
||||
|
||||
local function Cruncher(group,typename,anzahl)
|
||||
local units = group:GetUnits()
|
||||
local reduced = 0
|
||||
for _,_unit in pairs (units) do
|
||||
local typo = _unit:GetTypeName()
|
||||
if typename == typo then
|
||||
_unit:Destroy(false)
|
||||
reduced = reduced + 1
|
||||
if reduced == anzahl then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function PostSpawn(args)
|
||||
local group = args[1]
|
||||
local structure = args[2]
|
||||
if structure then
|
||||
|
||||
local loadedstructure = {}
|
||||
local strcset = UTILS.Split(structure,";")
|
||||
for _,_data in pairs(strcset) do
|
||||
local datasplit = UTILS.Split(_data,"==")
|
||||
loadedstructure[datasplit[1]] = tonumber(datasplit[2])
|
||||
end
|
||||
|
||||
local originalstructure = UTILS.GetCountPerTypeName(group)
|
||||
|
||||
for _name,_number in pairs(originalstructure) do
|
||||
local loadednumber = 0
|
||||
if loadedstructure[_name] then
|
||||
loadednumber = loadedstructure[_name]
|
||||
end
|
||||
local reduce = false
|
||||
if loadednumber < _number then reduce = true end
|
||||
|
||||
if reduce then
|
||||
Cruncher(group,_name,_number-loadednumber)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not IsTroopsMatch(cargo) then
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
cargo.ID = self.CargoCounter
|
||||
@@ -4793,6 +4836,11 @@ end
|
||||
local grpname = self.DroppedTroops[self.TroopCounter]:GetName()
|
||||
self.EngineersInField[self.Engineers] = CTLD_ENGINEERING:New(name, grpname)
|
||||
end
|
||||
|
||||
if Structure then
|
||||
BASE:ScheduleOnce(0.5,PostSpawn,{self.DroppedTroops[self.TroopCounter],Structure})
|
||||
end
|
||||
|
||||
if self.eventoninject then
|
||||
self:__TroopsDeployed(1,nil,nil,self.DroppedTroops[self.TroopCounter],type)
|
||||
end
|
||||
@@ -4806,6 +4854,7 @@ end
|
||||
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
||||
-- @param #table Surfacetypes (Optional) Table of surface types. Can also be a single surface type. We will try max 1000 times to find the right type!
|
||||
-- @param #boolean PreciseLocation (Optional) Don't try to get a random position in the zone but use the dead center. Caution not to stack up stuff on another!
|
||||
-- @param #string Structure (Optional) String object describing the current structure of the injected group; mainly for load/save to keep current state setup.
|
||||
-- @return #CTLD self
|
||||
-- @usage Use this function to pre-populate the field with Vehicles or FOB at a random coordinate in a zone:
|
||||
-- -- create a matching #CTLD_CARGO type
|
||||
@@ -4814,7 +4863,7 @@ end
|
||||
-- local dropzone = ZONE:New("InjectZone") -- Core.Zone#ZONE
|
||||
-- -- and go:
|
||||
-- my_ctld:InjectVehicles(dropzone,InjectVehicleType)
|
||||
function CTLD:InjectVehicles(Zone,Cargo,Surfacetypes,PreciseLocation)
|
||||
function CTLD:InjectVehicles(Zone,Cargo,Surfacetypes,PreciseLocation,Structure)
|
||||
self:T(self.lid.." InjectVehicles")
|
||||
local cargo = Cargo -- #CTLD_CARGO
|
||||
|
||||
@@ -4832,6 +4881,49 @@ end
|
||||
return match
|
||||
end
|
||||
|
||||
local function Cruncher(group,typename,anzahl)
|
||||
local units = group:GetUnits()
|
||||
local reduced = 0
|
||||
for _,_unit in pairs (units) do
|
||||
local typo = _unit:GetTypeName()
|
||||
if typename == typo then
|
||||
_unit:Destroy(false)
|
||||
reduced = reduced + 1
|
||||
if reduced == anzahl then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function PostSpawn(args)
|
||||
local group = args[1]
|
||||
local structure = args[2]
|
||||
if structure then
|
||||
|
||||
local loadedstructure = {}
|
||||
local strcset = UTILS.Split(structure,";")
|
||||
for _,_data in pairs(strcset) do
|
||||
local datasplit = UTILS.Split(_data,"==")
|
||||
loadedstructure[datasplit[1]] = tonumber(datasplit[2])
|
||||
end
|
||||
|
||||
local originalstructure = UTILS.GetCountPerTypeName(group)
|
||||
|
||||
for _name,_number in pairs(originalstructure) do
|
||||
local loadednumber = 0
|
||||
if loadedstructure[_name] then
|
||||
loadednumber = loadedstructure[_name]
|
||||
end
|
||||
local reduce = false
|
||||
if loadednumber < _number then reduce = true end
|
||||
|
||||
if reduce then
|
||||
Cruncher(group,_name,_number-loadednumber)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not IsVehicMatch(cargo) then
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
cargo.ID = self.CargoCounter
|
||||
@@ -4866,6 +4958,11 @@ end
|
||||
:InitDelayOff()
|
||||
:SpawnFromVec2(randomcoord)
|
||||
end
|
||||
|
||||
if Structure then
|
||||
BASE:ScheduleOnce(0.5,PostSpawn,{self.DroppedTroops[self.TroopCounter],Structure})
|
||||
end
|
||||
|
||||
if self.eventoninject then
|
||||
self:__CratesBuild(1,nil,nil,self.DroppedTroops[self.TroopCounter])
|
||||
end
|
||||
@@ -5250,6 +5347,7 @@ end
|
||||
-- name matching a template in the table
|
||||
local match = false
|
||||
local cargo = nil
|
||||
name = string.gsub(name,"-"," ")
|
||||
for _ind,_cargo in pairs (table) do
|
||||
local thiscargo = _cargo -- #CTLD_CARGO
|
||||
local template = thiscargo:GetTemplates()
|
||||
@@ -5257,6 +5355,7 @@ end
|
||||
template = { template }
|
||||
end
|
||||
for _,_name in pairs (template) do
|
||||
_name = string.gsub(_name,"-"," ")
|
||||
if string.find(name,_name) and _cargo:GetType() ~= CTLD_CARGO.Enum.REPAIR then
|
||||
match = true
|
||||
cargo = thiscargo
|
||||
@@ -5269,18 +5368,21 @@ end
|
||||
|
||||
|
||||
--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,Structure\n"
|
||||
local n = 0
|
||||
for _,_grp in pairs(grouptable) do
|
||||
local group = _grp -- Wrapper.Group#GROUP
|
||||
if group and group:IsAlive() then
|
||||
-- get template name
|
||||
local name = group:GetName()
|
||||
local template = string.gsub(name,"-(.+)$","")
|
||||
local template = name
|
||||
|
||||
if string.find(template,"#") then
|
||||
template = string.gsub(name,"#(%d+)$","")
|
||||
end
|
||||
|
||||
local template = string.gsub(name,"-(%d+)$","")
|
||||
|
||||
local match, cargo = FindCargoType(template,cgotable)
|
||||
if not match then
|
||||
match, cargo = FindCargoType(template,cgovehic)
|
||||
@@ -5293,6 +5395,11 @@ end
|
||||
local cgotype = cargo.CargoType
|
||||
local cgoneed = cargo.CratesNeeded
|
||||
local cgomass = cargo.PerCrateMass
|
||||
local structure = UTILS.GetCountPerTypeName(group)
|
||||
local strucdata = ""
|
||||
for typen,anzahl in pairs (structure) do
|
||||
strucdata = strucdata .. typen .. "=="..anzahl..";"
|
||||
end
|
||||
|
||||
if type(cgotemp) == "table" then
|
||||
local templates = "{"
|
||||
@@ -5304,8 +5411,8 @@ end
|
||||
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,%s\n"
|
||||
,template,location.x,location.y,location.z,cgoname,cgotemp,cgotype,cgoneed,cgomass,strucdata)
|
||||
data = data .. txt
|
||||
end
|
||||
end
|
||||
@@ -5460,7 +5567,7 @@ 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=SubCategory
|
||||
-- 1=Group,2=x,3=y,4=z,5=CargoName,6=CargoTemplates,7=CargoType,8=CratesNeeded,9=CrateMass,10=Structure
|
||||
local groupname = dataset[1]
|
||||
local vec2 = {}
|
||||
vec2.x = tonumber(dataset[2])
|
||||
@@ -5474,14 +5581,19 @@ end
|
||||
cargotemplates = UTILS.Split(cargotemplates,";")
|
||||
local size = tonumber(dataset[8])
|
||||
local mass = tonumber(dataset[9])
|
||||
local structure = nil
|
||||
if dataset[10] 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)
|
||||
self:InjectVehicles(dropzone,injectvehicle,self.surfacetypes,self.useprecisecoordloads)
|
||||
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)
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user