mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
Added some extra garrison related functions. Fixes #1164.
This was SVN commit r11067.
This commit is contained in:
@@ -148,8 +148,6 @@ var EntityTemplate = Class({
|
||||
return +this._template.ResourceSupply.Amount;
|
||||
},
|
||||
|
||||
|
||||
|
||||
resourceGatherRates: function() {
|
||||
if (!this._template.ResourceGatherer)
|
||||
return undefined;
|
||||
@@ -164,14 +162,21 @@ var EntityTemplate = Class({
|
||||
return undefined;
|
||||
return this._template.ResourceDropsite.Types.split(/\s+/);
|
||||
},
|
||||
|
||||
|
||||
garrisonableClasses: function() {
|
||||
|
||||
garrisonableClasses: function()
|
||||
{
|
||||
if (!this._template.GarrisonHolder)
|
||||
return undefined;
|
||||
return this._template.GarrisonHolder.List._string.split(/\s+/);
|
||||
},
|
||||
|
||||
|
||||
garrisonMax: function()
|
||||
{
|
||||
if (!this._template.GarrisonHolder)
|
||||
return undefined;
|
||||
|
||||
return this._template.GarrisonHolder.Max;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns whether this is an animal that is too difficult to hunt.
|
||||
@@ -326,13 +331,18 @@ var Entity = Class({
|
||||
resourceSupplyAmount: function() { return this._entity.resourceSupplyAmount; },
|
||||
|
||||
resourceCarrying: function() { return this._entity.resourceCarrying; },
|
||||
|
||||
//Garrison related
|
||||
|
||||
garrisoned: function() { return new EntityCollection(this._ai, this._entity.garrisoned); },
|
||||
|
||||
garrisonSpaceAvailable: function()
|
||||
{
|
||||
return (this.garrisonMax() - this.garrisoned().length);
|
||||
},
|
||||
|
||||
// TODO: visibility
|
||||
|
||||
|
||||
move: function(x, z, queued) {
|
||||
queued = queued || false;
|
||||
Engine.PostCommand({"type": "walk", "entities": [this.id()], "x": x, "z": z, "queued": queued});
|
||||
|
||||
Reference in New Issue
Block a user