Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 3,658 Lines • ▼ Show 20 Lines | if (this.order && this.order.type == "Cheering") | ||||
var cheeringOrder = this.orderQueue.shift(); | var cheeringOrder = this.orderQueue.shift(); | ||||
this.orderQueue.unshift(cheeringOrder, order); | this.orderQueue.unshift(cheeringOrder, order); | ||||
} | } | ||||
else if (this.order && this.IsPacking()) | else if (this.order && this.IsPacking()) | ||||
{ | { | ||||
var packingOrder = this.orderQueue.shift(); | var packingOrder = this.orderQueue.shift(); | ||||
this.orderQueue.unshift(packingOrder, order); | this.orderQueue.unshift(packingOrder, order); | ||||
} | } | ||||
else | else | ||||
Freagarach: It could also be handled here but I thought stacking flee orders may be useful in scripting. | |||||
SilierUnsubmitted Not Done Inline ActionsIf one wants to push order front, he should be allowed to do that and check before doing so if something may stack with unwanted effect. Silier: If one wants to push order front, he should be allowed to do that and check before doing so if… | |||||
{ | { | ||||
this.orderQueue.unshift(order); | this.orderQueue.unshift(order); | ||||
this.order = order; | this.order = order; | ||||
let ret = this.UnitFsm.ProcessMessage(this, | let ret = this.UnitFsm.ProcessMessage(this, | ||||
{ "type": "Order."+this.order.type, "data": this.order.data } | { "type": "Order."+this.order.type, "data": this.order.data } | ||||
); | ); | ||||
// If the order was rejected then immediately take it off again; | // If the order was rejected then immediately take it off again; | ||||
▲ Show 20 Lines • Show All 990 Lines • ▼ Show 20 Lines | UnitAI.prototype.RespondToTargetedEntities = function(ents) | ||||
if (this.GetStance().respondStandGround) | if (this.GetStance().respondStandGround) | ||||
return this.AttackVisibleEntity(ents); | return this.AttackVisibleEntity(ents); | ||||
if (this.GetStance().respondHoldGround) | if (this.GetStance().respondHoldGround) | ||||
return this.AttackEntityInZone(ents); | return this.AttackEntityInZone(ents); | ||||
if (this.GetStance().respondFlee) | if (this.GetStance().respondFlee) | ||||
{ | { | ||||
if (this.order && this.order.type == "Flee") | |||||
this.orderQueue.shift(); | |||||
this.PushOrderFront("Flee", { "target": ents[0], "force": false }); | this.PushOrderFront("Flee", { "target": ents[0], "force": false }); | ||||
return true; | return true; | ||||
Done Inline ActionsPerhaps replace the first order when that was a fleeing order, sounds better to me? Freagarach: Perhaps replace the first order when that was a fleeing order, sounds better to me? | |||||
} | } | ||||
return false; | return false; | ||||
}; | }; | ||||
/** | /** | ||||
* Try to respond to healable entities. | * Try to respond to healable entities. | ||||
* Returns true if it responded. | * Returns true if it responded. | ||||
▲ Show 20 Lines • Show All 1,401 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
It could also be handled here but I thought stacking flee orders may be useful in scripting. Any opinions on that?