Ticket #3589: UnitAI.patch

File UnitAI.patch, 2.2 KB (added by False Vision, 8 years ago)
  • binaries/data/mods/public/simulation/components/UnitAI.js

    diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js
    index 4e43217..96b0ba6 100644
    a b UnitAI.prototype.UnitFsmSpec = {  
    844844        "Order.Attack": function(msg) {
    845845            var target = msg.data.target;
    846846            var allowCapture = msg.data.allowCapture;
     847            var attackType = msg.data.attackType;
     848           
    847849            var cmpTargetUnitAI = Engine.QueryInterface(target, IID_UnitAI);
    848850            if (cmpTargetUnitAI && cmpTargetUnitAI.IsFormationMember())
    849851                target = cmpTargetUnitAI.GetFormationController();
    850852
    851853            var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
    852854            // Check if we are already in range, otherwise walk there
    853             if (!this.CheckTargetAttackRange(target, target))
     855            if (!this.CheckTargetAttackRange(target, attackType))
    854856            {
    855857                if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
    856858                {
    857                     if (this.MoveToTargetAttackRange(target, target))
     859                    if (this.MoveToTargetAttackRange(target, attackType))
    858860                    {
    859861                        this.SetNextState("COMBAT.APPROACHING");
    860862                        return;
    UnitAI.prototype.UnitFsmSpec = {  
    11681170                "enter": function(msg) {
    11691171                    var target = this.order.data.target;
    11701172                    var allowCapture = this.order.data.allowCapture;
     1173                    var attackType = this.order.data.attackType;
    11711174                    // Check if we are already in range, otherwise walk there
    1172                     if (!this.CheckTargetAttackRange(target, target))
     1175                    if (!this.CheckTargetAttackRange(target, attackType))
    11731176                    {
    11741177                        if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
    11751178                        {
    UnitAI.prototype.UnitFsmSpec = {  
    11921195                "Timer": function(msg) {
    11931196                    var target = this.order.data.target;
    11941197                    var allowCapture = this.order.data.allowCapture;
     1198                    var attackType = this.order.data.attackType;
    11951199                    // Check if we are already in range, otherwise walk there
    1196                     if (!this.CheckTargetAttackRange(target, target))
     1200                    if (!this.CheckTargetAttackRange(target, attackType))
    11971201                    {
    11981202                        if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
    11991203                        {