Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GarrisonHolder.js
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
GarrisonHolder.prototype.AllowedToGarrison = function(entity) | GarrisonHolder.prototype.AllowedToGarrison = function(entity) | ||||
{ | { | ||||
if (!this.IsGarrisoningAllowed()) | if (!this.IsGarrisoningAllowed()) | ||||
return false; | return false; | ||||
var cmpIdentity = Engine.QueryInterface(entity, IID_Identity); | var cmpIdentity = Engine.QueryInterface(entity, IID_Identity); | ||||
if (!cmpIdentity) | if (!cmpIdentity) | ||||
return false; | return false; | ||||
leper: Hm, UnitAI seems like a bad place for that. | |||||
var entityClasses = cmpIdentity.GetClassesList(); | var entityClasses = cmpIdentity.GetClassesList(); | ||||
return MatchesClassList(entityClasses, this.template.List._string); | return MatchesClassList(entityClasses, this.template.List._string) && !!Engine.QueryInterface(entity, IID_Garrisonable); | ||||
}; | }; | ||||
Not Done Inline ActionsActually one could solve this with a special class that prevent garrisoning maybe aptly named Ungarrsionable. leper: Actually one could solve this with a special class that prevent garrisoning maybe aptly named… | |||||
Not Done Inline ActionsHow would this be done with dynamic templates though? From what I can see, this would mean that the "Ungarrsionable" class would have to be added somehow to the Classes or VisibleClasses already present in the template? Or rather, I guess it's possible that GarrisonEnabled could be part of the Identity component, and then "Ungarrsionable" could be added to the ent's this.classesList on init if GarrisonEnabled is false. Sandarac: How would this be done with dynamic templates though? From what I can see, this would mean that… | |||||
Not Done Inline ActionsThe same way that token merging works with inheritance. leper: The same way that token merging works with inheritance. | |||||
/** | /** | ||||
* Garrison a unit inside. | * Garrison a unit inside. | ||||
* Returns true if successful, false if not | * Returns true if successful, false if not | ||||
* The timer for AutoHeal is started here | * The timer for AutoHeal is started here | ||||
* if vgpEntity is given, this visualGarrisonPoint will be used for the entity | * if vgpEntity is given, this visualGarrisonPoint will be used for the entity | ||||
*/ | */ | ||||
GarrisonHolder.prototype.Garrison = function(entity, vgpEntity) | GarrisonHolder.prototype.Garrison = function(entity, vgpEntity) | ||||
▲ Show 20 Lines • Show All 542 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Hm, UnitAI seems like a bad place for that.