Page 1 of 1
Missing layers documentation
Posted: Sun Aug 19, 2018 10:16 am
by DaveMcW
I had trouble automatically copying graphics from another mod because I didn't realize the layers property was optional.
Both of these are valid picture definitions:
Code: Select all
entity.picture = {
filename = "__mod__/graphics/image.png",
width = 32,
height = 32,
}
entity.picture = {
layers = {
{
filename = "__mod__/graphics/image.png",
width = 32,
height = 32,
},
}
}
Re: Missing layers documentation
Posted: Sun Aug 19, 2018 12:21 pm
by Bilka
There are multiple sprite/animation types, sometimes even new graphic loading classes for just 1 entity, so you need to specify which type is missing documentation.
Re: Missing layers documentation
Posted: Sun Aug 19, 2018 12:55 pm
by eradicator
As far as i understand you can use layers= in almost any node that expects graphics (even icons, though the syntax is different). And you can use stripes= in any place that expects filename=. So it's not really a special feature of picture=.
Via wiki search i can only find a short paragraph about layers:
https://wiki.factorio.com/Types/RotatedAnimation#layers
And reading it sounds like having layers=
inside layers= would be vald. I've never seen that and i cant imagine how that would be useful/different from just one layers=. Any example for that? @Bilka.
Stripes also has only once sentence:
https://wiki.factorio.com/Types/Animation#stripes
From which it's difficult to guess how to use it. (Admittedly stripes is a feature that 99% of mods will never need.)
Re: Missing layers documentation
Posted: Sun Aug 19, 2018 1:34 pm
by Bilka
eradicator wrote:And reading it sounds like having layers= inside layers= would be vald. I've never seen that and i cant imagine how that would be useful/different from just one layers=. Any example for that? @Bilka.
I have not seen it used anywhere, I simply documented what would be possible from the perspective of the code. And from the perspective of the code it basically works like this (pseudo code):
Code: Select all
function loadRotatedAnimation(input)
if input["layers"] then
local layers = input["layers"]
for _, layer in pairs(layers) do
loadRotatedAnimation(layer)
end
end
-- load everything else
end
Re: Missing layers documentation
Posted: Wed Aug 22, 2018 4:53 pm
by DaveMcW
Re: Missing layers documentation
Posted: Wed Aug 22, 2018 6:23 pm
by DaveMcW
eradicator wrote:And you can use stripes= in any place that expects filename=
It only seems to work on Animation, not Sprite.
Re: Missing layers documentation
Posted: Wed Aug 22, 2018 7:59 pm
by Rseding91
DaveMcW wrote:eradicator wrote:And you can use stripes= in any place that expects filename=
It only seems to work on Animation, not Sprite.
It works for everything. It's nested inside the Sprite class constructor which is what every image loaded uses. Therefor: every image defined through Lua supports it.
Re: Missing layers documentation
Posted: Wed Aug 22, 2018 8:43 pm
by Bilka
Rseding91 wrote:It works for everything. It's nested inside the Sprite class constructor which is what every image loaded uses. Therefor: every image defined through Lua supports it.
The other graphics use SpriteParameters, not Sprite. But that's besides the point, "stripes" isn't not loaded in the Sprite/SpriteParameters. You can find it being loaded specifically in Animation (and RotatedAnimation).
Re: Missing layers documentation
Posted: Thu Aug 23, 2018 7:51 pm
by Bilka
I have updated the documentation for all of these types.
Re: Missing layers documentation
Posted: Thu Aug 30, 2018 10:14 pm
by DaveMcW
Thanks for fixing the wiki!
Bilka wrote:"stripes" isn't not loaded in the Sprite/SpriteParameters. You can find it being loaded specifically in Animation (and RotatedAnimation).
Any plans to fix stripes for Sprites?
Re: Missing layers documentation
Posted: Thu Aug 30, 2018 10:49 pm
by Rseding91
DaveMcW wrote:Thanks for fixing the wiki!
Bilka wrote:"stripes" isn't not loaded in the Sprite/SpriteParameters. You can find it being loaded specifically in Animation (and RotatedAnimation).
Any plans to fix stripes for Sprites?
It's not broken. A single sprite has a maximum size and if you want to use a larger sprite you have to use layers and shift each sprite.