mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Petra: add missing changes in previous commit
This was SVN commit r16698.
This commit is contained in:
parent
9408860acc
commit
c1594c4bc8
2 changed files with 11 additions and 20 deletions
|
|
@ -717,27 +717,24 @@ m.Entity = m.Class({
|
|||
if (this.unitAIOrderData().length &&
|
||||
(this.unitAIState().split(".")[1] === "GATHER" || this.unitAIState().split(".")[1] === "RETURNRESOURCE"))
|
||||
{
|
||||
var ress = undefined;
|
||||
let res;
|
||||
// this is an abuse of "_ai" but it works.
|
||||
if (this.unitAIState().split(".")[1] === "GATHER" && this.unitAIOrderData()[0]["target"] !== undefined)
|
||||
ress = this._ai._entities.get(this.unitAIOrderData()[0]["target"]);
|
||||
res = this._ai._entities.get(this.unitAIOrderData()[0]["target"]);
|
||||
else if (this.unitAIOrderData()[1] !== undefined && this.unitAIOrderData()[1]["target"] !== undefined)
|
||||
ress = this._ai._entities.get(this.unitAIOrderData()[1]["target"]);
|
||||
|
||||
if (ress == undefined)
|
||||
res = this._ai._entities.get(this.unitAIOrderData()[1]["target"]);
|
||||
if (res === undefined)
|
||||
return undefined;
|
||||
|
||||
var type = ress.resourceSupplyType();
|
||||
var tstring = type.generic + "." + type.specific;
|
||||
|
||||
if (type.generic == "treasure")
|
||||
let type = res.resourceSupplyType();
|
||||
if (type.generic === "treasure")
|
||||
return 1000;
|
||||
|
||||
var speed = +this.get("ResourceGatherer/BaseSpeed");
|
||||
speed *= +this.get("ResourceGatherer/Rates/" +tstring);
|
||||
|
||||
if (speed)
|
||||
return speed;
|
||||
let tstring = type.generic + "." + type.specific;
|
||||
let rate = +this.get("ResourceGatherer/BaseSpeed");
|
||||
rate *= +this.get("ResourceGatherer/Rates/" +tstring);
|
||||
if (rate)
|
||||
return rate;
|
||||
return 0;
|
||||
}
|
||||
return undefined;
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ var API3 = function(m)
|
|||
m.GameState = function() {
|
||||
this.ai = null; // must be updated by the AIs.
|
||||
this.cellSize = 4.0; // Size of each map tile
|
||||
|
||||
this.buildingsBuilt = 0;
|
||||
this.turnCache = {};
|
||||
};
|
||||
|
||||
m.GameState.prototype.init = function(SharedScript, state, player) {
|
||||
|
|
@ -40,9 +37,6 @@ m.GameState.prototype.update = function(SharedScript, state) {
|
|||
this.playerData = SharedScript.playersData[this.player];
|
||||
this.techModifications = SharedScript._techModifications[this.player];
|
||||
this.barterPrices = SharedScript.barterPrices;
|
||||
|
||||
this.buildingsBuilt = 0;
|
||||
this.turnCache = {};
|
||||
};
|
||||
|
||||
m.GameState.prototype.updatingCollection = function(id, filter, collection)
|
||||
|
|
|
|||
Loading…
Reference in a new issue