mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Fix gliding healers when group attack order
In case a healer is currently healing and is part of a selection ordered to attack the healer gets moved along but the fsm state isn't changed which leads to healer healing while gliding to the target. Introduce a WalkToTargetRange function which does transition state in addition by issuing an order instead. Fixes: #6134 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
3a6540110b
commit
ef007b9e5a
1 changed files with 11 additions and 1 deletions
|
|
@ -5494,6 +5494,16 @@ UnitAI.prototype.WalkToTarget = function(target, queued, pushFront)
|
|||
this.AddOrder("WalkToTarget", { "target": target, "force": true }, queued, pushFront);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds walk-to-target-range order to queue, this only occurs in response
|
||||
* to a player order, and so is forced.
|
||||
*/
|
||||
UnitAI.prototype.WalkToTargetRange = function(target, iid, type, queued, pushFront)
|
||||
{
|
||||
const range = this.GetRange(iid, type, target);
|
||||
this.AddOrder("WalkToTarget", { "target": target, "min": range.min, "max": range.max, "force": true }, queued, pushFront);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds walk-and-fight order to queue, this only occurs in response
|
||||
* to a player order, and so is forced.
|
||||
|
|
@ -5549,7 +5559,7 @@ UnitAI.prototype.Attack = function(target, allowCapture = this.DEFAULT_CAPTURE,
|
|||
// We don't want to let healers walk to the target unit so they can be easily killed.
|
||||
// Instead we just let them get into healing range.
|
||||
if (this.IsHealer())
|
||||
this.MoveToTargetRange(target, IID_Heal);
|
||||
this.WalkToTargetRange(target, IID_Heal, null, queued, pushFront);
|
||||
else
|
||||
this.WalkToTarget(target, queued, pushFront);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue