Index: binaries/data/mods/public/simulation/components/Barter.js =================================================================== --- binaries/data/mods/public/simulation/components/Barter.js +++ binaries/data/mods/public/simulation/components/Barter.js @@ -39,11 +39,13 @@ var prices = { "buy": {}, "sell": {} }; let cmpPlayer = Engine.QueryInterface(playerEntity, IID_Player); let multiplier = cmpPlayer.GetBarterMultiplier(); + if (!multiplier) + multiplier = clone(prices); for (let resource of Resources.GetCodes()) { let truePrice = Resources.GetResource(resource).truePrice; - prices.buy[resource] = truePrice * (100 + this.CONSTANT_DIFFERENCE + this.priceDifferences[resource]) * multiplier.buy[resource] / 100; - prices.sell[resource] = truePrice * (100 - this.CONSTANT_DIFFERENCE + this.priceDifferences[resource]) * multiplier.sell[resource] / 100; + prices.buy[resource] = truePrice * (100 + this.CONSTANT_DIFFERENCE + this.priceDifferences[resource]) * (multiplier.buy[resource] || 1.0) / 100; + prices.sell[resource] = truePrice * (100 - this.CONSTANT_DIFFERENCE + this.priceDifferences[resource]) * (multiplier.sell[resource] || 1.0) / 100; } return prices; }; Index: binaries/data/mods/public/simulation/components/Player.js =================================================================== --- binaries/data/mods/public/simulation/components/Player.js +++ binaries/data/mods/public/simulation/components/Player.js @@ -1,25 +1,33 @@ function Player() {} Player.prototype.Schema = - "" + - "" + - "" + - Resources.BuildSchema("positiveDecimal") + - "" + - "" + - Resources.BuildSchema("positiveDecimal") + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; + "" + + "" + + "" + + "" + + Resources.BuildSchema("positiveDecimal") + + "" + + "" + + Resources.BuildSchema("positiveDecimal") + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; /** * Which units will be shown with special icons at the top. @@ -56,11 +64,11 @@ this.disabledTemplates = {}; this.disabledTechnologies = {}; this.startingTechnologies = []; - this.spyCostMultiplier = +this.template.SpyCostMultiplier; - this.barterMultiplier = { + this.spyCostMultiplier = this.template && this.template.SpyCostMultiplier ? +(this.template.SpyCostMultiplier) : undefined; + this.barterMultiplier = this.template && this.template.BarterMultiplier ? { "buy": clone(this.template.BarterMultiplier.Buy), "sell": clone(this.template.BarterMultiplier.Sell) - }; + } : undefined; // Initial resources and trading goods probability in steps of 5 let resCodes = Resources.GetCodes(); @@ -535,7 +543,7 @@ if (!cmpRangeManager || !cmpTechnologyManager) return; - if (!cmpTechnologyManager.IsTechnologyResearched(this.template.SharedLosTech)) + if (this.template && this.template.SharedLosTech && !cmpTechnologyManager.IsTechnologyResearched(this.template.SharedLosTech)) { cmpRangeManager.SetSharedLos(this.playerID, [this.playerID]); return; @@ -576,6 +584,8 @@ Player.prototype.HasSharedLos = function() { + if (!this.template || !this.template.SharedLosTech) + return false; let cmpTechnologyManager = Engine.QueryInterface(this.entity, IID_TechnologyManager); return cmpTechnologyManager && cmpTechnologyManager.IsTechnologyResearched(this.template.SharedLosTech); }; @@ -746,6 +756,9 @@ Player.prototype.OnResearchFinished = function(msg) { + if (!this.template) + return; + if (msg.tech == this.template.SharedLosTech) this.UpdateSharedLos(); else if (msg.tech == this.template.SharedDropsitesTech) Index: binaries/data/mods/public/simulation/templates/special/player_gaia.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player_gaia.xml +++ binaries/data/mods/public/simulation/templates/special/player_gaia.xml @@ -1,22 +1,4 @@ - - - - - 1.0 - - - 1.0 - 1.0 - 1.0 - 1.0 - - - 1.0 - 1.0 - 1.0 - 1.0 - - - + +