[Genhis] [1.1.48] mods - small bug in fill-barrel empty-barrel tint logic

This subforum contains all the issues which we already resolved.
Post Reply
Honktown
Smart Inserter
Smart Inserter
Posts: 1034
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[Genhis] [1.1.48] mods - small bug in fill-barrel empty-barrel tint logic

Post by Honktown »

If a fluid has the base_color or flow_color property specified with indexed numbers e.g. { 151, 0, 147 }, the barrel is tinted with an alpha channel using a, which breaks the coloring.

Specifically, in base/data-updates.lua, line 59:

Code: Select all

  local side_tint = util.table.deepcopy(fluid.base_color)
  side_tint.a = side_alpha
  local top_hoop_tint = util.table.deepcopy(fluid.flow_color)
  top_hoop_tint.a = top_hoop_alpha
Causes black colors on the barrel, and an emission of a prototype warning if a mod uses the indexed numbers, e.g. :

Code: Select all

  22.741 Warning PrototypeLoader.cpp:205: Value ROOT.recipe.fill-DimensionalFluid-barrel.icons[1].tint.1 was not used.
  22.741 Warning PrototypeLoader.cpp:205: Value ROOT.recipe.fill-DimensionalFluid-barrel.icons[1].tint.2 was not used.
  22.741 Warning PrototypeLoader.cpp:205: Value ROOT.recipe.fill-DimensionalFluid-barrel.icons[1].tint.3 was not used.
This behavior is used in:
58: local function generate_barrel_item_icons(fluid, empty_barrel_item)
115: local function generate_fill_barrel_icons(fluid)
158: local function generate_empty_barrel_icons(fluid)

A small patch would work, though isn't 100% correct. If the logic above is replaced with:

Code: Select all

  local base_color = fluid.base_color
  local side_tint = {
    r = base_color.r or base_color[1],
    g = base_color.g or base_color[2],
    b = base_color.b or base_color[3],
    a = side_alpha
  }
  local flow_color = fluid.flow_color
  local top_hoop_tint = {
    r = flow_color.r or flow_color[1],
    g = flow_color.g or flow_color[2],
    b = flow_color.b or flow_color[3],
    a = top_hoop_alpha
  }
Before:
before_tint_patch.png
before_tint_patch.png (170.37 KiB) Viewed 2452 times
After:
after_tint_patch.png
after_tint_patch.png (178.67 KiB) Viewed 2452 times
A "100%" accurate patch would test *all* of rgba before working in alphabet mode, and the wiki doesn't explicitly say if a nil indexed color is counted as 0 so there's a small omission of how to interpret indexed colors. (1-4? 1-nil? not really important, but for consideration)
I have mods! I guess!
Link

Genhis
Factorio Staff
Factorio Staff
Posts: 132
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.48] mods - small bug in fill-barrel empty-barrel tint logic

Post by Genhis »

Thanks for the report. The issue is now fixed for the next release.

Post Reply

Return to “Resolved Problems and Bugs”