From 627edd4ac2bc082015e778661bd1b4cfa6bb952a Mon Sep 17 00:00:00 2001 From: Biofreak1987 Date: Thu, 12 Nov 2015 13:34:48 +0100 Subject: [PATCH] Fix ai building in soviet04/06 missions despite killed construction yard --- mods/ra/maps/soviet-04a/soviet04a-AI.lua | 12 ++++++------ mods/ra/maps/soviet-04b/soviet04b-AI.lua | 12 ++++++------ mods/ra/maps/soviet-06a/soviet06a-AI.lua | 12 ++++++------ mods/ra/maps/soviet-06b/soviet06b-AI.lua | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/mods/ra/maps/soviet-04a/soviet04a-AI.lua b/mods/ra/maps/soviet-04a/soviet04a-AI.lua index 6b4816ffea..0ef9ff3399 100644 --- a/mods/ra/maps/soviet-04a/soviet04a-AI.lua +++ b/mods/ra/maps/soviet-04a/soviet04a-AI.lua @@ -23,12 +23,6 @@ BaseBuildings = } BuildBase = function() - if CYard.IsDead or CYard.Owner ~= Greece then - return - elseif Harvester.IsDead and Greece.Resources <= 299 then - return - end - for i,v in ipairs(BaseBuildings) do if not v.exists then BuildBuilding(v) @@ -41,6 +35,12 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() + if CYard.IsDead or CYard.Owner ~= Greece then + return + elseif Harvester.IsDead and Greece.Resources <= 299 then + return + end + local actor = Actor.Create(building.type, true, { Owner = Greece, Location = GreeceCYard.Location + building.pos }) Greece.Cash = Greece.Cash - building.cost diff --git a/mods/ra/maps/soviet-04b/soviet04b-AI.lua b/mods/ra/maps/soviet-04b/soviet04b-AI.lua index 0d6721caa9..c549bd300c 100644 --- a/mods/ra/maps/soviet-04b/soviet04b-AI.lua +++ b/mods/ra/maps/soviet-04b/soviet04b-AI.lua @@ -19,12 +19,6 @@ BaseWeaponsFactory = { type = "weap", pos = CVec.New(-12, -1), cost = 2000, exis BaseBuildings = { BasePower, BaseBarracks, BaseProc, BaseWeaponsFactory } BuildBase = function() - if CYard.IsDead or CYard.Owner ~= Greece then - return - elseif Harvester.IsDead and Greece.Resources <= 299 then - return - end - for i,v in ipairs(BaseBuildings) do if not v.exists then BuildBuilding(v) @@ -37,6 +31,12 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() + if CYard.IsDead or CYard.Owner ~= Greece then + return + elseif Harvester.IsDead and Greece.Resources <= 299 then + return + end + local actor = Actor.Create(building.type, true, { Owner = Greece, Location = GreeceCYard.Location + building.pos }) Greece.Cash = Greece.Cash - building.cost diff --git a/mods/ra/maps/soviet-06a/soviet06a-AI.lua b/mods/ra/maps/soviet-06a/soviet06a-AI.lua index 5351940bc7..3e99a8ee62 100644 --- a/mods/ra/maps/soviet-06a/soviet06a-AI.lua +++ b/mods/ra/maps/soviet-06a/soviet06a-AI.lua @@ -20,12 +20,6 @@ BaseApwr2 = { type = "apwr", pos = CVec.New(-4, 1), cost = 500, exists = true } BaseBuildings = { BaseApwr, BaseTent, BaseProc, BaseWeap, BaseApwr2 } BuildBase = function() - if CYard.IsDead or CYard.Owner ~= enemy then - return - elseif Harvester.IsDead and enemy.Resources <= 299 then - return - end - for i,v in ipairs(BaseBuildings) do if not v.exists then BuildBuilding(v) @@ -38,6 +32,12 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() + if CYard.IsDead or CYard.Owner ~= enemy then + return + elseif Harvester.IsDead and enemy.Resources <= 299 then + return + end + local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos }) enemy.Cash = enemy.Cash - building.cost diff --git a/mods/ra/maps/soviet-06b/soviet06b-AI.lua b/mods/ra/maps/soviet-06b/soviet06b-AI.lua index 8391b0cd2b..d69a78fa15 100644 --- a/mods/ra/maps/soviet-06b/soviet06b-AI.lua +++ b/mods/ra/maps/soviet-06b/soviet06b-AI.lua @@ -20,12 +20,6 @@ BaseApwr2 = { type = "apwr", pos = CVec.New(6, -5), cost = 500, exists = true } BaseBuildings = { BaseApwr, BaseTent, BaseProc, BaseWeap, BaseApwr2 } BuildBase = function() - if CYard.IsDead or CYard.Owner ~= enemy then - return - elseif Harvester.IsDead and enemy.Resources <= 299 then - return - end - for i,v in ipairs(BaseBuildings) do if not v.exists then BuildBuilding(v) @@ -38,6 +32,12 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() + if CYard.IsDead or CYard.Owner ~= enemy then + return + elseif Harvester.IsDead and enemy.Resources <= 299 then + return + end + local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos }) enemy.Cash = enemy.Cash - building.cost