From e0cfcbd80618e5d2c1f8e51f7cd03d681dd72fb9 Mon Sep 17 00:00:00 2001 From: sanderd17 Date: Mon, 11 Apr 2016 19:40:53 +0000 Subject: [PATCH] Enable technologies on captured buildings. Allow a negation on the civ selection in the technology json files. Patch by fatherbushido This was SVN commit r18021. --- .../public/simulation/components/ProductionQueue.js | 2 +- .../simulation/components/TechnologyManager.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/ProductionQueue.js b/binaries/data/mods/public/simulation/components/ProductionQueue.js index 0bf45fdd7b..d4a5f52a1c 100644 --- a/binaries/data/mods/public/simulation/components/ProductionQueue.js +++ b/binaries/data/mods/public/simulation/components/ProductionQueue.js @@ -152,7 +152,7 @@ ProductionQueue.prototype.GetTechnologiesList = function() var cmpPlayer = QueryOwnerInterface(this.entity); var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity); - if (!cmpPlayer || !cmpIdentity || cmpPlayer.GetCiv() != cmpIdentity.GetCiv()) + if (!cmpPlayer || !cmpIdentity) return []; var techs = string.split(/\s+/); diff --git a/binaries/data/mods/public/simulation/components/TechnologyManager.js b/binaries/data/mods/public/simulation/components/TechnologyManager.js index 5539b8b787..57dd8c5bba 100644 --- a/binaries/data/mods/public/simulation/components/TechnologyManager.js +++ b/binaries/data/mods/public/simulation/components/TechnologyManager.js @@ -170,14 +170,22 @@ TechnologyManager.prototype.CheckTechnologyRequirements = function(reqs) return false; } } - else if (reqs.civ) + else if (reqs.civ) { var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); - if (cmpPlayer && cmpPlayer.GetCiv() == reqs.civ) + if (cmpPlayer && cmpPlayer.GetCiv() == reqs.civ) return true; else return false; } + else if (reqs.notciv) + { + var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); + if (cmpPlayer && cmpPlayer.GetCiv() == reqs.notciv) + return false; + else + return true; + } // The technologies requirements are not a recognised format error("Bad requirements " + uneval(reqs));