Assembling machines and idle_animation
Assembling machines and idle_animation
So how do you make sure that your entity does not stop on a very active frame in the spritesheet?
I was trying to use idle animation, but as is clear now, that wont help.
So I need some other way of showing frame 1 when the assembler is idle....
I was trying to use idle animation, but as is clear now, that wont help.
So I need some other way of showing frame 1 when the assembler is idle....
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Do units use idle_animation at all?
In modern versions you can use working_visualisations on assemblers too. Those don't render at all when idle. Ofc that requirest that you have the "very active" parts in a seperate sprite sheet than the (unanimated) base.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Do units use idle_animation at all?
eradicator wrote: ↑Wed Mar 10, 2021 6:06 amIn modern versions you can use working_visualisations on assemblers too. Those don't render at all when idle. Ofc that requirest that you have the "very active" parts in a seperate sprite sheet than the (unanimated) base.
Yes. I am looking for the syntax for redering the idle graphics.
The active part is not done with working_visualisations, but with [animation =]
Still the problem remains the same: It stops for idle status on random frame.
Also after making a copy that is done with working_visualisations.
Re: Do units use idle_animation at all?
Can you post your code for this entity?Shenpen wrote: ↑Wed Mar 10, 2021 3:03 pmYes. I am looking for the syntax for redering the idle graphics.
The active part is not done with working_visualisations, but with [animation =]
Still the problem remains the same: It stops for idle status on random frame.
Also after making a copy that is done with working_visualisations.
If you have animation = your_idle_state, and working_visualisations = your_animated_state, then unless you have always_draw = true in your working visualisation, it should revert to your idle state when idle, e.g.:
Re: Do units use idle_animation at all?
Surekirazy wrote: ↑Thu Mar 11, 2021 11:48 amCan you post your code for this entity?Shenpen wrote: ↑Wed Mar 10, 2021 3:03 pmYes. I am looking for the syntax for redering the idle graphics.
The active part is not done with working_visualisations, but with [animation =]
Still the problem remains the same: It stops for idle status on random frame.
Also after making a copy that is done with working_visualisations.
If you have animation = your_idle_state, and working_visualisations = your_animated_state, then unless you have always_draw = true in your working visualisation, it should revert to your idle state when idle, e.g.:
Re: Do units use idle_animation at all?
I'm looking at your code here and you have 49 frames for your idle animation? Hm. If it's just a single frame repeated 49 times you can use `repeat_count = 49` with `frame_count = 1` and a single image.
So the idle_animation field is a bit of a misnomer: it's not actually animated. Basically it means that when you transition from active to idle, the animation will pause on the shared frame number.
However! If you have fluid boxes, which I see that you do: basically the code logic can't tell the machine has gone to "sleep" due to the fluid logic, so idle_animation is never used:
animation can be used here to be the idle state, since working_visualisation draws on top of animation, however you need to build your sprites specifically for this scenario, e.g. you have working_visualization be the animated portion of your sprite, and animation the non-animated portions, otherwise you have two sprites layered on top of each other.
This entity here https://github.com/Arch666Angel/mods/bl ... achine.lua is the one that was giving me trouble for much the same reasons you're experiencing, and I ended up constructing it with the following layers (but ALL in working_visualisations, though I don't remember why anymore):
working_vis 1: The "idle" state, set to `always_draw = true` working_vis 2: The "recipe mask", which is colored with the recipe tint property, and set to `always_draw = true` working_vis 3: The actual animation, which is drawn above the "idle" and "recipe mask" states when the machine is active working_vis_4: The light that lights up the machine at night, which is likewise animated: I don't know what your model looks like that you're trying to setup, I could give you pointers or ideas if you were to post it.
So the idle_animation field is a bit of a misnomer: it's not actually animated. Basically it means that when you transition from active to idle, the animation will pause on the shared frame number.
However! If you have fluid boxes, which I see that you do: basically the code logic can't tell the machine has gone to "sleep" due to the fluid logic, so idle_animation is never used:
working_visualisations by contrast does know when an assembling machine has gone idle, even with fluid boxes, and so will turn off the animation unless you tell it to always_draw.posila wrote: ↑Tue Sep 15, 2020 10:33 am The problem is the assembler has fluidboxes on it, so it doesn't go to sleep, and therefore the rendering doesn't consider the machine to be "idle".
It is definitelly an issue, I'll think about performance implications of making more expensive checks for being idle in rendering.
animation can be used here to be the idle state, since working_visualisation draws on top of animation, however you need to build your sprites specifically for this scenario, e.g. you have working_visualization be the animated portion of your sprite, and animation the non-animated portions, otherwise you have two sprites layered on top of each other.
This entity here https://github.com/Arch666Angel/mods/bl ... achine.lua is the one that was giving me trouble for much the same reasons you're experiencing, and I ended up constructing it with the following layers (but ALL in working_visualisations, though I don't remember why anymore):
working_vis 1: The "idle" state, set to `always_draw = true` working_vis 2: The "recipe mask", which is colored with the recipe tint property, and set to `always_draw = true` working_vis 3: The actual animation, which is drawn above the "idle" and "recipe mask" states when the machine is active working_vis_4: The light that lights up the machine at night, which is likewise animated: I don't know what your model looks like that you're trying to setup, I could give you pointers or ideas if you were to post it.
Re: Do units use idle_animation at all?
Ok, I downloaded your mod to check out your flare station.
This could be converted in the same way that the strand casting machine was converted. Just extract the glowing portion so that your animation is ONLY the glowing animated bits, and overlay that on a single frame that's your idle state. You could do it exactly how I did for the strand casting machine.
This could be converted in the same way that the strand casting machine was converted. Just extract the glowing portion so that your animation is ONLY the glowing animated bits, and overlay that on a single frame that's your idle state. You could do it exactly how I did for the strand casting machine.
Re: Do units use idle_animation at all?
That sounds like the way to go then!kirazy wrote: ↑Thu Mar 11, 2021 8:56 pm Ok, I downloaded your mod to check out your flare station.
This could be converted in the same way that the strand casting machine was converted. Just extract the glowing portion so that your animation is ONLY the glowing animated bits, and overlay that on a single frame that's your idle state. You could do it exactly how I did for the strand casting machine.
Thank you for taking your time looking into this!
Just disecting a bit:
As I read you, this is the single frame idle version of the casting mashine, drawn from strand-casting-machine-idle-state.png.
Code: Select all
working_visualisations = {
{
always_draw = true,
animation = {
layers = {
{
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/strand-casting-machine-idle-state.png",
priority = "high",
width = 167,
height = 197,
shift = util.by_pixel(0, -16.5),
hr_version = angelsmods.trigger.enable_hq_graphics and {
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/hr-strand-casting-machine-idle-state.png",
priority = "high",
width = 329,
height = 392,
shift = util.by_pixel(0, -16.5),
scale = 0.5
} or nil
},
{
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/strand-casting-machine-shadow.png",
priority = "high",
width = 223,
height = 157,
draw_as_shadow = true,
shift = util.by_pixel(29.5, 3.5),
hr_version = angelsmods.trigger.enable_hq_graphics and {
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/hr-strand-casting-machine-shadow.png",
priority = "high",
width = 444,
height = 311,
draw_as_shadow = true,
shift = util.by_pixel(29.5, 3.5),
scale = 0.5
} or nil
}
}
}
},
And this is your animated active visualisation, drawn on top (or more complicated based on masks) and based on a multi-frame spritesheet:
Code: Select all
{
fadeout = true,
animation = {
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/strand-casting-machine-working-animation.png",
priority = "high",
width = 167,
height = 197,
line_length = 6,
frame_count = 24,
animation_speed = 0.5,
shift = util.by_pixel(0, -16.5),
hr_version = angelsmods.trigger.enable_hq_graphics and {
filename = "__angelssmelting__/graphics/entity/strand-casting-machine/hr-strand-casting-machine-working-animation.png",
priority = "high",
width = 329,
height = 392,
line_length = 6,
frame_count = 24,
animation_speed = 0.5,
shift = util.by_pixel(0, -16.5),
scale = 0.5
} or nil
"I don't know what your model looks like"
No model, just decorating the base-mod spritesheet a bit. I have no skills in 3D modeling.
Re: Do units use idle_animation at all?
This will accomplish what you are looking for:
You'll want to of course make the sprite sheets to go with it, and maybe add `hr_version`, but otherwise that should do the trick.
Though, looking at your files, your files are the HR version, so you don't need to make a separate entry that repeats the information just to specify `hr_version` the way you currently do. You only need to specify both sets of sprite references for normal and hr if you have actually different sprites for both graphics options. If you just have the one, just use the normal definition.
Code: Select all
working_visualisations = {
-- Idle state
{
always_draw = true,
animation = {
filename = "__bitumen__/graphics/entity/flare-station/flare_station_idle.png",
priority = "high",
width = 300,
height = 300,
shift = util.by_pixel(0, -0.5),
scale = 0.36, --from 33
}
},
-- Animated state
{
fadeout = true,
animation = {
filename = "__bitumen__/graphics/entity/flare-station/flare_station.png",
priority = "high",
width = 300,
height = 300,
frame_count = 49,
line_length = 7,
shift = util.by_pixel(0, -0.5),
scale = 0.36, --from 33
animation_speed = 0.20,
}
},
}
Though, looking at your files, your files are the HR version, so you don't need to make a separate entry that repeats the information just to specify `hr_version` the way you currently do. You only need to specify both sets of sprite references for normal and hr if you have actually different sprites for both graphics options. If you just have the one, just use the normal definition.
Re: Assembling machines and idle_animation
I split this topic from the original topic which was about unit idle_animations. They're both useful topics, but it gets a bit confusing when entity prototypes that work very differently are mixed in one thread.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Do units use idle_animation at all?
Thanks man!kirazy wrote: ↑Fri Mar 12, 2021 10:01 am This will accomplish what you are looking for:
You'll want to of course make the sprite sheets to go with it, and maybe add `hr_version`, but otherwise that should do the trick.Code: Select all
working_visualisations = { -- Idle state { always_draw = true, animation = { filename = "__bitumen__/graphics/entity/flare-station/flare_station_idle.png", priority = "high", width = 300, height = 300, shift = util.by_pixel(0, -0.5), scale = 0.36, --from 33 } }, -- Animated state { fadeout = true, animation = { filename = "__bitumen__/graphics/entity/flare-station/flare_station.png", priority = "high", width = 300, height = 300, frame_count = 49, line_length = 7, shift = util.by_pixel(0, -0.5), scale = 0.36, --from 33 animation_speed = 0.20, } }, }
Though, looking at your files, your files are the HR version, so you don't need to make a separate entry that repeats the information just to specify `hr_version` the way you currently do. You only need to specify both sets of sprite references for normal and hr if you have actually different sprites for both graphics options. If you just have the one, just use the normal definition.
I know the double entry is a bit of a mess. But it might come in handy if I take time out to go over the files and make the needed downscaled versions for any potato-jockeys out there. Not everyone have a new computer and an expensive graphics card.