Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 3,296 Lines • ▼ Show 20 Lines | UnitAI.prototype.Init = function() | ||||
this.workOrders = []; | this.workOrders = []; | ||||
this.isGuardOf = undefined; | this.isGuardOf = undefined; | ||||
// For preventing increased action rate due to Stop orders or target death. | // For preventing increased action rate due to Stop orders or target death. | ||||
this.lastAttacked = undefined; | this.lastAttacked = undefined; | ||||
this.lastHealed = undefined; | this.lastHealed = undefined; | ||||
this.isHealer = undefined; | |||||
elexis: (Should not serialize properties that can be derived from the template / don't change simstate… | |||||
this.SetStance(this.template.DefaultStance); | this.SetStance(this.template.DefaultStance); | ||||
}; | }; | ||||
UnitAI.prototype.IsTurret = function() | UnitAI.prototype.IsTurret = function() | ||||
{ | { | ||||
if (!this.IsGarrisoned()) | if (!this.IsGarrisoned()) | ||||
return false; | return false; | ||||
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
Show All 34 Lines | |||||
UnitAI.prototype.IsDomestic = function() | UnitAI.prototype.IsDomestic = function() | ||||
{ | { | ||||
var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity); | var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity); | ||||
return cmpIdentity && cmpIdentity.HasClass("Domestic"); | return cmpIdentity && cmpIdentity.HasClass("Domestic"); | ||||
}; | }; | ||||
UnitAI.prototype.IsHealer = function() | UnitAI.prototype.IsHealer = function() | ||||
{ | { | ||||
return Engine.QueryInterface(this.entity, IID_Heal); | if (this.isHealer === undefined) | ||||
this.isHealer = Engine.QueryInterface(this.entity, IID_Heal) ? true : false; | |||||
StanUnsubmitted Not Done Inline ActionsIf using a ternary one should never have true: false :P Stan: If using a ternary one should never have true: false :P | |||||
return this.isHealer; | |||||
}; | }; | ||||
UnitAI.prototype.IsIdle = function() | UnitAI.prototype.IsIdle = function() | ||||
{ | { | ||||
return this.isIdle; | return this.isIdle; | ||||
}; | }; | ||||
UnitAI.prototype.IsGarrisoned = function() | UnitAI.prototype.IsGarrisoned = function() | ||||
▲ Show 20 Lines • Show All 2,859 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
(Should not serialize properties that can be derived from the template / don't change simstate during simulation #3834)