Compare commits

...

17 Commits

Author SHA1 Message Date
Niklp de6e2e0e35
Fix nil crash when calling `unifieddyes.on_dig()` w/o PlayerRef (#21) 2024-04-19 15:41:56 +02:00
Luke aka SwissalpS 3e45f316a3
coloured nodes aren't ground content (#19) 2024-03-07 07:14:22 +01:00
Buckaroo Banzai ecd05bfd90
Bump `min_minetest_version` to "5.5.0" (#17)
closes #16
2023-11-27 22:04:35 +11:00
fluxionary 5af9254c3a
fix logic of unifieddyes.on_dig to conform w/ documentation (#15) 2023-11-23 17:05:42 +01:00
wsor4035 36c8bb5f5b
fix https://github.com/mt-mods/unifieddyes/issues/11#issuecomment-1469934442 - syntac formating for translation files(remove whitespace) - make wuzzy happy 2023-03-15 22:11:08 -07:00
Thomas--S 96a939c069
Airbrush: Fix dye selection by not relying on internal behaviour of minetest.serialize (#10) 2022-09-11 11:49:23 +02:00
unknown 878377301f respect the shift click convention and fix unreachable if else(if) tree 2022-05-29 10:29:47 -04:00
OgelGames 2af4f1fb98 Revert "workaround for engine bug in crafting, placing, digging items with a palette index of 0"
This reverts commit eb5610fc10.
2022-05-07 16:50:23 +10:00
unknown c079888023 workaround patch for https://github.com/minetest-mods/i3/issues/68 closes https://github.com/mt-mods/unifieddyes/issues/7 2022-04-23 22:37:55 -04:00
wsor4035 ed895734f2
fix luacheck error 2022-04-15 17:58:13 -04:00
wsor4035 26994e39f2
fix https://github.com/mt-mods/unifieddyes/issues/6 2022-03-29 23:01:55 -04:00
wsor4035 41dd54d1be
Merge pull request #5 from mt-mods/luacheck
make game agnostic, add luacheck, add github actions
2022-02-24 11:19:01 -05:00
unknown 608c80662a patch broken colors in airbrush and bump min to 5.3.0 2022-02-23 22:37:58 -05:00
unknown 934ac7180b make it game agnostic 2022-02-22 22:15:16 -05:00
unknown 62526b9a3b add luacheck 2022-02-22 22:07:53 -05:00
wsor4035 521b73d4ed
update api link 2022-02-22 21:44:39 -05:00
Vanessa Dannenberg ff3b2d30fa Fix right-click crash on unknown nodes 2021-04-20 12:30:39 -04:00
12 changed files with 404 additions and 284 deletions

18
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt-get install -y luarocks
- name: luacheck install
run: luarocks install --local luacheck
- name: luacheck run
run: $HOME/.luarocks/bin/luacheck ./

25
.luacheckrc Normal file
View File

@ -0,0 +1,25 @@
unused_args = false
allow_defined_top = true
exclude_files = {".luacheckrc"}
globals = {
"minetest", "core",
--mod provided
"unifieddyes",
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
--luac
"math", "table",
-- Builtin
"vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", "PcgRandom", "VoxelManip", "PseudoRandom",
--mod produced
}

View File

@ -13,4 +13,4 @@ Install: Unzip the distribution file, rename the resultant folder to just "unifi
Usage: for detailed usage information, please see [the Unified Dyes Thread](https://forum.minetest.net/viewtopic.php?f=11&t=2178&p=28399) on the Minetest forum.
API: the full API is documented here: https://github.com/minetest-mods/unifieddyes/blob/master/API.md
API: the full API is documented here: https://github.com/mt-mods/unifieddyes/blob/master/API.md

View File

@ -49,7 +49,7 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
return
end
local palette = nil
local palette
local fdir = 0
if not def or not def.palette then
minetest.chat_send_player(player_name, "*** That node can't be colored -- it's either undefined or has no palette.")
@ -71,12 +71,15 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
local idx, hue = unifieddyes.getpaletteidx(painting_with, palette)
local inv = player:get_inventory()
if (not creative or not creative.is_enabled_for(player_name)) and not inv:contains_item("main", painting_with) then
if (not minetest.is_creative_enabled(player_name)) and not inv:contains_item("main", painting_with) then
local suff = ""
if not idx then
suff = " Besides, "..string.sub(painting_with, 5).." can't be applied to that node."
end
minetest.chat_send_player(player_name, "*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff)
minetest.chat_send_player(
player_name,
"*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff
)
return
end
@ -92,8 +95,8 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
local modname = string.sub(name, 1, string.find(name, ":")-1)
local nodename2 = string.sub(name, string.find(name, ":")+1)
local oldcolor = "snozzberry"
local newcolor = "razzberry" -- intentionally misspelled ;-)
local oldcolor
local newcolor
if def.ud_color_start and def.ud_color_end then
oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end)
@ -123,7 +126,7 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
return
end
minetest.swap_node(pos, {name = name, param2 = fdir + idx})
if not creative or not creative.is_enabled_for(player_name) then
if not minetest.is_creative_enabled(player_name) then
inv:remove_item("main", painting_with)
return
end
@ -144,7 +147,7 @@ function unifieddyes.make_readable_color(color)
local s = string.gsub(color, "_s50", "")
-- replace underscores with spaces to make it look nicer
local s = string.gsub(s, "_", " ")
s = string.gsub(s, "_", " ")
-- capitalize words, you know, looks nicer ;)
s = string.gsub(s, "(%l)(%w*)", function(a,b) return string.upper(a)..b end)
@ -160,7 +163,8 @@ function unifieddyes.make_readable_color(color)
return s
end
function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2,
selindic, inv, explist)
local dye = "dye:"..colorname
@ -216,7 +220,7 @@ function unifieddyes.show_airbrush_form(player)
local player_name = player:get_player_name()
local painting_with = unifieddyes.player_selected_dye[player_name] or unifieddyes.player_current_dye[player_name]
local creative = creative and creative.is_enabled_for(player_name)
local creative = minetest.is_creative_enabled(player_name)
local inv = player:get_inventory()
local nodepalette = "extended"
local showall = unifieddyes.player_showall[player_name]
@ -226,7 +230,10 @@ function unifieddyes.show_airbrush_form(player)
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
if last_right_click then
if last_right_click.def and last_right_click.def.palette then
if not last_right_click.def then
last_right_click.def = {}
last_right_click.undef = true
elseif last_right_click.def.palette then
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
nodepalette = "wallmounted"
elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then
@ -240,7 +247,9 @@ function unifieddyes.show_airbrush_form(player)
end
end
if not last_right_click.def.groups
if last_right_click.undef then
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked an undefined node, showing all colors)").."]"
elseif not last_right_click.def.groups
or not last_right_click.def.groups.ud_param2_colorable
or not last_right_click.def.palette
or not string.find(last_right_click.def.palette, "unifieddyes_palette_") then
@ -275,7 +284,8 @@ 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, explist)
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
@ -308,7 +318,8 @@ 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, explist)
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
@ -322,7 +333,7 @@ function unifieddyes.show_airbrush_form(player)
local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
local grey = "grey_"..y
if y == 0 then grey = "black"
if y == 0 then grey = "black"
elseif y == 4 then grey = "dark_grey"
elseif y == 8 then grey = "grey"
elseif y == 11 then grey = "light_grey"
@ -330,7 +341,8 @@ 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, explist)
f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2,
selindic, inv, explist)
t[#t+1] = f
end
@ -407,11 +419,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
if fields.show_all then
if fields.show_all then
unifieddyes.player_showall[player_name] = true
unifieddyes.show_airbrush_form(player)
return
elseif fields.show_avail then
elseif fields.show_avail then
unifieddyes.player_showall[player_name] = false
unifieddyes.show_airbrush_form(player)
return
@ -426,7 +438,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but the selected color can't be used on the")
minetest.chat_send_player(player_name, "*** node that was right-clicked (and \"Show All\" wasn't in effect).")
if unifieddyes.player_current_dye[player_name] then
minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "..string.sub(unifieddyes.player_current_dye[player_name], 5)..".")
minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "
..string.sub(unifieddyes.player_current_dye[player_name], 5)..".")
else
minetest.chat_send_player(player_name, "*** Ignoring it.")
end
@ -442,16 +455,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
else
local s1 = string.sub(minetest.serialize(fields), 11)
local s3 = string.sub(s1,1, string.find(s1, '"')-1)
local color, _ = next(fields)
local inv = player:get_inventory()
local creative = creative and creative.is_enabled_for(player_name)
local dye = "dye:"..s3
local creative = minetest.is_creative_enabled(player_name)
local dye = "dye:"..color
if (showall or unifieddyes.palette_has_color[nodepalette.."_"..s3]) and
(minetest.registered_items[dye] and (creative or inv:contains_item("main", dye))) then
unifieddyes.player_selected_dye[player_name] = dye
if (showall or unifieddyes.palette_has_color[nodepalette.."_"..color]) and
(creative or inv:contains_item("main", dye)) then
unifieddyes.player_selected_dye[player_name] = dye
unifieddyes.show_airbrush_form(player)
end
end
@ -477,6 +489,10 @@ minetest.register_tool("unifieddyes:airbrush", {
if pos then node = minetest.get_node(pos) end
if node then def = minetest.registered_items[node.name] end
if keys.sneak and def and def.on_rightclick then
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing)
end
unifieddyes.player_last_right_clicked[player_name] = {pos = pos, node = node, def = def}
if not keys.aux1 then
@ -487,12 +503,10 @@ minetest.register_tool("unifieddyes:airbrush", {
if newcolor and string.find(def.paramtype2, "color") then
minetest.chat_send_player(player_name, "*** Switching to "..newcolor.." for the airbrush, to match that node.")
unifieddyes.player_current_dye[player_name] = "dye:"..newcolor
unifieddyes.player_current_dye[player_name] = "dye:"..newcolor
else
minetest.chat_send_player(player_name, "*** That node is uncolored.")
end
elseif def.on_rightclick then
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing)
end
end
})

