diff --git a/binaries/data/mods/public/simulation/ai/aegis/gamestate-extend.js b/binaries/data/mods/public/simulation/ai/aegis/gamestate-extend.js index 53e2adf4ee..63cd6f83d3 100644 --- a/binaries/data/mods/public/simulation/ai/aegis/gamestate-extend.js +++ b/binaries/data/mods/public/simulation/ai/aegis/gamestate-extend.js @@ -9,7 +9,7 @@ m.IsSupplyFull = function(gamestate, supply) { if (supply.isFull(PlayerID) === true) return true; - var count = supply.resourceSupplyGatherers(PlayerID).length; + var count = supply.resourceSupplyGatherers().length; if (gamestate.turnCache["ressourceGatherer"] && gamestate.turnCache["ressourceGatherer"][supply.id()]) count += gamestate.turnCache["ressourceGatherer"][supply.id()]; if (count >= supply.maxGatherers()) diff --git a/binaries/data/mods/public/simulation/ai/aegis/worker.js b/binaries/data/mods/public/simulation/ai/aegis/worker.js index 37ce77dee9..dbb06db172 100644 --- a/binaries/data/mods/public/simulation/ai/aegis/worker.js +++ b/binaries/data/mods/public/simulation/ai/aegis/worker.js @@ -495,7 +495,7 @@ m.Worker.prototype.startHunting = function(gameState, baseManager){ if (supply.getMetadata(PlayerID, "inaccessible") === true) return; - if (supply.isFull(PlayerID) === true) + if (supply.isFull() === true) return; if (!supply.hasClass("Animal")) diff --git a/binaries/data/mods/public/simulation/ai/common-api/entity.js b/binaries/data/mods/public/simulation/ai/common-api/entity.js index e645650358..a84a979d06 100644 --- a/binaries/data/mods/public/simulation/ai/common-api/entity.js +++ b/binaries/data/mods/public/simulation/ai/common-api/entity.js @@ -601,17 +601,17 @@ m.Entity = m.Class({ return this._entity.resourceSupplyAmount; }, - resourceSupplyGatherers: function(player) + resourceSupplyGatherers: function() { if (this._entity.resourceSupplyGatherers !== undefined) - return this._entity.resourceSupplyGatherers[player]; + return this._entity.resourceSupplyGatherers; return []; }, - isFull: function(player) + isFull: function() { if (this._entity.resourceSupplyGatherers !== undefined) - return (this.maxGatherers() === this._entity.resourceSupplyGatherers[player].length); + return (this.maxGatherers() === this._entity.resourceSupplyGatherers.length); return undefined; }, diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index 079fc25f17..15eadd59a0 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -395,7 +395,7 @@ GuiInterface.prototype.GetExtendedEntityState = function(player, ent) "type": cmpResourceSupply.GetType(), "killBeforeGather": cmpResourceSupply.GetKillBeforeGather(), "maxGatherers": cmpResourceSupply.GetMaxGatherers(), - "gatherers": cmpResourceSupply.GetGatherers(player) + "gatherers": cmpResourceSupply.GetGatherers() }; } diff --git a/binaries/data/mods/public/simulation/components/ResourceGatherer.js b/binaries/data/mods/public/simulation/components/ResourceGatherer.js index e9e4e2fa7f..f60136c8f8 100644 --- a/binaries/data/mods/public/simulation/components/ResourceGatherer.js +++ b/binaries/data/mods/public/simulation/components/ResourceGatherer.js @@ -277,7 +277,7 @@ ResourceGatherer.prototype.GetTargetGatherRate = function(target) var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); var diminishingReturns = cmpResourceSupply.GetDiminishingReturns(); if (diminishingReturns) - rate = (0.5 * Math.cos((cmpResourceSupply.GetGatherers(cmpOwnership.GetOwner()).length - 1) * Math.PI / diminishingReturns) + 0.5) * rate; + rate = (0.5 * Math.cos((cmpResourceSupply.GetGatherers().length - 1) * Math.PI / diminishingReturns) + 0.5) * rate; return rate || 0; }; diff --git a/binaries/data/mods/public/simulation/components/ResourceSupply.js b/binaries/data/mods/public/simulation/components/ResourceSupply.js index 809df750fb..1c9a0fae2a 100644 --- a/binaries/data/mods/public/simulation/components/ResourceSupply.js +++ b/binaries/data/mods/public/simulation/components/ResourceSupply.js @@ -78,11 +78,18 @@ ResourceSupply.prototype.GetMaxGatherers = function() return +this.template.MaxGatherers; }; -ResourceSupply.prototype.GetGatherers = function(player) +ResourceSupply.prototype.GetGatherers = function() { - if (player === undefined) - return this.gatherers; - return this.gatherers[player]; + //if (player === undefined) + // return this.gatherers; + // + // + var numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers(); + var total = []; + for (var playerid = 0; playerid <= numPlayers; playerid++) + for (var gatherer = 0; gatherer < this.gatherers[playerid].length; gatherer++) + total.push(this.gatherers[playerid][gatherer]); + return total; }; ResourceSupply.prototype.GetDiminishingReturns = function() @@ -122,7 +129,7 @@ ResourceSupply.prototype.GetType = function() ResourceSupply.prototype.IsAvailable = function(player, gathererID) { - if (this.gatherers[player].length < this.GetMaxGatherers() || this.gatherers[player].indexOf(gathererID) !== -1) + if (this.GetGatherers().length < this.GetMaxGatherers() || this.gatherers[player].indexOf(gathererID) !== -1) return true; return false; };