Spawn crates in a wider radius. Also build, when only one crate is required.

This commit is contained in:
Applevangelist 2021-07-05 18:54:29 +02:00
parent 04ef32420b
commit b7bc3cfbcf

View File

@ -513,7 +513,7 @@ CTLD.SkipFrequencies = {
--- CTLD class version. --- CTLD class version.
-- @field #string version -- @field #string version
CTLD.version="0.1.4r1" CTLD.version="0.1.4r2"
--- Instantiate a new CTLD. --- Instantiate a new CTLD.
-- @param #CTLD self -- @param #CTLD self
@ -1073,11 +1073,14 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
-- loop crates needed -- loop crates needed
for i=1,number do for i=1,number do
local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000)) local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000))
local cratedistance = i*4 + 6 local cratedistance = i*4 + 8
if IsHerc then if IsHerc then
-- wider radius -- wider radius
cratedistance = i*4 + 12 cratedistance = i*4 + 12
end end
for i=1,50 do
math.random(90,270)
end
local rheading = math.floor(math.random(90,270) * heading + 1 / 360) local rheading = math.floor(math.random(90,270) * heading + 1 / 360)
if not IsHerc then if not IsHerc then
rheading = rheading + 180 -- mirror for Helis rheading = rheading + 180 -- mirror for Helis
@ -1574,12 +1577,12 @@ function CTLD:_BuildCrates(Group, Unit)
foundbuilds = true foundbuilds = true
else else
buildables[name].Found = buildables[name].Found + 1 buildables[name].Found = buildables[name].Found + 1
foundbuilds = true
end
if buildables[name].Found >= buildables[name].Required then if buildables[name].Found >= buildables[name].Required then
buildables[name].CanBuild = true buildables[name].CanBuild = true
canbuild = true canbuild = true
end end
foundbuilds = true
end
--self:T{buildables = buildables}) --self:T{buildables = buildables})
end -- end dropped end -- end dropped
end -- end crate loop end -- end crate loop
@ -1638,7 +1641,7 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build)
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
local temptable = Build.Template or {} local temptable = Build.Template or {}
local zone = ZONE_GROUP:New(string.format("Unload zone-%s",unitname),Group,100) local zone = ZONE_GROUP:New(string.format("Unload zone-%s",unitname),Group,100)
local randomcoord = zone:GetRandomCoordinate(20,50):GetVec2() local randomcoord = zone:GetRandomCoordinate(35):GetVec2()
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))