[1.1.41] `constant_speed = true` in `working_visualisation` plays animation when machine idle
Posted: Sun Sep 26, 2021 6:23 am
Title. Specifically with `always_draw = true` to override the animation disappearing when idle.
Expected behavior:
When the machine is idle, animations pause, even if `constant_speed` is set to `true`.
Actual behavior:
The animation plays, always, idle or not, powered or not.
Speculation:
The animation pausing when the machine is idle/unpowered is probably a side effect of how animation _speed is calculated, being a function of the speed the machine is crafting at, in that moment. So when the machine is idle, the speed is 0, and so the animation speed is 0.
But since constant_speed makes that a constant, it's never 0, and so always plays. This is... not entirely undesirable behavior, but it's an issue in this case. I would not like a fix for this issue that makes it so you can't have an animation play even when idle... (e.g. the Roboport antenna being replicated on a crafting machine). An ideal fix would be an additional parameter that makes the animation pause when idle.
The problem I am attempting to solve:
Without constant_speed = true, the animation playback speed is impacted by speed modules, which in the modded environment I am designing for gets quickly out of hand and breaks the animation (it do look bad). I had hoped to get around they by setting the animation to play at a constant speed. I use `always_draw = true` here, so that when idle and when active the frames line up and it doesn't look jarring when it goes inactive.
And because this is an entity with fluid boxes, I cannot use idle_animation to get around this.
And here we are.
Expected behavior:
When the machine is idle, animations pause, even if `constant_speed` is set to `true`.
Actual behavior:
The animation plays, always, idle or not, powered or not.
Speculation:
The animation pausing when the machine is idle/unpowered is probably a side effect of how animation _speed is calculated, being a function of the speed the machine is crafting at, in that moment. So when the machine is idle, the speed is 0, and so the animation speed is 0.
But since constant_speed makes that a constant, it's never 0, and so always plays. This is... not entirely undesirable behavior, but it's an issue in this case. I would not like a fix for this issue that makes it so you can't have an animation play even when idle... (e.g. the Roboport antenna being replicated on a crafting machine). An ideal fix would be an additional parameter that makes the animation pause when idle.
The problem I am attempting to solve:
Without constant_speed = true, the animation playback speed is impacted by speed modules, which in the modded environment I am designing for gets quickly out of hand and breaks the animation (it do look bad). I had hoped to get around they by setting the animation to play at a constant speed. I use `always_draw = true` here, so that when idle and when active the frames line up and it doesn't look jarring when it goes inactive.
And because this is an entity with fluid boxes, I cannot use idle_animation to get around this.
And here we are.