mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Don't set animation for production with UnitAi
Entities with a production queue when queueing or unqueueing items for will set an appropriate animation which is desired for structures, like the forge producing smoke, but not so for units as it interferes with UnitAi animation state. Units don't have animations for training or researching so the idle animation will be set in that case instead. If such a unit is in motion this results in the unit gliding. To avoid this just skip setting an animation for entities having a UnitAI. Reported-by: wowgetoffyourcellphone Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
ef007b9e5a
commit
0baafb5375
2 changed files with 6 additions and 0 deletions
|
|
@ -369,6 +369,11 @@ ProductionQueue.prototype.RemoveItem = function(id)
|
|||
|
||||
ProductionQueue.prototype.SetAnimation = function(name)
|
||||
{
|
||||
// In case the entity has a UnitAI discard the attempted change of
|
||||
// animation as it would interfere with animation logic in UnitAI.
|
||||
if (Engine.QueryInterface(this.entity, IID_UnitAI))
|
||||
return;
|
||||
|
||||
const cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
|
||||
if (cmpVisual)
|
||||
cmpVisual.SelectAnimation(name, false, 1);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Engine.LoadComponentScript("interfaces/ProductionQueue.js");
|
|||
Engine.LoadComponentScript("interfaces/Researcher.js");
|
||||
Engine.LoadComponentScript("interfaces/Timer.js");
|
||||
Engine.LoadComponentScript("interfaces/Trainer.js");
|
||||
Engine.LoadComponentScript("interfaces/UnitAI.js");
|
||||
Engine.LoadComponentScript("interfaces/Upgrade.js");
|
||||
Engine.LoadComponentScript("Timer.js");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue