Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/ResourceGatherer.js
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | |||||
* @return {boolean} - Whether we can gather from the target. | * @return {boolean} - Whether we can gather from the target. | ||||
*/ | */ | ||||
ResourceGatherer.prototype.CanGather = function(target) | ResourceGatherer.prototype.CanGather = function(target) | ||||
{ | { | ||||
return this.GetTargetGatherRate(target) > 0; | return this.GetTargetGatherRate(target) > 0; | ||||
}; | }; | ||||
/** | /** | ||||
* @param {number} target - The entity ID of the target to check. | |||||
* @return {boolean} - Whether we can gather from the target. | |||||
*/ | |||||
ResourceGatherer.prototype.CanGather = function(target) | |||||
{ | |||||
return this.GetTargetGatherRate(target) > 0; | |||||
}; | |||||
/** | |||||
* Returns whether this unit can carry more of the given type of resource. | * Returns whether this unit can carry more of the given type of resource. | ||||
* (This ignores whether the unit is actually able to gather that | * (This ignores whether the unit is actually able to gather that | ||||
* resource type or not.) | * resource type or not.) | ||||
*/ | */ | ||||
ResourceGatherer.prototype.CanCarryMore = function(type) | ResourceGatherer.prototype.CanCarryMore = function(type) | ||||
{ | { | ||||
let amount = this.carrying[type] || 0; | let amount = this.carrying[type] || 0; | ||||
return amount < this.GetCapacity(type); | return amount < this.GetCapacity(type); | ||||
▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator