Ticket #2946: Patch_2946.patch
File Patch_2946.patch, 2.5 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
324 324 return; 325 325 } 326 326 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); 328 328 if (ok) 329 329 { 330 330 // We've started walking to the given point … … 4914 4914 */ 4915 4915 UnitAI.prototype.WalkToTarget = function(target, queued) 4916 4916 { 4917 this.AddOrder("WalkToTarget", { " target": target, "force": true }, queued);4917 this.AddOrder("WalkToTarget", { "min":0, "max":0, "target": target, "force": true }, queued); 4918 4918 }; 4919 4919 4920 4920 /** 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 */ 4925 UnitAI.prototype.WalkToTargetRangeExplicit = function(rangeMin, rangeMax, target, queued) 4926 { 4927 this.AddOrder("WalkToTarget", { "min":rangeMin, "max":rangeMax, "target": target, "force": true }, queued); 4928 }; 4929 4930 /** 4921 4931 * Adds walk-and-fight order to queue, this only occurs in response 4922 4932 * to a player order, and so is forced. 4923 4933 * If targetClasses is given, only entities matching the targetClasses can be attacked. … … 5012 5022 { 5013 5023 if (!this.CanGather(target)) 5014 5024 { 5015 this.WalkToTarget (target, queued);5025 this.WalkToTargetRangeExplicit(10, 10, target, queued); 5016 5026 return; 5017 5027 } 5018 5028 … … 5227 5237 { 5228 5238 if (!this.CanRepair(target)) 5229 5239 { 5230 this.WalkToTarget (target, queued);5240 this.WalkToTargetRangeExplicit(10, 10, target, queued); 5231 5241 return; 5232 5242 } 5233 5243 -
source/simulation2/components/ICmpUnitMotion.h
47 47 virtual bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange) = 0; 48 48 49 49 /** 50 * Determine w ether the givven point is within the given range, using the same measurement50 * Determine whether the given point is within the given range, using the same measurement 51 51 * as MoveToPointRange. 52 52 */ 53 53 virtual bool IsInPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange) = 0;