Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 1,978 Lines • ▼ Show 20 Lines | "COMBAT": { | ||||
if (this.order.data.hunting && this.orderQueue.length > 1 && this.orderQueue[1].type === "Gather") | if (this.order.data.hunting && this.orderQueue.length > 1 && this.orderQueue[1].type === "Gather") | ||||
this.RememberTargetPosition(this.orderQueue[1].data); | this.RememberTargetPosition(this.orderQueue[1].data); | ||||
let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | ||||
this.lastAttacked = cmpTimer.GetTime() - msg.lateness; | this.lastAttacked = cmpTimer.GetTime() - msg.lateness; | ||||
this.FaceTowardsTarget(target); | this.FaceTowardsTarget(target); | ||||
// Check we can still reach the target | |||||
if (this.CheckTargetAttackRange(target, this.order.data.attackType)) | |||||
{ | |||||
// BuildingAI has it's own attack-routine | // BuildingAI has it's own attack-routine | ||||
let cmpBuildingAI = Engine.QueryInterface(this.entity, IID_BuildingAI); | let cmpBuildingAI = Engine.QueryInterface(this.entity, IID_BuildingAI); | ||||
if (!cmpBuildingAI) | if (!cmpBuildingAI) | ||||
{ | { | ||||
let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); | let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); | ||||
cmpAttack.PerformAttack(this.order.data.attackType, target); | cmpAttack.PerformAttack(this.order.data.attackType, target); | ||||
} | } | ||||
// Check we can still reach the target for the next attack | |||||
if (this.CheckTargetAttackRange(target, this.order.data.attackType)) | |||||
{ | |||||
if (this.resyncAnimation) | if (this.resyncAnimation) | ||||
{ | { | ||||
this.SetAnimationSync(this.attackTimers.repeat, this.attackTimers.repeat); | this.SetAnimationSync(this.attackTimers.repeat, this.attackTimers.repeat); | ||||
this.resyncAnimation = false; | this.resyncAnimation = false; | ||||
} | } | ||||
return; | return; | ||||
Stan: Shouldn't that return a boolean or something? | |||||
SilierAuthorUnsubmitted Done Inline Actionsits timer so does not matter what it returns Silier: its timer so does not matter what it returns | |||||
} | } | ||||
// Can't reach it - try to chase after it | // Can't reach it - try to chase after it | ||||
if (this.ShouldChaseTargetedEntity(target, this.order.data.force)) | if (this.ShouldChaseTargetedEntity(target, this.order.data.force)) | ||||
StanUnsubmitted Not Done Inline ActionsDoesn't the fact that it isn't in range means it needs to chase it? Stan: Doesn't the fact that it isn't in range means it needs to chase it? | |||||
SilierAuthorUnsubmitted Done Inline ActionsYes it is, but here are another aspects, like turret stance, guarding, forced order Silier: Yes it is, but here are another aspects, like turret stance, guarding, forced order | |||||
StanUnsubmitted Done Inline ActionsAh okay. Stan: Ah okay. | |||||
{ | { | ||||
if (this.CanPack()) | if (this.CanPack()) | ||||
{ | { | ||||
this.PushOrderFront("Pack", { "force": true }); | this.PushOrderFront("Pack", { "force": true }); | ||||
return; | return; | ||||
StanUnsubmitted Done Inline ActionsSame here. Stan: Same here. | |||||
} | } | ||||
this.SetNextState("COMBAT.CHASING"); | this.SetNextState("COMBAT.CHASING"); | ||||
return; | return; | ||||
} | } | ||||
this.SetNextState("FINDINGNEWTARGET"); | this.SetNextState("FINDINGNEWTARGET"); | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 4,202 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Shouldn't that return a boolean or something?