Ticket #1832: abandonchase.diff

File abandonchase.diff, 847 bytes (added by mimo, 11 years ago)
  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    33043304 */
    33053305UnitAI.prototype.ShouldAbandonChase = function(target, force, iid)
    33063306{
     3307    // Wild animal should not continue if target is too far
     3308    // TODO find best cut, value 80 chosen because this "far" should nonetheless be bigger
     3309    // than the range attacks, to allow these animals to defend themselves.
     3310    if (this.IsAnimal() && !this.IsDomestic())
     3311    {
     3312        var distance = DistanceBetweenEntities(this.entity, target);
     3313        if (distance > 80)
     3314            return true;
     3315    }
     3316
    33073317    // Forced orders shouldn't be interrupted.
    33083318    if (force)
    33093319        return false;