Ticket #2905: wallGarrison.diff
File wallGarrison.diff, 2.5 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/components/GarrisonHolder.js
242 242 vgp.entity = entity; 243 243 cmpPosition.SetTurretParent(this.entity, vgp.offset); 244 244 visiblyGarrisoned = true; 245 var cmpUnitAI = Engine.QueryInterface(entity, IID_UnitAI); 246 if (cmpUnitAI) 247 cmpUnitAI.SetTurretStance(); 245 248 break; 246 249 } 247 250 if (!visiblyGarrisoned) … … 337 340 if (vgp.entity != entity) 338 341 continue; 339 342 cmpNewPosition.SetTurretParent(INVALID_ENTITY, new Vector3D()); 343 var cmpUnitAI = Engine.QueryInterface(entity, IID_UnitAI); 344 if (cmpUnitAI) 345 cmpUnitAI.ResetTurretStance(); 340 346 vgp.entity = null; 341 347 break; 342 348 } -
binaries/data/mods/public/simulation/components/UnitAI.js
5284 5284 this.SetupRangeQueries(); 5285 5285 }; 5286 5286 5287 UnitAI.prototype.SetTurretStance = function() 5288 { 5289 this.previousStance = undefined; 5290 if (this.GetStance().respondStandGround) 5291 return; 5292 for (let stance in g_Stances) 5293 { 5294 if (!g_Stances[stance].respondStandGround) 5295 continue; 5296 this.previousStance = this.GetStanceName(); 5297 this.SwitchToStance(stance); 5298 return; 5299 } 5300 }; 5301 5302 UnitAI.prototype.ResetTurretStance = function() 5303 { 5304 if (!this.previousStance) 5305 return; 5306 this.SwitchToStance(this.previousStance); 5307 this.previousStance = undefined; 5308 }; 5309 5287 5310 /** 5288 5311 * Resets losRangeQuery, and if there are some targets in range that we can 5289 5312 * attack then we start attacking and this returns true; otherwise, returns false. … … 5468 5491 5469 5492 UnitAI.prototype.GetPossibleStances = function() 5470 5493 { 5494 if (this.IsTurret()) 5495 return []; 5471 5496 return Object.keys(g_Stances); 5472 5497 }; 5473 5498 -
binaries/data/mods/public/simulation/helpers/Commands.js
548 548 for each (var ent in data.entities) 549 549 { 550 550 var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); 551 if (cmpUnitAI )551 if (cmpUnitAI && !cmpUnitAI.IsTurret()) 552 552 cmpUnitAI.SwitchToStance(cmd.name); 553 553 } 554 554 },