[Klonan] [1.0.0] Barreling icon code gen ignores icon_size if icons is defined
Posted: Mon Oct 19, 2020 9:43 am
I've just had some serious trouble with the icon of a fluid I've defined. This is the important part of my definition:
This does work perfectly for generating an icon for my fluid that will be displayed correctly. However, this is a fluid, so it can be barrelled. Barrelling recipes along with the icons are generated on the fly by the game. This is the icon I've got with the above code:
It took me a long time to figure out what was wrong. Finally, I solved the problem this way:
This brought the expected result:
But my first version of the fluid definition was correct, according to the wiki:
Code: Select all
local extinguisherfluid = {
type = "fluid",
name = WT.fire_ex_fluid,
icons = {
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-turret-bg.png",
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-turret.png",
tint = WT.extinguisher_turret_tint,
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-fluid-bg.png",
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-fluid.png",
tint = WT.fire_ex_fluid_tint,
},
},
icon_size = 64,
default_temperature = 25,
[…]
data:extend({ extinguisherfluid })
Code: Select all
local extinguisherfluid = {
type = "fluid",
name = WT.fire_ex_fluid,
icons = {
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-turret-bg.png",
icon_size = 64,
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-turret.png",
icon_size = 64,
tint = WT.extinguisher_turret_tint,
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-fluid-bg.png",
icon_size = 64,
},
{
icon = MOD_PIX .. "fluid/fire-ex-fluid-icon-fluid.png",
icon_size = 64,
tint = WT.fire_ex_fluid_tint,
},
default_temperature = 25,
[…]
data:extend({ extinguisherfluid })
I think the comment should be extended:icon_size
Type: Types/SpriteSizeType
Mandatory if icon_size is not specified inside all instances of Types/IconData inside icons. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.
Something like that, I'm not particular about the actual phrasing. But I guess the change could save many people a lot of time.Mandatory if icon_size is not specified inside all instances of Types/IconData inside icons. It must be specified inside the icons if it is used in a fluid definition. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.