Ticket #4015: change4015.5.patch

File change4015.5.patch, 3.7 KB (added by Ágoston Sipos, 7 years ago)

I hope I understood what I'm doing. Note that I still can't test because my build is faulty (even when reverting my changes).

  • binaries/data/mods/public/gui/credits/texts/programming.json

     
    141141            {"nick": "njm"},
    142142            {"nick": "NoMonkey", "name": "John Mena"},
    143143            {"nick": "notpete", "name": "Rich Cross"},
     144            {"nick": "odoaker", "name": "Agoston Sipos"},
    144145            {"nick": "Offensive ePeen", "name": "Jared Ryan Bills"},
    145146            {"nick": "Ols", "name": "Oliver Whiteman"},
    146147            {"nick": "olsner", "name": "Simon Brenner"},
  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    18421842                    {
    18431843                        // If the unit needs to unpack, do so
    18441844                        if (this.CanUnpack())
    1845                             this.SetNextState("UNPACKING");
     1845                            this.PushOrderFront("Unpack", { "force" : this.order.data.force });
    18461846                        else
    18471847                            this.SetNextState("ATTACKING");
    18481848                    }
     
    37673767        var cheeringOrder = this.orderQueue.shift();
    37683768        this.orderQueue.unshift(cheeringOrder, order);
    37693769    }
    3770     else if (this.order && this.IsPacking())
     3770    else if (this.order && this.IsPacking() && type != "CancelPack" && type != "CancelUnpack")
    37713771    {
    3772         var packingOrder = this.orderQueue.shift();
    3773         this.orderQueue.unshift(packingOrder, order);
     3772        if ((this.ShouldUnpack(type, data) || type == "Stop") && this.GetCurrentState().split(".").pop() == "PACKING")
     3773            this.orderQueue.unshift({ "type": "CancelPack", "data": { "force": data.force } }, order);
     3774        else if ((!this.ShouldUnpack(type, data) || type == "Stop") && this.GetCurrentState().split(".").pop() == "UNPACKING")
     3775            this.orderQueue.unshift({ "type": "CancelUnpack", "data": { "force": data.force } }, order);
     3776        else
     3777        {
     3778            var packingOrder = this.orderQueue.shift();
     3779            this.orderQueue.unshift(packingOrder, order);
     3780        }
    37743781    }
    37753782    else
    37763783    {
     
    38313838        else
    38323839            this.UpdateWorkOrders(type);
    38333840    }
     3841    let order = { "type": type, "data": data };
    38343842
    38353843    // Special cases of orders that shouldn't be replaced:
    38363844    // 1. Cheering - we're invulnerable, add order after we finish
     
    38383846    // TODO: maybe a better way of doing this would be to use priority levels
    38393847    if (this.order && this.order.type == "Cheering")
    38403848    {
    3841         var order = { "type": type, "data": data };
    38423849        var cheeringOrder = this.orderQueue.shift();
    38433850        this.orderQueue = [cheeringOrder, order];
    38443851    }
    38453852    else if (this.IsPacking() && type != "CancelPack" && type != "CancelUnpack")
    38463853    {
    3847         var order = { "type": type, "data": data };
    3848         var packingOrder = this.orderQueue.shift();
    3849         this.orderQueue = [packingOrder, order];
     3854        if ((this.ShouldUnpack(type, data) || type == "Stop") && this.GetCurrentState().split(".").pop() == "PACKING")
     3855        {
     3856            this.orderQueue = [order];
     3857            this.PushOrderFront("CancelPack", { "force": data.force });
     3858        }
     3859        else if ((!this.ShouldUnpack(type, data) || type == "Stop") && this.GetCurrentState().split(".").pop() == "UNPACKING")
     3860        {
     3861            this.orderQueue = [order];
     3862            this.PushOrderFront("CancelUnpack", { "force": data.force });
     3863        }
     3864        else
     3865            this.orderQueue = [this.orderQueue.shift(), order];
    38503866    }
    38513867    else
    38523868    {
     
    59605976    return (cmpPack && cmpPack.IsPacking());
    59615977};
    59625978
     5979UnitAI.prototype.ShouldUnpack = function(type, data)
     5980{
     5981    return type == "Attack" && this.CheckTargetAttackRange(data.target, this.GetBestAttackAgainst(data.target, false));
     5982};
     5983
    59635984//// Formation specific functions ////
    59645985
    59655986UnitAI.prototype.IsAttackingAsFormation = function()