Ticket #1260: UnitAI.js.patch

File UnitAI.js.patch, 1.1 KB (added by Harco Gijsbers, 12 years ago)

Patch with a partial fix for this issue

  • UnitAI.js

     
    960960        },
    961961
    962962        "GATHER": {
    963             "APPROACHING": {
    964                 "enter": function() {
    965                     this.SelectAnimation("move");
    966                 },
     963      "APPROACHING": {
     964        "enter": function() {
     965          // Check if we are already carry something. If so we need to show
     966          // the appropriate animation.
     967          var cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
     968          var type = cmpResourceGatherer.GetLastCarriedType();
     969          if (type)
     970          {
     971            var animation = "carry_" + type.generic;
     972            // Special case for meat
     973            if (type.specific == "meat")
     974              animation = "carry_" + type.specific;
    967975
     976            this.SelectAnimation(animation, false, this.GetWalkSpeed());
     977            return;
     978          }
     979
     980          this.SelectAnimation("move");
     981        },
     982
    968983                "MoveCompleted": function(msg) {
    969984                    if (msg.data.error)
    970985                    {