Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2023-12-26 19:18:36 +01:00
commit e4cea7b3c4
2 changed files with 38 additions and 25 deletions

View File

@ -1228,7 +1228,7 @@ CTLD.UnitTypeCapabilities = {
--- CTLD class version. --- CTLD class version.
-- @field #string version -- @field #string version
CTLD.version="1.0.44" CTLD.version="1.0.45"
--- Instantiate a new CTLD. --- Instantiate a new CTLD.
-- @param #CTLD self -- @param #CTLD self
@ -2454,11 +2454,13 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
realcargo = CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,true,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],true,cargotype.PerCrateMass,nil,subcat) realcargo = CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,true,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],true,cargotype.PerCrateMass,nil,subcat)
table.insert(droppedcargo,realcargo) table.insert(droppedcargo,realcargo)
else else
realcargo = CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,false,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],false,cargotype.PerCrateMass,nil,subcat) realcargo = CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,false,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],false,cargotype.PerCrateMass,nil,subcat)
Cargo:RemoveStock()
end end
table.insert(self.Spawned_Cargo, realcargo) table.insert(self.Spawned_Cargo, realcargo)
end end
if not (drop or pack) then
Cargo:RemoveStock()
end
local text = string.format("Crates for %s have been positioned near you!",cratename) local text = string.format("Crates for %s have been positioned near you!",cratename)
if drop then if drop then
text = string.format("Crates for %s have been dropped!",cratename) text = string.format("Crates for %s have been dropped!",cratename)
@ -3824,7 +3826,7 @@ end
-- @param #CTLD_CARGO.Enum Type Type of cargo. I.e. VEHICLE or FOB. VEHICLE will move to destination zones when dropped/build, FOB stays put. -- @param #CTLD_CARGO.Enum Type Type of cargo. I.e. VEHICLE or FOB. VEHICLE will move to destination zones when dropped/build, FOB stays put.
-- @param #number NoCrates Number of crates needed to build this cargo. -- @param #number NoCrates Number of crates needed to build this cargo.
-- @param #number PerCrateMass Mass in kg of each crate -- @param #number PerCrateMass Mass in kg of each crate
-- @param #number Stock Number of groups in stock. Nil for unlimited. -- @param #number Stock Number of buildable groups in stock. Nil for unlimited.
-- @param #string SubCategory Name of sub-category (optional). -- @param #string SubCategory Name of sub-category (optional).
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory) function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory)
self:T(self.lid .. " AddCratesCargo") self:T(self.lid .. " AddCratesCargo")

View File

@ -160,52 +160,61 @@ do -- Sound File
-- @param #string FileName The name of the sound file, e.g. "Hello World.ogg". -- @param #string FileName The name of the sound file, e.g. "Hello World.ogg".
-- @param #string Path The path of the directory, where the sound file is located. Default is "l10n/DEFAULT/" within the miz file. -- @param #string Path The path of the directory, where the sound file is located. Default is "l10n/DEFAULT/" within the miz file.
-- @param #number Duration Duration in seconds, how long it takes to play the sound file. Default is 3 seconds. -- @param #number Duration Duration in seconds, how long it takes to play the sound file. Default is 3 seconds.
-- @param #bolean UseSrs Set if SRS should be used to play this file. Default is false.
-- @return #SOUNDFILE self -- @return #SOUNDFILE self
function SOUNDFILE:New(FileName, Path, Duration) function SOUNDFILE:New(FileName, Path, Duration, UseSrs)
-- Inherit BASE. -- Inherit BASE.
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDFILE local self=BASE:Inherit(self, BASE:New()) -- #SOUNDFILE
-- Debug info:
self:F( {FileName, Path, Duration, UseSrs} )
-- Set file name. -- Set file name.
self:SetFileName(FileName) self:SetFileName(FileName)
-- Set if SRS should be used to play this file
self:SetPlayWithSRS(UseSrs or false)
-- Set path. -- Set path.
self:SetPath(Path) self:SetPath(Path)
-- Set duration. -- Set duration.
self:SetDuration(Duration) self:SetDuration(Duration)
-- Debug info:
self:T(string.format("New SOUNDFILE: file name=%s, path=%s", self.filename, self.path))
return self return self
end end
--- Set path, where the sound file is located. --- Set path, where the sound file is located.
-- @param #SOUNDFILE self -- @param #SOUNDFILE self
-- @param #string Path Path to the directory, where the sound file is located. In case this is nil, it defaults to the DCS mission temp directory. -- @param #string Path Path to the directory, where the sound file is located. In case this is nil, it defaults to the DCS mission temp directory.
-- @return #SOUNDFILE self -- @return #SOUNDFILE self
function SOUNDFILE:SetPath(Path) function SOUNDFILE:SetPath(Path)
self:F( {Path} )
-- Init path. -- Init path.
self.path=Path or "l10n/DEFAULT/" if not Path then
if self.useSRS then -- use path to mission temp dir
if not Path and self.useSRS then -- use path to mission temp dir self.path = lfs.tempdir() .. "Mission\\l10n\\DEFAULT"
self.path = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT" else -- use internal path in miz file
end self.path="l10n/DEFAULT/"
end
end
-- Remove (back)slashes. -- Remove (back)slashes.
local nmax=1000 ; local n=1 local nmax=1000 ; local n=1
while (self.path:sub(-1)=="/" or self.path:sub(-1)==[[\]]) and n<=nmax do while (self.path:sub(-1)=="/" or self.path:sub(-1)==[[\]]) and n<=nmax do
self.path=self.path:sub(1,#self.path-1) self.path=self.path:sub(1,#self.path-1)
n=n+1 n=n+1
end end
-- Append slash. -- Append slash.
self.path=self.path.."/" self.path=self.path.."/"
self:T("self.path=".. self.path)
return self return self
end end
--- Get path of the directory, where the sound file is located. --- Get path of the directory, where the sound file is located.
-- @param #SOUNDFILE self -- @param #SOUNDFILE self
@ -228,7 +237,7 @@ do -- Sound File
--- Get the sound file name. --- Get the sound file name.
-- @param #SOUNDFILE self -- @param #SOUNDFILE self
-- @return #string Name of the soud file. This does *not* include its path. -- @return #string Name of the soud file. This does *not* include its path.
function SOUNDFILE:GetFileName() function SOUNDFILE:GetFileName()
return self.filename return self.filename
end end
@ -264,14 +273,16 @@ do -- Sound File
-- @param #boolean Switch If true or nil, use SRS. If false, use DCS transmission. -- @param #boolean Switch If true or nil, use SRS. If false, use DCS transmission.
-- @return #SOUNDFILE self -- @return #SOUNDFILE self
function SOUNDFILE:SetPlayWithSRS(Switch) function SOUNDFILE:SetPlayWithSRS(Switch)
self:F( {Switch} )
if Switch==true or Switch==nil then if Switch==true or Switch==nil then
self.useSRS=true self.useSRS=true
else else
self.useSRS=false self.useSRS=false
end end
self:T("self.useSRS=".. tostring(self.useSRS))
return self return self
end end
end end
do -- Text-To-Speech do -- Text-To-Speech