1
0
mirror of https://github.com/mt-mods/unifieddyes.git synced 2024-11-14 14:20:19 +01:00

make "Your selection" legend show your selected color

or show a "?" when a color hasn't been chosen
This commit is contained in:
Vanessa Dannenberg 2018-08-27 19:30:36 -04:00
parent f7cc4be2c3
commit 057baacf2d
2 changed files with 16 additions and 5 deletions

View File

@ -833,6 +833,8 @@ function unifieddyes.show_airbrush_form(player)
local inv = player:get_inventory() local inv = player:get_inventory()
local base_form = "size[15,8.5]label[7,-0.25;Select a color:]" local base_form = "size[15,8.5]label[7,-0.25;Select a color:]"
local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]"
local size="0.75,0.75;" local size="0.75,0.75;"
local hps=0.6 local hps=0.6
local vps=1.3 local vps=1.3
@ -864,16 +866,20 @@ function unifieddyes.show_airbrush_form(player)
local color = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2) local color = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
local dye = "dye:"..val..hue..sat local dye = "dye:"..val..hue..sat
local overlay = "" local overlay = ""
local colorize = minetest.formspec_escape("^[colorize:#"..color..":255")
if not creative and inv:contains_item("main", dye) then if not creative and inv:contains_item("main", dye) then
overlay = "^unifieddyes_available_overlay.png" overlay = "^unifieddyes_available_overlay.png"
end end
if dye == unifieddyes.player_selected_dye[player_name] then if dye == unifieddyes.player_selected_dye[player_name] then
overlay = "^unifieddyes_select_overlay.png" overlay = "^unifieddyes_select_overlay.png"
selindic = "unifieddyes_white_square.png"..colorize..overlay.."]"..
"tooltip["..val..hue..sat..";"..val..hue..sat.."]"
end end
local colorize = minetest.formspec_escape("^[colorize:#"..color..":255")
base_form = base_form.."image_button[".. base_form = base_form.."image_button["..
(hp*hps)..","..(v2*vps+vs)..";".. (hp*hps)..","..(v2*vps+vs)..";"..
size.. size..
@ -914,16 +920,18 @@ function unifieddyes.show_airbrush_form(player)
local dye = "dye:"..val..hue..sat local dye = "dye:"..val..hue..sat
local overlay = "" local overlay = ""
local colorize = minetest.formspec_escape("^[colorize:#"..color..":255")
if not creative and inv:contains_item("main", dye) then if not creative and inv:contains_item("main", dye) then
overlay = "^unifieddyes_available_overlay.png" overlay = "^unifieddyes_available_overlay.png"
end end
if dye == unifieddyes.player_selected_dye[player_name] then if dye == unifieddyes.player_selected_dye[player_name] then
overlay = "^unifieddyes_select_overlay.png" overlay = "^unifieddyes_select_overlay.png"
selindic = "unifieddyes_white_square.png"..colorize..overlay.."]"..
"tooltip["..val..hue..sat..";"..val..hue..sat.."]"
end end
local colorize = minetest.formspec_escape("^[colorize:#"..color..":255")
base_form = base_form.."image_button[".. base_form = base_form.."image_button["..
(hp*hps)..","..(v2*vps+vs)..";".. (hp*hps)..","..(v2*vps+vs)..";"..
size.. size..
@ -952,15 +960,18 @@ function unifieddyes.show_airbrush_form(player)
local dye = "dye:"..grey2 local dye = "dye:"..grey2
local overlay = "" local overlay = ""
local colorize = minetest.formspec_escape("^[colorize:#"..grey..":255")
if not creative and inv:contains_item("main", dye) then if not creative and inv:contains_item("main", dye) then
overlay = "^unifieddyes_available_overlay.png" overlay = "^unifieddyes_available_overlay.png"
end end
if dye == unifieddyes.player_selected_dye[player_name] then if dye == unifieddyes.player_selected_dye[player_name] then
overlay = "^unifieddyes_select_overlay.png" overlay = "^unifieddyes_select_overlay.png"
slindic = "unifieddyes_white_square.png"..colorize..overlay.."]"..
"tooltip["..grey2..";"..grey2.."]"
end end
local colorize = minetest.formspec_escape("^[colorize:#"..grey..":255")
base_form = base_form.."image_button[".. base_form = base_form.."image_button["..
(hp*hps)..","..(v2*vps+vs)..";".. (hp*hps)..","..(v2*vps+vs)..";"..
size.. size..
@ -975,7 +986,7 @@ function unifieddyes.show_airbrush_form(player)
"unifieddyes_available_overlay.png]".. "unifieddyes_available_overlay.png]"..
"label[11.0,"..(vps*5.1+vs)..";Dyes on hand]".. "label[11.0,"..(vps*5.1+vs)..";Dyes on hand]"..
"image[12.5,"..(vps*5+vs)..";"..size.. "image[12.5,"..(vps*5+vs)..";"..size..
"unifieddyes_select_overlay.png]".. selindic..
"label[13.2,"..(vps*5.1+vs)..";Your selection]" "label[13.2,"..(vps*5.1+vs)..";Your selection]"
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B