Page 1 of 1
Horizontal and Vertical animation/picture for assembler
Posted: Fri Oct 19, 2018 3:12 pm
by hreintke
Hi,
I am working on non-square assemblers (1x2, 1x3, ..).
When defining a 1x1 assembler, I need only one picture/animation for the entity.
But now I need two pictures, one for horizontal, one for vertical use.
Been checking other mods but can't get the right way to get that done.
Can anyone point me to an example or documentation on this ?
Re: Horizontal and Vertical animation/picture for assembler
Posted: Fri Oct 19, 2018 3:21 pm
by Bilka
The oil refinery is a crafting machine, it has animations for all 4 directions:
https://github.com/wube/factorio-data/b ... .lua#L9701
(data in json format, without the lua function here:
https://my.mixtape.moe/ouqvio.json)
You can find the documentation here:
https://wiki.factorio.com/Prototype/Cra ... #animation
Re: Horizontal and Vertical animation/picture for assembler
Posted: Fri Oct 19, 2018 3:49 pm
by hreintke
Thanks Bilka.
In these and others I checked there are multiple pictures in one png file.
How are the individual pictures placed in the file/referred to in the definition ?
Re: Horizontal and Vertical animation/picture for assembler
Posted: Fri Oct 19, 2018 4:53 pm
by Bilka
hreintke wrote: Fri Oct 19, 2018 3:49 pm
How are the individual pictures placed in the file/referred to in the definition ?
The frames are read from left to right, top to bottom (so, in rows).
https://wiki.factorio.com/Types/Animation#line_length specifies how long those rows are,
https://wiki.factorio.com/Types/Animation#frame_count specifies how many frames there are in total.
https://wiki.factorio.com/Types/Animation#width and height determine the size of a single frame of the animation.
Re: Horizontal and Vertical animation/picture for assembler
Posted: Sun Oct 21, 2018 11:11 am
by hreintke
Thanks again, starting to understand and have first things working.
On make_4way_animation_from_spritesheet (and util.by_pixel), noticed I can use that in my data.lua.
Are there more of these helper functions ?
Do you know where these are defined ?
Any documentation available ?
Re: Horizontal and Vertical animation/picture for assembler
Posted: Sun Oct 21, 2018 11:20 am
by Bilka
That particular function is defined here:
https://github.com/wube/factorio-data/b ... s.lua#L165 No documentation available, sadly.
Util functions are defined here:
https://github.com/wube/factorio-data/b ... b/util.lua
Also no documentation available... You can use the functions by using require("util.lua"), the game will load that file (unless you have a file with the same name in your mod).