Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/ResourceGatherer.js
Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | ResourceGatherer.prototype.GetTargetGatherRate = function(target) | ||||
let type = cmpResourceSupply.GetType(); | let type = cmpResourceSupply.GetType(); | ||||
let rate = 0; | let rate = 0; | ||||
if (type.specific) | if (type.specific) | ||||
rate = this.GetGatherRate(type.generic+"."+type.specific); | rate = this.GetGatherRate(type.generic+"."+type.specific); | ||||
if (rate == 0 && type.generic) | if (rate == 0 && type.generic) | ||||
rate = this.GetGatherRate(type.generic); | rate = this.GetGatherRate(type.generic); | ||||
let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); | |||||
let cheatMultiplier = cmpPlayer ? cmpPlayer.GetCheatTimeMultiplier() : 1; | |||||
rate = rate / cheatMultiplier; | |||||
if ("Mirages" in cmpResourceSupply) | if ("Mirages" in cmpResourceSupply) | ||||
return rate; | return rate; | ||||
// Apply diminishing returns with more gatherers, for e.g. infinite farms. For most resources this has no effect | // Apply diminishing returns with more gatherers, for e.g. infinite farms. For most resources this has no effect | ||||
// (GetDiminishingReturns will return null). We can assume that for resources that are miraged this is the case | // (GetDiminishingReturns will return null). We can assume that for resources that are miraged this is the case | ||||
// (else just add the diminishing returns data to the mirage data and remove the early return above) | // (else just add the diminishing returns data to the mirage data and remove the early return above) | ||||
let diminishingReturns = cmpResourceSupply.GetDiminishingReturns(); | let diminishingReturns = cmpResourceSupply.GetDiminishingReturns(); | ||||
if (diminishingReturns) | if (diminishingReturns) | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator