[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
Filter Inserter
Filter Inserter
Posts: 869
Joined: Thu Oct 03, 2019 7:10 am

[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_tint_patch.png (170.37 KiB) Viewed 921 times
after_tint_patch.png (178.67 KiB) Viewed 921 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!

Factorio Staff
Factorio Staff
Posts: 42
Joined: Wed Dec 24, 2014 8:19 am

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”