Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GarrisonHolder.js
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
GarrisonHolder.prototype.GetEntities = function() | GarrisonHolder.prototype.GetEntities = function() | ||||
{ | { | ||||
return this.entities; | return this.entities; | ||||
}; | }; | ||||
/** | /** | ||||
* Get the entity IDs of the entities which are not visibly garrisoned. | |||||
* Used in the GUI to display in the garrison panel. | |||||
* | |||||
* @return {number[]} - An array containing entity IDs. | |||||
*/ | |||||
GarrisonHolder.prototype.GetHiddenGarrisonedEntities = function() | |||||
{ | |||||
return this.entities.filter(entity => !this.IsVisiblyGarrisoned(entity)); | |||||
}; | |||||
/** | |||||
* Test whether the entity is visibly garrisoned. | |||||
* | |||||
* @param {number} entity - The entity ID of the entity to check. | |||||
* | |||||
* @return {boolean} - Whether the entity is visibly garrisoned. | |||||
*/ | |||||
GarrisonHolder.prototype.IsVisiblyGarrisoned = function(entity) | |||||
{ | |||||
return this.visibleGarrisonPoints.some(vgp => vgp.entity == entity); | |||||
}; | |||||
/** | |||||
* Get the visible garrison points of this entity. | |||||
* | |||||
* @return {Object[]} - An array containing visibly garrison points. | |||||
*/ | |||||
GarrisonHolder.prototype.GetVisibleGarrisonPoints = function() | |||||
{ | |||||
return this.visibleGarrisonPoints; | |||||
}; | |||||
/** | |||||
* @return {Array} unit classes which can be garrisoned inside this | * @return {Array} unit classes which can be garrisoned inside this | ||||
* particular entity. Obtained from the entity's template. | * particular entity. Obtained from the entity's template. | ||||
*/ | */ | ||||
GarrisonHolder.prototype.GetAllowedClasses = function() | GarrisonHolder.prototype.GetAllowedClasses = function() | ||||
{ | { | ||||
return this.template.List._string; | return this.template.List._string; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 613 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator