Fix soviet-06 harvester production crash

This commit is contained in:
JovialFeline
2025-02-26 13:55:31 -05:00
committed by Gustas
parent 4ea0e70589
commit 82ee3d779c
2 changed files with 24 additions and 20 deletions

View File

@@ -23,8 +23,8 @@ ProduceInfantry = function(barracks)
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(AlliedInfantryTypes) } local toBuild = { Utils.Random(AlliedInfantryTypes) }
local path = Utils.Random(AttackPaths) local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function(units)
InfAttack[#InfAttack + 1] = unit[1] InfAttack[#InfAttack + 1] = units[1]
if #InfAttack >= 10 then if #InfAttack >= 10 then
SendUnits(InfAttack, path) SendUnits(InfAttack, path)
@@ -41,18 +41,19 @@ ProduceInfantry = function(barracks)
end end
ProduceArmor = function(factory) ProduceArmor = function(factory)
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
if factory.IsDead or factory.Owner ~= Greece then if factory.IsDead or factory.Owner ~= Greece then
return return
elseif IsHarvesterMissing() then elseif IsHarvesterMissing() then
ProduceHarvester(factory) ProduceHarvester(factory, delay)
return return
end end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
local toBuild = { Utils.Random(AlliedArmorTypes) } local toBuild = { Utils.Random(AlliedArmorTypes) }
local path = Utils.Random(AttackPaths) local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function(units)
ArmorAttack[#ArmorAttack + 1] = unit[1] ArmorAttack[#ArmorAttack + 1] = units[1]
if #ArmorAttack >= 6 then if #ArmorAttack >= 6 then
SendUnits(ArmorAttack, path) SendUnits(ArmorAttack, path)
@@ -68,15 +69,16 @@ ProduceArmor = function(factory)
end) end)
end end
ProduceHarvester = function(factory) ProduceHarvester = function(factory, delay)
if GreeceMoney() < Actor.Cost("harv") then if GreeceMoney() < Actor.Cost("harv") then
return return
end end
local toBuild = { "harv" } local toBuild = { "harv" }
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function()
unit.FindResources() Trigger.AfterDelay(delay, function()
ProduceArmor(factory) ProduceArmor(factory)
end)
end) end)
end end

View File

@@ -23,8 +23,8 @@ ProduceInfantry = function(barracks)
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(AlliedInfantryTypes) } local toBuild = { Utils.Random(AlliedInfantryTypes) }
local path = Utils.Random(AttackPaths) local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function(units)
InfAttack[#InfAttack + 1] = unit[1] InfAttack[#InfAttack + 1] = units[1]
if #InfAttack >= 10 then if #InfAttack >= 10 then
SendUnits(InfAttack, path) SendUnits(InfAttack, path)
@@ -41,18 +41,19 @@ ProduceInfantry = function(barracks)
end end
ProduceArmor = function(factory) ProduceArmor = function(factory)
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
if factory.IsDead or factory.Owner ~= Greece then if factory.IsDead or factory.Owner ~= Greece then
return return
elseif IsHarvesterMissing() then elseif IsHarvesterMissing() then
ProduceHarvester(factory) ProduceHarvester(factory, delay)
return return
end end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
local toBuild = { Utils.Random(AlliedArmorTypes) } local toBuild = { Utils.Random(AlliedArmorTypes) }
local path = Utils.Random(AttackPaths) local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function(units)
ArmorAttack[#ArmorAttack + 1] = unit[1] ArmorAttack[#ArmorAttack + 1] = units[1]
if #ArmorAttack >= 6 then if #ArmorAttack >= 6 then
SendUnits(ArmorAttack, path) SendUnits(ArmorAttack, path)
@@ -68,15 +69,16 @@ ProduceArmor = function(factory)
end) end)
end end
ProduceHarvester = function(factory) ProduceHarvester = function(factory, delay)
if GreeceMoney() < Actor.Cost("harv") then if GreeceMoney() < Actor.Cost("harv") then
return return
end end
local toBuild = { "harv" } local toBuild = { "harv" }
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function()
unit.FindResources() Trigger.AfterDelay(delay, function()
ProduceArmor(factory) ProduceArmor(factory)
end)
end) end)
end end