Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Garrisonable.js
function Garrisonable() {} | function Garrisonable() {} | ||||
Garrisonable.prototype.Schema = | Garrisonable.prototype.Schema = | ||||
"<a:help>Controls the garrisonability of an entity.</a:help>" + | "<a:help>Controls the garrisonability of an entity.</a:help>" + | ||||
"<a:example>" + | "<a:example>" + | ||||
"<Size>10</Size>" + | "<Size>10</Size>" + | ||||
"</a:example>" + | "</a:example>" + | ||||
"<element name='Size' a:help='Number of garrison slots the entity occupies.'>" + | "<element name='Size' a:help='Number of garrison slots the entity occupies.'>" + | ||||
"<data type='nonNegativeInteger'/>" + | "<data type='nonNegativeInteger'/>" + | ||||
"</element>"; | "</element>"; | ||||
Garrisonable.prototype.Init = function() | Garrisonable.prototype.Init = function() | ||||
{ | { | ||||
}; | }; | ||||
Garrisonable.prototype.Update = function(newTemplate) | |||||
{ | |||||
if (!this.holder) | |||||
return; | |||||
let holder = this.holder; | |||||
this.UnGarrison(true, true); | |||||
// Now that we're ungarrisoned, we can update our size. | |||||
this.template = newTemplate; | |||||
let cmpGarrisonable = Engine.QueryInterface(msg.newentity, IID_Garrisonable); | |||||
if (cmpGarrisonable) | |||||
cmpGarrisonable.Garrison(holder, true); | |||||
}; | |||||
/** | /** | ||||
* @param {string} type - Unused. | * @param {string} type - Unused. | ||||
* @param {number} target - The entity ID of the target to check. | * @param {number} target - The entity ID of the target to check. | ||||
* @return {Object} - Min and max ranges this entity needs to be in in order to garrison the target. | * @return {Object} - Min and max ranges this entity needs to be in in order to garrison the target. | ||||
*/ | */ | ||||
Garrisonable.prototype.GetRange = function(type, target) | Garrisonable.prototype.GetRange = function(type, target) | ||||
{ | { | ||||
let cmpGarrisonHolder = Engine.QueryInterface(target, IID_GarrisonHolder); | let cmpGarrisonHolder = Engine.QueryInterface(target, IID_GarrisonHolder); | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator