1
0
mirror of https://github.com/mt-mods/unifieddyes.git synced 2024-12-25 02:00:27 +01:00

Pink/brown color translation tweaks

Only perform pink -> light_red and brown -> dark_orange translations if
not using the "colorwallmounted" palette.
This commit is contained in:
Vanessa Ezekowitz 2017-02-06 09:22:10 -05:00
parent e3b7e9d534
commit 4d11406f8d

View File

@ -223,9 +223,6 @@ function unifieddyes.getpaletteidx(color, is_color_fdir)
return return
end end
color = aliases[color] or color
local idx
if is_color_fdir == "wallmounted" then if is_color_fdir == "wallmounted" then
if grayscale_wallmounted[color] then if grayscale_wallmounted[color] then
return (grayscale_wallmounted[color] * 8), 0 return (grayscale_wallmounted[color] * 8), 0
@ -257,18 +254,27 @@ function unifieddyes.getpaletteidx(color, is_color_fdir)
end end
if is_color_fdir == "wallmounted" then if is_color_fdir == "wallmounted" then
if shade == "dark" and color == "orange" then return 48,1 -- brown if color == "brown" then return 48,1
elseif shade == "light" and color == "red" then return 56,7 -- pink elseif color == "pink" then return 56,7
elseif hues_wallmounted[color] and shades_wallmounted[shade] then elseif hues_wallmounted[color] and shades_wallmounted[shade] then
return (shades_wallmounted[shade] * 64 + hues_wallmounted[color] * 8), hues_wallmounted[color] return (shades_wallmounted[shade] * 64 + hues_wallmounted[color] * 8), hues_wallmounted[color]
end end
elseif hues[color] and shades[shade] then else
if color == "brown" then
color = "orange"
shade = "dark"
elseif color == "pink" then
color = "red"
shade = "light"
end
if hues[color] and shades[shade] then
if is_color_fdir then if is_color_fdir then
return (shades[shade] * 32), hues[color] return (shades[shade] * 32), hues[color]
else else
return (hues[color] * 8 + shades[shade]), hues[color] return (hues[color] * 8 + shades[shade]), hues[color]
end end
end end
end
end end
function unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger) function unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
@ -298,11 +304,13 @@ function unifieddyes.on_use(itemstack, player, pointed_thing)
local nodedef = minetest.registered_nodes[node.name] local nodedef = minetest.registered_nodes[node.name]
local playername = player:get_player_name() local playername = player:get_player_name()
-- if the node has an on_punch defined, bail out and call that instead. -- if the node has an on_punch defined, bail out and call that instead, unless "sneak" is pressed.
if not player:get_player_control().sneak then
local onpunch = nodedef.on_punch(pos, node, player, pointed_thing) local onpunch = nodedef.on_punch(pos, node, player, pointed_thing)
if onpunch then if onpunch then
return onpunch return onpunch
end end
end
-- if the target is unknown, has no groups defined, or isn't UD-colorable, just bail out -- if the target is unknown, has no groups defined, or isn't UD-colorable, just bail out
if not (nodedef and nodedef.groups and nodedef.groups.ud_param2_colorable) then if not (nodedef and nodedef.groups and nodedef.groups.ud_param2_colorable) then