Ticket #4131: ticket4131.patch
File ticket4131.patch, 1.5 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
3381 3381 this.Stop(false); 3382 3382 } 3383 3383 3384 this.workOrders = []; 3385 let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); 3386 if (cmpTrader) 3387 cmpTrader.StopTrading(); 3388 3384 3389 this.SetStance(this.template.DefaultStance); 3385 3390 if (this.IsTurret()) 3386 3391 this.SetTurretStance(); … … 5219 5224 5220 5225 UnitAI.prototype.SwitchMarketOrder = function(oldMarket, newMarket) 5221 5226 { 5222 if (this.order .data && this.order.data.target && this.order.data.target == oldMarket)5227 if (this.order && this.order.data && this.order.data.target && this.order.data.target == oldMarket) 5223 5228 this.order.data.target = newMarket; 5224 5229 }; 5225 5230 … … 5227 5232 { 5228 5233 if (this.waypoints && this.waypoints.length > 1) 5229 5234 { 5230 varpoint = this.waypoints.pop();5231 var ok = this.MoveToPoint(point.x, point.z);5232 if (!ok)5233 ok =this.MoveToMarket(targetMarket);5235 let point = this.waypoints.pop(); 5236 if (this.MoveToPoint(point.x, point.z)) 5237 return true; 5238 return this.MoveToMarket(targetMarket); 5234 5239 } 5235 else5236 {5237 this.waypoints = undefined;5238 var ok = this.MoveToTarget(targetMarket);5239 }5240 5240 5241 return ok; 5241 this.waypoints = undefined; 5242 return this.MoveToTarget(targetMarket); 5242 5243 }; 5243 5244 5244 5245 UnitAI.prototype.PerformTradeAndMoveToNextMarket = function(currentMarket)