View File

@ -1,5 +1,7 @@
minetest.register_alias("dye:light_red", "dye:pink")
minetest.register_alias("dye:medium_orange", "dye:brown")
if minetest.get_modpath("dye") then
minetest.register_alias("dye:light_red", "dye:pink")
minetest.register_alias("dye:medium_orange", "dye:brown")
end
minetest.register_alias("unifieddyes:black", "dye:black")
minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey")

183
api.lua
View File

@ -1,7 +1,5 @@
-- This file supplies the majority of Unified Dyes' API
local S = minetest.get_translator("unifieddyes")
unifieddyes.player_current_dye = {}
unifieddyes.player_selected_dye = {}
unifieddyes.player_last_right_clicked = {}
@ -23,11 +21,14 @@ minetest.register_on_placenode(
return false
end
local param2
if not string.find(itemstack:to_string(), "palette_index") then
local param2
local color = 0
if def.palette == "unifieddyes_palette_extended.png"
and def.paramtype2 == "color" then
param2 = 240
color = 240
elseif def.palette == "unifieddyes_palette_colorwallmounted.png"
and def.paramtype2 == "colorwallmounted" then
param2 = newnode.param2 % 8
@ -38,55 +39,135 @@ minetest.register_on_placenode(
if param2 then
minetest.swap_node(pos, {name = newnode.name, param2 = param2})
minetest.get_meta(pos):set_int("palette_index", color)
end
end
if def.palette ~= "" then
minetest.get_meta(pos):set_int("palette_index", param2 or 240)
end
end
)
-- The complementary function: strip-off the color if the node being dug is still white/neutral
-- The complementary function: strip-off the color if the node being dug is still white/neutral
-- adapted from
-- https://github.com/minetest/minetest/blob/fe8d04d0b3c2e3af7c406fb6527f1b5230a30137/builtin/game/item.lua#L460-L562
local function node_dig_without_color(pos, node, digger)
if not digger then return false end
local diggername = digger:get_player_name()
local function move_item(item, pos, inv, digger, fix_color)
if not (digger and digger:is_player()) then return end
local creative = creative_mode or minetest.check_player_privs(digger, "creative")
item = unifieddyes.fix_bad_color_info(item, fix_color)
if inv:room_for_item("main", item)
and (not creative or not inv:contains_item("main", item, true)) then
inv:add_item("main", item)
elseif not creative then
minetest.item_drop(ItemStack(item), digger, pos)
local def = ItemStack(node.name):get_definition()
-- Copy pos because the callback could modify it
if not def.diggable or (def.can_dig and not def.can_dig(vector.copy(pos), digger)) then
minetest.log("info", diggername .. " tried to dig "
.. node.name .. " which is not diggable "
.. minetest.pos_to_string(pos))
return false
end
if minetest.is_protected(pos, diggername) then
minetest.log("action", diggername
.. " tried to dig " .. node.name
.. " at protected position "
.. minetest.pos_to_string(pos))
minetest.record_protection_violation(pos, diggername)
return false
end
minetest.log('action', diggername .. " digs "
.. node.name .. " at " .. minetest.pos_to_string(pos))
local wielded = digger and digger:get_wielded_item()
local drops = {node.name} -- this is instead of asking minetest to generate the node drops
if wielded then
local wdef = wielded:get_definition()
local tp = wielded:get_tool_capabilities()
local dp = minetest.get_dig_params(def and def.groups, tp, wielded:get_wear())
if wdef and wdef.after_use then
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
else
-- Wear out tool
if not minetest.is_creative_enabled(diggername) then
wielded:add_wear(dp.wear)
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {
pos = pos,
gain = 0.5
}, true)
end
end
end
digger:set_wielded_item(wielded)
end
-- Check to see if metadata should be preserved.
if def and def.preserve_metadata then
local oldmeta = minetest.get_meta(pos):to_table().fields
-- Copy pos and node because the callback can modify them.
local pos_copy = vector.copy(pos)
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
local drop_stacks = {}
for k, v in pairs(drops) do
drop_stacks[k] = ItemStack(v)
end
drops = drop_stacks
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
end
-- Handle drops
minetest.handle_node_drops(pos, drops, digger)
local oldmetadata
if def and def.after_dig_node then
oldmetadata = minetest.get_meta(pos):to_table()
end
-- Remove node and update
minetest.remove_node(pos)
-- Play sound if it was done by a player
if diggername ~= "" and def and def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {
pos = pos,
exclude_player = diggername,
}, true)
end
-- Run callback
if def and def.after_dig_node then
-- Copy pos and node because callback can modify them
local pos_copy = vector.copy(pos)
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
def.after_dig_node(pos_copy, node_copy, oldmetadata, digger)
end
-- Run script hook
for _, callback in ipairs(minetest.registered_on_dignodes) do
local origin = minetest.callback_origins[callback]
minetest.set_last_run_mod(origin.mod)
-- Copy pos and node because callback can modify them
local pos_copy = vector.copy(pos)
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
callback(pos_copy, node_copy, digger)
end
return true
end
function unifieddyes.on_dig(pos, node, digger)
if not digger then return end
local playername = digger:get_player_name()
if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return
end
local oldparam2 = minetest.get_node(pos).param2
local param2 = minetest.get_node(pos).param2
local def = minetest.registered_items[node.name]
local fix_color
local del_color
if def.paramtype2 == "color" and oldparam2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
fix_color = 240
elseif def.paramtype2 == "color" and oldparam2 == 0 and def.palette == "unifieddyes_palette_extended.png" then
fix_color = 0
elseif def.paramtype2 == "colorwallmounted" and math.floor(oldparam2 / 8) == 0 and def.palette == "unifieddyes_palette_colorwallmounted.png" then
fix_color = 0
elseif def.paramtype2 == "colorfacedir" and math.floor(oldparam2 / 32) == 0 and string.find(def.palette, "unifieddyes_palette_") then
fix_color = 0
if def.paramtype2 == "color" and param2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
del_color = true
elseif (def.paramtype2 == "colorwallmounted" or def.paramtype2 == "colorfacedir")
and minetest.strip_param2_color(param2, def.paramtype2) == 0
and string.find(def.palette, "unifieddyes_palette_")
then
del_color = true
end
local inv = digger:get_inventory()
if fix_color then
move_item(node.name, pos, inv, digger, fix_color)
if del_color then
return node_dig_without_color(pos, node, digger)
else
return minetest.node_dig(pos, node, digger)
end
@ -117,6 +198,7 @@ function unifieddyes.generate_split_palette_nodes(name, def, drop)
def2.palette = "unifieddyes_palette_"..color.."s.png"
def2.paramtype2 = "colorfacedir"
def2.groups.ud_param2_colorable = 1
def2.is_ground_content = false
if drop then
def2.drop = {
@ -132,14 +214,11 @@ end
-- This helper function creates a colored itemstack
function unifieddyes.fix_bad_color_info(item, paletteidx)
local stack=minetest.itemstring_with_color(item, paletteidx)
return string.gsub(stack, "u0001color", "u0001palette_index")
end
function unifieddyes.make_colored_itemstack(item, palette, color)
local paletteidx = unifieddyes.getpaletteidx(color, palette)
return unifieddyes.fix_bad_color_info(item, paletteidx), paletteidx
local stack = ItemStack(item)
stack:get_meta():set_int("palette_index", paletteidx)
return stack:to_string(),paletteidx
end
-- these helper functions register all of the recipes needed to create colored
@ -147,7 +226,7 @@ end
local function register_c(craft, h, sat, val)
local hue = (type(h) == "table") and h[1] or h
local color = ""
local color
if val then
if craft.palette == "wallmounted" then
color = val..hue..sat
@ -288,9 +367,9 @@ end
function unifieddyes.get_hsv(name) -- expects a node/item name
local hue = ""
local a,b
local a
for _, i in ipairs(unifieddyes.HUES_EXTENDED) do
a,b = string.find(name, "_"..i[1])
a,_ = string.find(name, "_"..i[1])
if a then
hue = i[1]
break
@ -328,8 +407,6 @@ end
function unifieddyes.getpaletteidx(color, palette_type)
local origcolor = color
if string.sub(color,1,4) == "dye:" then
color = string.sub(color,5,-1)
elseif string.sub(color,1,12) == "unifieddyes:" then
@ -383,7 +460,8 @@ function unifieddyes.getpaletteidx(color, palette_type)
elseif color == "pink" then return 56,7
elseif color == "blue" and shade == "light" then return 40,5
elseif unifieddyes.gpidx_hues_wallmounted[color] and unifieddyes.gpidx_shades_wallmounted[shade] then
return (unifieddyes.gpidx_shades_wallmounted[shade] * 64 + unifieddyes.gpidx_hues_wallmounted[color] * 8), unifieddyes.gpidx_hues_wallmounted[color]
return (unifieddyes.gpidx_shades_wallmounted[shade] * 64 + unifieddyes.gpidx_hues_wallmounted[color] * 8),
unifieddyes.gpidx_hues_wallmounted[color]
end
else
if color == "brown" then
@ -399,7 +477,8 @@ function unifieddyes.getpaletteidx(color, palette_type)
end
elseif palette_type == "extended" then
if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_extended[shade] then
return (unifieddyes.gpidx_hues_extended[color] + unifieddyes.gpidx_shades_extended[shade]*24), unifieddyes.gpidx_hues_extended[color]
return (unifieddyes.gpidx_hues_extended[color] + unifieddyes.gpidx_shades_extended[shade]*24),
unifieddyes.gpidx_hues_extended[color]
end
end
end
@ -427,7 +506,7 @@ function unifieddyes.color_to_name(param2, def)
local color = param2
local v = 0
local s = 1
local s = 1
if color < 24 then v = 1
elseif color > 23 and color < 48 then v = 2
elseif color > 47 and color < 72 then v = 3
@ -445,7 +524,7 @@ function unifieddyes.color_to_name(param2, def)
elseif color == 244 then return "light_grey"
elseif color == 247 then return "grey"
elseif color == 251 then return "dark_grey"
elseif color == 255 then return "black"
elseif color == 255 then return "black"
else return "grey_"..15-(color-240)
end
else

View File

@ -91,24 +91,6 @@ for i = 1, 14 do
end
end
local default_dyes = {
"black",
"blue",
"brown",
"cyan",
"dark_green",
"dark_grey",
"green",
"grey",
"magenta",
"orange",
"pink",
"red",
"violet",
"white",
"yellow"
}
-- reverse lookups for getpaletteidx()
unifieddyes.gpidx_aliases = {

View File

@ -56,11 +56,11 @@ for _, h in ipairs(unifieddyes.HUES_EXTENDED) do
local g3 = math.floor(p+(g2-p)*0.5)
local b3 = math.floor(p+(b2-p)*0.5)
local color = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
local ccolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
minetest.register_craftitem(":dye:"..val..hue.."_s50", {
description = S(desc.." (low saturation)"),
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
inventory_image = "unifieddyes_dye.png^[colorize:#"..ccolor..":200",
groups = { dye=1, not_in_creative_inventory=1 },
})
minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50")
@ -87,19 +87,21 @@ for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes
end
end
minetest.override_item("dye:grey", {
inventory_image = "unifieddyes_dye.png^[colorize:#888888:200",
})
if minetest.get_modpath("dye") then
minetest.override_item("dye:grey", {
inventory_image = "unifieddyes_dye.png^[colorize:#888888:200",
})
minetest.override_item("dye:dark_grey", {
inventory_image = "unifieddyes_dye.png^[colorize:#444444:200",
})
minetest.override_item("dye:dark_grey", {
inventory_image = "unifieddyes_dye.png^[colorize:#444444:200",
})
minetest.register_craftitem(":dye:light_grey", {
description = S("Light grey Dye"),
inventory_image = "unifieddyes_dye.png^[colorize:#cccccc:200",
groups = { dye=1, not_in_creative_inventory=1 },
})
minetest.register_craftitem(":dye:light_grey", {
description = S("Light grey Dye"),
inventory_image = "unifieddyes_dye.png^[colorize:#cccccc:200",
groups = { dye=1, not_in_creative_inventory=1 },
})
end
-- build a table of color <-> palette associations to reduce the need for
-- realtime lookups with getpaletteidx()
@ -122,7 +124,7 @@ for _, palette in ipairs({"extended", "split", "wallmounted"}) do
for y = 0, 15 do
local grey = "grey_"..y
if y == 0 then grey = "black"
if y == 0 then grey = "black"
elseif y == 4 then grey = "dark_grey"
elseif y == 8 then grey = "grey"
elseif y == 11 then grey = "light_grey"

View File

@ -31,9 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
unifieddyes = {}
local creative_mode = minetest.settings:get_bool("creative_mode")
local S = minetest.get_translator("unifieddyes")
local modpath=minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/color-tables.lua")
@ -42,4 +39,5 @@ dofile(modpath.."/airbrush.lua")
dofile(modpath.."/dyes-crafting.lua")
dofile(modpath.."/aliases.lua")
print(S("[UnifiedDyes] Loaded!"))
print("[UnifiedDyes] Loaded!")
unifieddyes.init = true

View File

@ -2,91 +2,91 @@
# Template
Lime Dye=
Aqua Dye=
Sky-blue Dye=
Red-violet Dye=
Light Grey Dye=
Lime Dye=
Aqua Dye=
Sky-blue Dye=
Red-violet Dye=
Light Grey Dye=
Dark Red Dye (low saturation)=
Dark Orange Dye (low saturation)=
Dark Yellow Dye (low saturation)=
Dark Lime Dye (low saturation)=
Dark Green Dye (low saturation)=
Dark Aqua Dye (low saturation)=
Dark Cyan Dye (low saturation)=
Dark Sky-blue Dye (low saturation)=
Dark Blue Dye (low saturation)=
Dark Violet Dye (low saturation)=
Dark Magenta Dye (low saturation)=
Dark Red-violet Dye (low saturation)=
Dark Red Dye (low saturation)=
Dark Orange Dye (low saturation)=
Dark Yellow Dye (low saturation)=
Dark Lime Dye (low saturation)=
Dark Green Dye (low saturation)=
Dark Aqua Dye (low saturation)=
Dark Cyan Dye (low saturation)=
Dark Sky-blue Dye (low saturation)=
Dark Blue Dye (low saturation)=
Dark Violet Dye (low saturation)=
Dark Magenta Dye (low saturation)=
Dark Red-violet Dye (low saturation)=
Dark Red Dye=
Dark Orange Dye=
Dark Yellow Dye=
Dark Lime Dye=
Dark Green Dye=
Dark Aqua Dye=
Dark Cyan Dye=
Dark Sky-blue Dye=
Dark Blue Dye=
Dark Violet Dye=
Dark Magenta Dye=
Dark Red-violet Dye=
Dark Red Dye=
Dark Orange Dye=
Dark Yellow Dye=
Dark Lime Dye=
Dark Green Dye=
Dark Aqua Dye=
Dark Cyan Dye=
Dark Sky-blue Dye=
Dark Blue Dye=
Dark Violet Dye=
Dark Magenta Dye=
Dark Red-violet Dye=
Medium Red Dye (low saturation)=
Medium Orange Dye (low saturation)=
Medium Yellow Dye (low saturation)=
Medium Lime Dye (low saturation)=
Medium Green Dye (low saturation)=
Medium Aqua Dye (low saturation)=
Medium Cyan Dye (low saturation)=
Medium Sky-blue Dye (low saturation)=
Medium Blue Dye (low saturation)=
Medium Violet Dye (low saturation)=
Medium Magenta Dye (low saturation)=
Medium Red-violet Dye (low saturation)=
Medium Red Dye (low saturation)=
Medium Orange Dye (low saturation)=
Medium Yellow Dye (low saturation)=
Medium Lime Dye (low saturation)=
Medium Green Dye (low saturation)=
Medium Aqua Dye (low saturation)=
Medium Cyan Dye (low saturation)=
Medium Sky-blue Dye (low saturation)=
Medium Blue Dye (low saturation)=
Medium Violet Dye (low saturation)=
Medium Magenta Dye (low saturation)=
Medium Red-violet Dye (low saturation)=
Medium Red Dye=
Medium Orange Dye=
Medium Yellow Dye=
Medium Lime Dye=
Medium Green Dye=
Medium Aqua Dye=
Medium Cyan Dye=
Medium Sky-blue=
Medium Blue Dye=
Medium Violet Dye=
Medium Magenta Dye=
Medium Red-violet Dye=
Medium Red Dye=
Medium Orange Dye=
Medium Yellow Dye=
Medium Lime Dye=
Medium Green Dye=
Medium Aqua Dye=
Medium Cyan Dye=
Medium Sky-blue=
Medium Blue Dye=
Medium Violet Dye=
Medium Magenta Dye=
Medium Red-violet Dye=
Red Dye (low saturation)=
Orange Dye (low saturation)=
Yellow Dye (low saturation)=
Lime Dye (low saturation)=
Green Dye (low saturation)=
Aqua Dye (low saturation)=
Cyan Dye (low saturation)=
Sky-blue Dye (low saturation)=
Blue Dye (low saturation)=
Violet Dye (low saturation)=
Magenta Dye (low saturation)=
Red-violet Dye (low saturation)=
Red Dye (low saturation)=
Orange Dye (low saturation)=
Yellow Dye (low saturation)=
Lime Dye (low saturation)=
Green Dye (low saturation)=
Aqua Dye (low saturation)=
Cyan Dye (low saturation)=
Sky-blue Dye (low saturation)=
Blue Dye (low saturation)=
Violet Dye (low saturation)=
Magenta Dye (low saturation)=
Red-violet Dye (low saturation)=
Red Dye=
Orange Dye=
Yellow Dye=
Lime Dye=
Green Dye=
Aqua Dye=
Cyan Dye=
Sky-blue Dye=
Blue Dye=
Violet Dye=
Magenta Dye=
Red-violet Dye=
Red Dye=
Orange Dye=
Yellow Dye=
Lime Dye=
Green Dye=
Aqua Dye=
Cyan Dye=
Sky-blue Dye=
Blue Dye=
Violet Dye=
Magenta Dye=
Red-violet Dye=
[UnifiedDyes] Loaded!=
[UnifiedDyes] Loaded!=
Dye Airbrush=

View File

@ -3,88 +3,88 @@
# TUrkish translation
# Mahmutelmas06@hotmail.com
Lime Dye=Limon Yeşili Boya
Aqua Dye=Deniz mavisi Boya
Sky-blue Dye=Gök-Mavi Boya
Red-violet Dye=Kırmızılı Boya
Light Grey Dye=Açık Grey Boya
Dark Red Dye (low saturation)=Koyu Kırmızı Boya (düşük doygunluk)
Dark Orange Dye (low saturation)=Koyu Turuncu Boya (düşük doygunluk)
Dark Yellow Dye (low saturation)=Koyu Sarı Boya (düşük doygunluk)
Dark Lime Dye (low saturation)=Koyu Limon Yeşili Boya (düşük doygunluk)
Dark Green Dye (low saturation)=Koyu Yeşil Boya (düşük doygunluk)
Dark Aqua Dye (low saturation)=Koyu Deniz mavisi boya (düşük doygunluk)
Dark Cyan Dye (low saturation)=Koyu Cam göbeği Boya (düşük doygunluk)
Dark Sky-blue Dye (low saturation)=Koyu Gök-Mavi Boya (düşük doygunluk)
Dark Blue Dye (low saturation)=Koyu Mavi Boya (düşük doygunluk)
Dark Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Dark Magenta Dye (low saturation)=Koyu Kızılımsı Mor Boya (düşük doygunluk)
Dark Red-violet Dye (low saturation)=Koyu Kırmızılı Boya (düşük doygunluk)
Dark Red Dye=Koyu Kırmızı Boya
Dark Orange Dye=Koyu Turuncu Boya
Dark Yellow Dye=Koyu Sarı Boya
Dark Lime Dye=Koyu Limon Yeşili Boya
Dark Green Dye=Koyu Yeşil Boya
Dark Aqua Dye=Koyu Deniz mavisi Boya
Dark Cyan Dye=Koyu Cam göbeği Boya
Dark Sky-blue Dye=Koyu Gök-Mavi Boya
Dark Blue Dye=Koyu Mavi Boya
Dark Violet Dye=Koyu mor Boya
Dark Magenta Dye=Koyu Kızılımsı Mor Boya
Dark Red-violet Dye=Koyu Kırmızılı Boya
Medium Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
Medium Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
Medium Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
Medium Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
Medium Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
Medium Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
Medium Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
Medium Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
Medium Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
Medium Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Medium Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
Medium Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
Medium Red Dye=Kırmızı Boya
Medium Orange Dye=Turuncu Boya
Medium Yellow Dye=Sarı Boya
Medium Lime Dye=Limon Yeşili Boya
Medium Green Dye=Yeşil Boya
Medium Aqua Dye=Deniz mavisi Boya
Medium Cyan Dye=Cam göbeği Boya
Medium Sky-blue=Gök-Mavi
Medium Blue Dye=Mavi Boya
Medium Violet Dye=Koyu mor Boya
Medium Magenta Dye=Kızılımsı Mor Boya
Medium Red-violet Dye=Kırmızılı Boya
Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
Red Dye=Kırmızı Boya
Orange Dye=Turuncu Boya
Yellow Dye=Sarı Boya
Lime Dye=Limon Yeşili Boya
Green Dye=Yeşil Boya
Aqua Dye=Deniz mavisi Boya
Cyan Dye=Cam göbeği Boya
Sky-blue Dye=Gök-Mavi Boya
Blue Dye=Mavi Boya
Violet Dye=Koyu mor Boya
Magenta Dye=Kızılımsı Mor Boya
Red-violet Dye=Kırmızılı Boya
[UnifiedDyes] Loaded!=[UnifiedBoyas] yüklendi!
Lime Dye=Limon Yeşili Boya
Aqua Dye=Deniz mavisi Boya
Sky-blue Dye=Gök-Mavi Boya
Red-violet Dye=Kırmızılı Boya
Light Grey Dye=Açık Grey Boya
Dark Red Dye (low saturation)=Koyu Kırmızı Boya (düşük doygunluk)
Dark Orange Dye (low saturation)=Koyu Turuncu Boya (düşük doygunluk)
Dark Yellow Dye (low saturation)=Koyu Sarı Boya (düşük doygunluk)
Dark Lime Dye (low saturation)=Koyu Limon Yeşili Boya (düşük doygunluk)
Dark Green Dye (low saturation)=Koyu Yeşil Boya (düşük doygunluk)
Dark Aqua Dye (low saturation)=Koyu Deniz mavisi boya (düşük doygunluk)
Dark Cyan Dye (low saturation)=Koyu Cam göbeği Boya (düşük doygunluk)
Dark Sky-blue Dye (low saturation)=Koyu Gök-Mavi Boya (düşük doygunluk)
Dark Blue Dye (low saturation)=Koyu Mavi Boya (düşük doygunluk)
Dark Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Dark Magenta Dye (low saturation)=Koyu Kızılımsı Mor Boya (düşük doygunluk)
Dark Red-violet Dye (low saturation)=Koyu Kırmızılı Boya (düşük doygunluk)
Dark Red Dye=Koyu Kırmızı Boya
Dark Orange Dye=Koyu Turuncu Boya
Dark Yellow Dye=Koyu Sarı Boya
Dark Lime Dye=Koyu Limon Yeşili Boya
Dark Green Dye=Koyu Yeşil Boya
Dark Aqua Dye=Koyu Deniz mavisi Boya
Dark Cyan Dye=Koyu Cam göbeği Boya
Dark Sky-blue Dye=Koyu Gök-Mavi Boya
Dark Blue Dye=Koyu Mavi Boya
Dark Violet Dye=Koyu mor Boya
Dark Magenta Dye=Koyu Kızılımsı Mor Boya
Dark Red-violet Dye=Koyu Kırmızılı Boya
Medium Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
Medium Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
Medium Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
Medium Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
Medium Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
Medium Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
Medium Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
Medium Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
Medium Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
Medium Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Medium Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
Medium Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
Medium Red Dye=Kırmızı Boya
Medium Orange Dye=Turuncu Boya
Medium Yellow Dye=Sarı Boya
Medium Lime Dye=Limon Yeşili Boya
Medium Green Dye=Yeşil Boya
Medium Aqua Dye=Deniz mavisi Boya
Medium Cyan Dye=Cam göbeği Boya
Medium Sky-blue=Gök-Mavi
Medium Blue Dye=Mavi Boya
Medium Violet Dye=Koyu mor Boya
Medium Magenta Dye=Kızılımsı Mor Boya
Medium Red-violet Dye=Kırmızılı Boya
Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
Red Dye=Kırmızı Boya
Orange Dye=Turuncu Boya
Yellow Dye=Sarı Boya
Lime Dye=Limon Yeşili Boya
Green Dye=Yeşil Boya
Aqua Dye=Deniz mavisi Boya
Cyan Dye=Cam göbeği Boya
Sky-blue Dye=Gök-Mavi Boya
Blue Dye=Mavi Boya
Violet Dye=Koyu mor Boya
Magenta Dye=Kızılımsı Mor Boya
Red-violet Dye=Kırmızılı Boya
[UnifiedDyes] Loaded!=[UnifiedBoyas] yüklendi!

View File

@ -1,4 +1,4 @@
name = unifieddyes
description = Unified Dyes expands the standard dye set from 15 to 90 colors.
depends = default, dye, basic_materials
min_minetest_version = 5.2.0
optional_depends = default, dye, basic_materials
min_minetest_version = 5.5.0