Horizontal and Vertical animation/picture for assembler

Place to get help with not working mods / modding interface.
Post Reply
hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Horizontal and Vertical animation/picture for assembler

Post 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 ?

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Horizontal and Vertical animation/picture for assembler

Post 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
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Re: Horizontal and Vertical animation/picture for assembler

Post 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 ?

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Horizontal and Vertical animation/picture for assembler

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Re: Horizontal and Vertical animation/picture for assembler

Post 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 ?

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Horizontal and Vertical animation/picture for assembler

Post 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).
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Modding help”