Ticket #2946: Patch_2946.patch

File Patch_2946.patch, 2.5 KB (added by Jason, 9 years ago)

Patch fixing bullets 1 and 2

  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    324324            return;
    325325        }
    326326
    327         var ok = this.MoveToTarget(this.order.data.target);
     327        var ok = this.MoveToTargetRangeExplicit(this.order.data.target, this.order.data.min, this.order.data.max);
    328328        if (ok)
    329329        {
    330330            // We've started walking to the given point
     
    49144914 */
    49154915UnitAI.prototype.WalkToTarget = function(target, queued)
    49164916{
    4917     this.AddOrder("WalkToTarget", { "target": target, "force": true }, queued);
     4917    this.AddOrder("WalkToTarget", { "min":0, "max":0, "target": target, "force": true }, queued);
    49184918};
    49194919
    49204920/**
     4921 * Adds walk to target order with explicit range to queue.
     4922 * Used when a unit which cannot build/repair is told to do so - they should walk to
     4923 * the structure but not get so close to interfere with other workers.
     4924 */
     4925UnitAI.prototype.WalkToTargetRangeExplicit = function(rangeMin, rangeMax, target, queued)
     4926{
     4927    this.AddOrder("WalkToTarget", { "min":rangeMin, "max":rangeMax, "target": target, "force": true }, queued);
     4928};
     4929
     4930/**
    49214931 * Adds walk-and-fight order to queue, this only occurs in response
    49224932 * to a player order, and so is forced.
    49234933 * If targetClasses is given, only entities matching the targetClasses can be attacked.
     
    50125022{
    50135023    if (!this.CanGather(target))
    50145024    {
    5015         this.WalkToTarget(target, queued);
     5025        this.WalkToTargetRangeExplicit(10, 10, target, queued);
    50165026        return;
    50175027    }
    50185028
     
    52275237{
    52285238    if (!this.CanRepair(target))
    52295239    {
    5230         this.WalkToTarget(target, queued);
     5240        this.WalkToTargetRangeExplicit(10, 10, target, queued);
    52315241        return;
    52325242    }
    52335243
  • source/simulation2/components/ICmpUnitMotion.h

     
    4747    virtual bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange) = 0;
    4848
    4949    /**
    50      * Determine wether the givven point is within the given range, using the same measurement
     50     * Determine whether the given point is within the given range, using the same measurement
    5151     * as MoveToPointRange.
    5252     */
    5353    virtual bool IsInPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange) = 0;