Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Context not available. | |||||
"FLEEING": { | "FLEEING": { | ||||
"enter": function() { | "enter": function() { | ||||
this.PlaySound("panic"); | this.PlaySound("panic"); | ||||
// Run quickly | |||||
this.SetMoveSpeed(this.GetRunSpeed()); | |||||
}, | |||||
"HealthChanged": function() { | |||||
this.SetMoveSpeed(this.GetRunSpeed()); | |||||
}, | }, | ||||
"leave": function() { | "leave": function() { | ||||
// Reset normal speed | |||||
this.SetMoveSpeed(this.GetWalkSpeed()); | |||||
}, | }, | ||||
"MoveCompleted": function() { | "MoveCompleted": function() { | ||||
Context not available. | |||||
this.SetAnimationVariant("combat"); | this.SetAnimationVariant("combat"); | ||||
var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); | ||||
if (cmpUnitAI && cmpUnitAI.IsFleeing()) | |||||
{ | |||||
// Run after a fleeing target | |||||
this.SetMoveSpeed(this.GetRunSpeed()); | |||||
} | |||||
this.StartTimer(1000, 1000); | this.StartTimer(1000, 1000); | ||||
}, | }, | ||||
Context not available. | |||||
var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); | ||||
if (!cmpUnitAI || !cmpUnitAI.IsFleeing()) | if (!cmpUnitAI || !cmpUnitAI.IsFleeing()) | ||||
return; | return; | ||||
this.SetMoveSpeed(this.GetRunSpeed()); | |||||
}, | }, | ||||
"leave": function() { | "leave": function() { | ||||
// Reset normal speed in case it was changed | |||||
this.SetMoveSpeed(this.GetWalkSpeed()); | |||||
// Show carried resources when walking. | // Show carried resources when walking. | ||||
this.SetAnimationVariant(); | this.SetAnimationVariant(); | ||||
Context not available. |
Wildfire Games · Phabricator