update unified dyes and unified mesecons

This commit is contained in:
Vanessa Dannenberg 2018-09-13 00:17:56 -04:00
parent 02d2154bbd
commit 751ea7e6e1
2 changed files with 32 additions and 11 deletions

View File

@ -806,8 +806,9 @@ local hps = 0.6 -- horizontal position scale
local vps = 1.3 -- vertical position scale
local vs = 0.3 -- vertical shift/offset
local color_button_size = ";0.75,0.75;"
local color_square_size = ";0.69,0.69;"
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 +820,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
@ -832,13 +834,22 @@ function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative,
selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
"tooltip["..colorname..";"..colorname.."]"
end
local form
local form = "image_button["..
(hp*hps)..","..(v2*vps+vs)..
color_button_size..
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
colorname..";]"..
"tooltip["..colorname..";"..colorname.."]"
if unavail_overlay == "" then
form = "image_button["..
(hp*hps)..","..(v2*vps+vs)..
color_button_size..
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
colorname..";]"..
"tooltip["..colorname..";"..colorname.."]"
else
form = "image["..
(hp*hps)..","..(v2*vps+vs)..
color_square_size..
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
"tooltip["..colorname.." (unavailable);"..colorname.."]"
end
return form, selindic
end
@ -876,6 +887,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 +915,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 +948,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 +970,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

View File

@ -3,6 +3,11 @@ for _,i in ipairs({"pink","dark_green","brown","black","dark_grey","white"}) do
table.insert(hues, i)
end
local explist = {}
for _,i in ipairs(hues) do
explist[i] = true
end
local function insulated_wire_get_rules(node)
local rules = {{x = 1, y = 0, z = 0},
{x =-1, y = 0, z = 0}}
@ -74,6 +79,7 @@ for _,color in pairs(hues) do
palette = "unifieddyes_palette_"..palettecolor.."s.png",
ud_color_start = cstart,
ud_color_end = cend,
explist = explist,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
@ -131,6 +137,7 @@ for _,color in pairs(hues) do
palette = "unifieddyes_palette_"..palettecolor.."s.png",
ud_color_start = cstart,
ud_color_end = cend,
explist = explist,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -16/32, 5/32, -12/32, 5/32 },
@ -189,6 +196,7 @@ for _,color in pairs(hues) do
palette = "unifieddyes_palette_"..palettecolor.."s.png",
ud_color_start = cstart,
ud_color_end = cend,
explist = explist,
node_box = {
type = "fixed",
fixed = {{ -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 },