Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 1,306 Lines • ▼ Show 20 Lines | "enter": function() { | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
this.SetNextState("ANIMAL.IDLE"); | this.SetNextState("ANIMAL.IDLE"); | ||||
return true; | return true; | ||||
} | } | ||||
let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | ||||
if (cmpFormation) | if (cmpFormation) | ||||
{ | { | ||||
this.formationAnimationVariant = cmpFormation.GetFormationAnimation(this.entity); | this.formationAnimationVariant = cmpFormation.GetFormationAnimationVariant(this.entity); | ||||
if (this.formationAnimationVariant) | if (this.formationAnimationVariant) | ||||
this.SetAnimationVariant(this.formationAnimationVariant); | this.SetAnimationVariant(this.formationAnimationVariant); | ||||
else | else | ||||
this.SetDefaultAnimationVariant(); | this.SetDefaultAnimationVariant(); | ||||
} | } | ||||
return false; | return false; | ||||
}, | }, | ||||
Show All 12 Lines | "WALKING": { | ||||
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | ||||
// Prevent unit to turn when stopmoving is called. | // Prevent unit to turn when stopmoving is called. | ||||
cmpUnitMotion.SetFacePointAfterMove(false); | cmpUnitMotion.SetFacePointAfterMove(false); | ||||
cmpUnitMotion.MoveToFormationOffset(this.order.data.target, this.order.data.x, this.order.data.z); | cmpUnitMotion.MoveToFormationOffset(this.order.data.target, this.order.data.x, this.order.data.z); | ||||
if (this.order.data.offsetsChanged) | if (this.order.data.offsetsChanged) | ||||
{ | { | ||||
let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | ||||
if (cmpFormation) | if (cmpFormation) | ||||
this.formationAnimationVariant = cmpFormation.GetFormationAnimation(this.entity); | this.formationAnimationVariant = cmpFormation.GetFormationAnimationVariant(this.entity); | ||||
} | } | ||||
if (this.formationAnimationVariant) | if (this.formationAnimationVariant) | ||||
this.SetAnimationVariant(this.formationAnimationVariant); | this.SetAnimationVariant(this.formationAnimationVariant); | ||||
else if (this.order.data.variant) | else if (this.order.data.variant) | ||||
this.SetAnimationVariant(this.order.data.variant); | this.SetAnimationVariant(this.order.data.variant); | ||||
else | else | ||||
this.SetDefaultAnimationVariant(); | this.SetDefaultAnimationVariant(); | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 5,008 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator