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,249 Lines • ▼ Show 20 Lines | "COMBAT": { | ||||
}, | }, | ||||
}, | }, | ||||
"MEMBER": { | "MEMBER": { | ||||
// Wait for individual members to finish | // Wait for individual members to finish | ||||
"enter": function(msg) { | "enter": function(msg) { | ||||
var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); | var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); | ||||
cmpFormation.SetRearrange(false); | cmpFormation.SetRearrange(false); | ||||
this.StopMoving(); | |||||
this.StartTimer(1000, 1000); | this.StartTimer(1000, 1000); | ||||
}, | }, | ||||
"Timer": function(msg) { | "Timer": function(msg) { | ||||
// Have all members finished the task? | // Have all members finished the task? | ||||
if (!this.TestAllMemberFunction("HasFinishedOrder", [])) | if (!this.TestAllMemberFunction("HasFinishedOrder", [])) | ||||
return; | return; | ||||
this.CallMemberFunction("ResetFinishOrder", []); | this.CallMemberFunction("ResetFinishOrder", []); | ||||
// Execute the next order | // Execute the next order | ||||
if (this.FinishOrder()) | if (this.FinishOrder()) | ||||
{ | { | ||||
// if WalkAndFight order, look for new target before moving again | // if WalkAndFight order, look for new target before moving again | ||||
if (this.IsWalkingAndFighting()) | if (this.IsWalkingAndFighting()) | ||||
this.FindWalkAndFightTargets(); | this.FindWalkAndFightTargets(); | ||||
return; | return; | ||||
} | } | ||||
}, | }, | ||||
"leave": function(msg) { | "leave": function(msg) { | ||||
this.StopTimer(); | this.StopTimer(); | ||||
let cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); | |||||
cmpFormation.MoveToMembersCenter(); | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
// States for entities moving as part of a formation: | // States for entities moving as part of a formation: | ||||
"FORMATIONMEMBER": { | "FORMATIONMEMBER": { | ||||
"FormationLeave": function(msg) { | "FormationLeave": function(msg) { | ||||
▲ Show 20 Lines • Show All 4,669 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator