Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 3,625 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. | |||||
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 974 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.PushOrderFront("Flee", { "target": ents[0], "force": false }); | this.PushOrderFront("Flee", { "target": ents[0], "force": false }); | ||||
FreagarachAuthorUnsubmitted 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 true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
}; | }; | ||||
/** | /** | ||||
* Try to respond to healable entities. | * Try to respond to healable entities. | ||||
▲ Show 20 Lines • Show All 1,402 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?