summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-13 00:03:59 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-13 00:03:59 -0400
commitccbedcd3d6a604c8ca45b77337fd59b30c1caf96 (patch)
tree9d3b017c9ec5c7b74c66923a4048878fdb356e14
parent622d09a2439e722ddff9330f76635a7f86271773 (diff)
downloadunifieddyes-ccbedcd3d6a604c8ca45b77337fd59b30c1caf96.tar
unifieddyes-ccbedcd3d6a604c8ca45b77337fd59b30c1caf96.tar.gz
unifieddyes-ccbedcd3d6a604c8ca45b77337fd59b30c1caf96.tar.bz2
unifieddyes-ccbedcd3d6a604c8ca45b77337fd59b30c1caf96.tar.xz
unifieddyes-ccbedcd3d6a604c8ca45b77337fd59b30c1caf96.zip
allow passing an explicitly-available list of colors for airbrush
-rw-r--r--init.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index 36007dd..cb60122 100644
--- a/init.lua
+++ b/init.lua
@@ -807,7 +807,7 @@ local vps = 1.3 -- vertical position scale
local vs = 0.3 -- vertical shift/offset
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
@@ -819,7 +819,8 @@ function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative,
end
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
unavail_overlay = "^unifieddyes_unavailable_overlay.png"
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)]"
end
+ local explist = last_right_click.def.explist
+
for v = 0, 6 do
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 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
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 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
end
end
@@ -957,7 +960,7 @@ function unifieddyes.show_airbrush_form(player)
end
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
end