[Klonan] [1.0.0] Barreling icon code gen ignores icon_size if icons is defined

This subforum contains all the issues which we already resolved.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[Klonan] [1.0.0] Barreling icon code gen ignores icon_size if icons is defined

Post by Pi-C »

I've just had some serious trouble with the icon of a fluid I've defined. This is the important part of my definition:

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 })
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:
partial_barrelling_icon.png
partial_barrelling_icon.png (41.18 KiB) Viewed 2806 times
It took me a long time to figure out what was wrong. Finally, I solved the problem this way:

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 })
This brought the expected result:
correct_barrelling_icon.png
correct_barrelling_icon.png (39.94 KiB) Viewed 2806 times
But my first version of the fluid definition was correct, according to the wiki:
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.
I think the comment should be extended:
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.
Something like that, I'm not particular about the actual phrasing. But I guess the change could save many people a lot of time. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

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

Re: Insufficient explanation of icon_size

Post by Bilka »

That seems more like a bug in the barrelling icon generation code, it should not ignore the icon_size just because icons is defined. Moving to bug reports.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.0.0] Barreling icon code gen ignores icon_size if icons is defined

Post by Pi-C »

Thank you! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.0.0] Barreling icon code gen ignores icon_size if icons is defined

Post by Klonan »

Thanks for the report,

The barrel code is fixed for the next release, it will consider the fluid icon size,
and if not given, instead of defaulting to 32x32 icon size, it will throw an error.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [Klonan] [1.0.0] Barreling icon code gen ignores icon_size if icons is defined

Post by Pi-C »

Thanks, that should help!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Resolved Problems and Bugs”