allow passing an explicitly-available list of colors for airbrush

This commit is contained in:
Vanessa Dannenberg 2018-09-13 00:03:59 -04:00
parent 622d09a243
commit ccbedcd3d6

View File

@ -807,7 +807,7 @@ local vps = 1.3 -- vertical position scale
local vs = 0.3 -- vertical shift/offset local vs = 0.3 -- vertical shift/offset
local color_button_size = ";0.75,0.75;" local color_button_size = ";0.75,0.75;"
function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv) function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
local dye = "dye:"..colorname local dye = "dye:"..colorname
@ -819,7 +819,8 @@ function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative,
end end
local unavail_overlay = "" local unavail_overlay = ""
if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname] then if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname]
or (explist and not explist[colorname]) then
if overlay == "" then if overlay == "" then
unavail_overlay = "^unifieddyes_unavailable_overlay.png" unavail_overlay = "^unifieddyes_unavailable_overlay.png"
else else
@ -876,6 +877,8 @@ function unifieddyes.show_airbrush_form(player)
t[#t+1] = "label[0.5,8.25;(Right-clicked a node not supported by the Airbrush, showing all colors)]" t[#t+1] = "label[0.5,8.25;(Right-clicked a node not supported by the Airbrush, showing all colors)]"
end end
local explist = last_right_click.def.explist
for v = 0, 6 do for v = 0, 6 do
local val = unifieddyes.VALS_EXTENDED[v+1] local val = unifieddyes.VALS_EXTENDED[v+1]
@ -902,7 +905,7 @@ function unifieddyes.show_airbrush_form(player)
local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2) local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
local f local f
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv) f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
t[#t+1] = f t[#t+1] = f
end end
@ -935,7 +938,7 @@ function unifieddyes.show_airbrush_form(player)
local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
local f local f
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv) f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
t[#t+1] = f t[#t+1] = f
end end
end end
@ -957,7 +960,7 @@ function unifieddyes.show_airbrush_form(player)
end end
local f local f
f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv) f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
t[#t+1] = f t[#t+1] = f
end end