Ticket #1670: ticket1670.patch
File ticket1670.patch, 1.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/ResourceGatherer.js
305 305 ResourceGatherer.prototype.CanCarryMore = function(type) 306 306 { 307 307 let amount = (this.carrying[type] || 0); 308 return (amount < this.GetCapacity(type));308 return amount < this.GetCapacity(type); 309 309 }; 310 310 311 312 ResourceGatherer.prototype.IsCarrying = function(type) 313 { 314 let amount = (this.carrying[type] || 0); 315 return amount > 0; 316 }; 317 311 318 /** 312 319 * Returns whether this unit is carrying any resources of a type that is 313 320 * not the requested type. (This is to support cases where the unit is -
binaries/data/mods/public/simulation/components/UnitAI.js
2347 2347 var herdPos = this.order.data.initPos; 2348 2348 2349 2349 // Give up on this order and try our next queued order 2350 // but first check what is our next order and, if needed, insert a returnResource order 2351 let cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer); 2352 if (cmpResourceGatherer.IsCarrying(resourceType.generic) && 2353 this.orderQueue.length > 1 && this.orderQueue[1] !== "ReturnResource" && 2354 (this.orderQueue[1].type !== "Gather" || this.orderQueue[1].data.type.generic !== resourceType.generic)) 2355 { 2356 let nearby = this.FindNearestDropsite(resourceType.generic); 2357 if (nearby) 2358 this.orderQueue.splice(1, 0, { "type": "ReturnResource", "data": { "target": nearby, "force": false } }); 2359 } 2350 2360 if (this.FinishOrder()) 2351 2361 return; 2352 2362