Revert gather limits to be global instead of per-player. Refs #1387
This was SVN commit r14848.
This commit is contained in:
parent
19724f7f41
commit
94c02ec33c
@ -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())
|
||||
|
@ -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"))
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -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()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user