mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2025-06-28 14:26:21 +02:00
Compare commits
15 Commits
2018-09-13
...
2019-07-18
Author | SHA1 | Date | |
---|---|---|---|
9ff40a7fe6 | |||
e048da9c3c | |||
6c8a0b2387 | |||
10ab87bf65 | |||
f59c8affc1 | |||
667bce80b9 | |||
5039a8ce07 | |||
13a8cbb38f | |||
58dd71e561 | |||
1fd850d37c | |||
334de564fd | |||
545968517b | |||
368205d3b8 | |||
feed6d5aae | |||
4811847655 |
12
API.md
12
API.md
@ -12,7 +12,6 @@ minetest.register_node("mymod:colored_node", {
|
|||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
groups = {snappy = 1, cracky = 2, ud_param2_colorable = 1}
|
groups = {snappy = 1, cracky = 2, ud_param2_colorable = 1}
|
||||||
on_construct = unifieddyes.on_construct,
|
|
||||||
airbrush_replacement_node = "mymod:my_other_colored_node"
|
airbrush_replacement_node = "mymod:my_other_colored_node"
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -32,8 +31,6 @@ minetest.register_node("mymod:colored_node", {
|
|||||||
|
|
||||||
If your node if of the kind where you need the split palette, but you need to put the *full color name* into the node name, as opposed to just the hue, then add the keys `ud_color_start` and `ud_color_end` and set them to the positions of the first and last characters of the color name (where 1 is the first character of the mod name at the start of the node name, i.e. "mymod:foo_bar_orange_baz" would have the start set to 15 and the end at 20).
|
If your node if of the kind where you need the split palette, but you need to put the *full color name* into the node name, as opposed to just the hue, then add the keys `ud_color_start` and `ud_color_end` and set them to the positions of the first and last characters of the color name (where 1 is the first character of the mod name at the start of the node name, i.e. "mymod:foo_bar_orange_baz" would have the start set to 15 and the end at 20).
|
||||||
|
|
||||||
`on_construct`: see below.
|
|
||||||
|
|
||||||
`airbrush_replacement_node`: The node to swap in when the airbrush is used on this node. For example, you could `minetest.override_item()` on some default node to add this field, pointing to a colorable node of your own, so that when the default node is painted, it's replaced with yours in the new color.
|
`airbrush_replacement_node`: The node to swap in when the airbrush is used on this node. For example, you could `minetest.override_item()` on some default node to add this field, pointing to a colorable node of your own, so that when the default node is painted, it's replaced with yours in the new color.
|
||||||
|
|
||||||
#### Function calls
|
#### Function calls
|
||||||
@ -86,10 +83,6 @@ This is called when a node is punched while wielding the airbrush.
|
|||||||
|
|
||||||
This one does just what it sounds like - it shows the color selector formspec.
|
This one does just what it sounds like - it shows the color selector formspec.
|
||||||
|
|
||||||
**`unifieddyes.on_construct(pos)`**
|
|
||||||
|
|
||||||
This function, usually called from your node definition's `on_construct`, just sets the `palette = "ext"` metadata key for the node after it's been placed. This can then be read in an LBM to determine if this node needs to be converted from the old 89-color palette to the extended 256-color palette. Although it is good practice to call this for any node that uses the 256-color palette, it isn't actually necessary as long as the node has never used the 89-color palette, and won't be subjected to an LBM that changes its color.
|
|
||||||
|
|
||||||
**`unifieddyes.register_color_craft(recipe)`**
|
**`unifieddyes.register_color_craft(recipe)`**
|
||||||
|
|
||||||
This will loop through all of Unified Dyes' color lists, generating one recipe for every color in the palette given in the call. Example usage:
|
This will loop through all of Unified Dyes' color lists, generating one recipe for every color in the palette given in the call. Example usage:
|
||||||
@ -167,10 +160,9 @@ If your mod used the old paradigm where you craft a neutral-colored item, place
|
|||||||
|
|
||||||
* Convert that remaining texture to grayscale, enhance its contrast as much as you can without distorting it, and rename it and the node it'll be used to something neutral-sounding.
|
* Convert that remaining texture to grayscale, enhance its contrast as much as you can without distorting it, and rename it and the node it'll be used to something neutral-sounding.
|
||||||
|
|
||||||
* Add the `on_construct` and `palette` keys to your neutral node definition, for example:
|
* Add the `palette` key to your neutral node definition, for example:
|
||||||
|
|
||||||
`palette = "unifieddyes_palette_extended.png",`
|
`palette = "unifieddyes_palette_extended.png",`
|
||||||
`on_construct = unifieddyes.on_construct,`
|
|
||||||
|
|
||||||
* Adjust your node's groups to specify that the node can be colored. Example (note the last item):
|
* Adjust your node's groups to specify that the node can be colored. Example (note the last item):
|
||||||
|
|
||||||
@ -180,7 +172,7 @@ If your mod used the old paradigm where you craft a neutral-colored item, place
|
|||||||
|
|
||||||
* Add the above recipes helper call (which replaces those delted recipes)
|
* Add the above recipes helper call (which replaces those delted recipes)
|
||||||
|
|
||||||
* If your colored node is based on someone else's neutral node, for example if you made a mod that creates multiple colors of minetest_game's default clay, you may find it best to create a single "stand-in" node that's identical to the neutral node, but named for your mod, hidden from the creative inventory, and which has a properly-prepared grayscale texture image in addition to the above keys. Use `minetest.override_item()` to add the `on_construct`, `palette`, and `airbrush_replacement_node` keys, and the `ud_param2_colorable` group, to that "someone else's" node. Then use that node and your custom, hidden node in the craft helper call.
|
* If your colored node is based on someone else's neutral node, for example if you made a mod that creates multiple colors of minetest_game's default clay, you may find it best to create a single "stand-in" node that's identical to the neutral node, but named for your mod, hidden from the creative inventory, and which has a properly-prepared grayscale texture image in addition to the above keys. Use `minetest.override_item()` to add the `palette` and `airbrush_replacement_node` keys, and the `ud_param2_colorable` group, to that "someone else's" node. Then use that node and your custom, hidden node in the craft helper call.
|
||||||
|
|
||||||
* You will need to write a run-only-once LBM to convert your old statically-colored nodes to use hardware coloring. See above for functions that will help reduce the work required for this part.
|
* You will need to write a run-only-once LBM to convert your old statically-colored nodes to use hardware coloring. See above for functions that will help reduce the work required for this part.
|
||||||
|
|
||||||
|
212
init.lua
212
init.lua
@ -99,6 +99,14 @@ unifieddyes.VALS = {
|
|||||||
"dark_"
|
"dark_"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS_SPLIT = {
|
||||||
|
"faint_",
|
||||||
|
"light_",
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
unifieddyes.VALS_EXTENDED = {
|
unifieddyes.VALS_EXTENDED = {
|
||||||
"faint_",
|
"faint_",
|
||||||
"pastel_",
|
"pastel_",
|
||||||
@ -120,7 +128,7 @@ unifieddyes.GREYS = {
|
|||||||
unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS)
|
unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS)
|
||||||
|
|
||||||
for i = 1, 14 do
|
for i = 1, 14 do
|
||||||
if i ~= 0 and i ~= 3 and i ~= 7 and i ~= 11 and i ~= 15 then
|
if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then
|
||||||
table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i)
|
table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -164,24 +172,67 @@ minetest.register_on_placenode(
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not string.find(itemstack:to_string(), "palette_index") then
|
if not string.find(itemstack:to_string(), "palette_index") then
|
||||||
local param2 = 0
|
local param2
|
||||||
local color = 0
|
local color = 0
|
||||||
|
|
||||||
if def.palette == "unifieddyes_palette_extended.png" then
|
if def.palette == "unifieddyes_palette_extended.png"
|
||||||
|
and def.paramtype2 == "color" then
|
||||||
param2 = 240
|
param2 = 240
|
||||||
color = 240
|
color = 240
|
||||||
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and def.paramtype2 == "colorwallmounted" then
|
||||||
param2 = newnode.param2 % 8
|
param2 = newnode.param2 % 8
|
||||||
else -- it's a split palette
|
elseif string.find(def.palette, "unifieddyes_palette_")
|
||||||
|
and def.paramtype2 == "colorfacedir" then -- it's a split palette
|
||||||
param2 = newnode.param2 % 32
|
param2 = newnode.param2 % 32
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if param2 then
|
||||||
minetest.swap_node(pos, {name = newnode.name, param2 = param2})
|
minetest.swap_node(pos, {name = newnode.name, param2 = param2})
|
||||||
minetest.get_meta(pos):set_int("palette_index", color)
|
minetest.get_meta(pos):set_int("palette_index", color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- The complementary function: strip-off the color if the node being dug is still white/neutral
|
||||||
|
|
||||||
|
local function move_item(item, pos, inv)
|
||||||
|
if not creative_mode or not inv:contains_item("main", item, true) then
|
||||||
|
inv:add_item("main", item)
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.on_dig(pos, node, digger)
|
||||||
|
|
||||||
|
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 def = minetest.registered_items[node.name]
|
||||||
|
local del_color
|
||||||
|
|
||||||
|
if def.paramtype2 == "color" and oldparam2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
del_color = true
|
||||||
|
elseif def.paramtype2 == "colorwallmounted" and math.floor(oldparam2 / 8) == 0 and def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
del_color = true
|
||||||
|
elseif def.paramtype2 == "colorfacedir" and math.floor(oldparam2 / 32) == 0 and string.find(def.palette, "unifieddyes_palette_") then
|
||||||
|
del_color = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local inv = digger:get_inventory()
|
||||||
|
|
||||||
|
if del_color then
|
||||||
|
if inv:room_for_item("main", node.name) then move_item(node.name, pos, inv) end
|
||||||
|
else
|
||||||
|
return minetest.node_dig(pos, node, digger)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- just stubs to keep old mods from crashing when expecting auto-coloring
|
-- just stubs to keep old mods from crashing when expecting auto-coloring
|
||||||
-- or getting back the dye on dig.
|
-- or getting back the dye on dig.
|
||||||
|
|
||||||
@ -282,7 +333,7 @@ end
|
|||||||
function unifieddyes.register_color_craft(craft)
|
function unifieddyes.register_color_craft(craft)
|
||||||
local hues_table = unifieddyes.HUES_EXTENDED
|
local hues_table = unifieddyes.HUES_EXTENDED
|
||||||
local sats_table = unifieddyes.SATS
|
local sats_table = unifieddyes.SATS
|
||||||
local vals_table = unifieddyes.VALS
|
local vals_table = unifieddyes.VALS_SPLIT
|
||||||
local greys_table = unifieddyes.GREYS
|
local greys_table = unifieddyes.GREYS
|
||||||
|
|
||||||
if craft.palette == "wallmounted" then
|
if craft.palette == "wallmounted" then
|
||||||
@ -436,7 +487,7 @@ function unifieddyes.getpaletteidx(color, palette_type)
|
|||||||
["grey_14"] = 1,
|
["grey_14"] = 1,
|
||||||
["grey_13"] = 2,
|
["grey_13"] = 2,
|
||||||
["grey_12"] = 3,
|
["grey_12"] = 3,
|
||||||
["light_grey"] = 3,
|
["light_grey"] = 4,
|
||||||
["grey_11"] = 4,
|
["grey_11"] = 4,
|
||||||
["grey_10"] = 5,
|
["grey_10"] = 5,
|
||||||
["grey_9"] = 6,
|
["grey_9"] = 6,
|
||||||
@ -617,6 +668,19 @@ function unifieddyes.getpaletteidx(color, palette_type)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function unifieddyes.get_color_from_dye_name(name)
|
||||||
|
if name == "dye:black" then
|
||||||
|
return "000000"
|
||||||
|
elseif name == "dye:white" then
|
||||||
|
return "ffffff"
|
||||||
|
end
|
||||||
|
local item = minetest.registered_items[name]
|
||||||
|
if not item then return end
|
||||||
|
local inv_image = item.inventory_image
|
||||||
|
if not inv_image then return end
|
||||||
|
return string.match(inv_image,"colorize:#(......):200")
|
||||||
|
end
|
||||||
|
|
||||||
-- punch-to-recolor using the airbrush
|
-- punch-to-recolor using the airbrush
|
||||||
|
|
||||||
function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
||||||
@ -627,8 +691,30 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
|||||||
painting_with = unifieddyes.player_current_dye[player_name]
|
painting_with = unifieddyes.player_current_dye[player_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not painting_with then
|
||||||
|
minetest.chat_send_player(player_name, "*** You need to set a color first.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,")
|
||||||
|
minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
if not pos then return end
|
if not pos then
|
||||||
|
local look_angle = player:get_look_vertical()
|
||||||
|
if look_angle > -1.55 then
|
||||||
|
minetest.chat_send_player(player_name, "*** No node selected")
|
||||||
|
else
|
||||||
|
local hexcolor = unifieddyes.get_color_from_dye_name(painting_with)
|
||||||
|
if hexcolor then
|
||||||
|
local r = tonumber(string.sub(hexcolor,1,2),16)
|
||||||
|
local g = tonumber(string.sub(hexcolor,3,4),16)
|
||||||
|
local b = tonumber(string.sub(hexcolor,5,6),16)
|
||||||
|
player:set_sky({r=r,g=g,b=b,a=255},"plain")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local def = minetest.registered_items[node.name]
|
local def = minetest.registered_items[node.name]
|
||||||
@ -639,14 +725,6 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not painting_with then
|
|
||||||
minetest.chat_send_player(player_name, "*** You need to set a color first.")
|
|
||||||
minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,")
|
|
||||||
minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.")
|
|
||||||
minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then
|
if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then
|
||||||
minetest.chat_send_player(player_name, "*** That node can't be colored.")
|
minetest.chat_send_player(player_name, "*** That node can't be colored.")
|
||||||
return
|
return
|
||||||
@ -654,12 +732,17 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
|||||||
|
|
||||||
local palette = nil
|
local palette = nil
|
||||||
local fdir = 0
|
local fdir = 0
|
||||||
if def.paramtype2 == "color" then
|
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.")
|
||||||
|
return
|
||||||
|
elseif def.palette == "unifieddyes_palette_extended.png" then
|
||||||
palette = "extended"
|
palette = "extended"
|
||||||
elseif def.paramtype2 == "colorwallmounted" then
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
palette = "wallmounted"
|
palette = "wallmounted"
|
||||||
fdir = node.param2 % 8
|
fdir = node.param2 % 8
|
||||||
elseif def.paramtype2 == "colorfacedir" then
|
elseif def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(def.palette, "unifieddyes_palette_") then
|
||||||
palette = "split"
|
palette = "split"
|
||||||
fdir = node.param2 % 32
|
fdir = node.param2 % 32
|
||||||
else
|
else
|
||||||
@ -804,10 +887,17 @@ end
|
|||||||
|
|
||||||
local hps = 0.6 -- horizontal position scale
|
local hps = 0.6 -- horizontal position scale
|
||||||
local vps = 1.3 -- vertical position scale
|
local vps = 1.3 -- vertical position scale
|
||||||
local vs = 0.3 -- vertical shift/offset
|
local vs = 0.1 -- vertical shift/offset
|
||||||
|
|
||||||
local color_button_size = ";0.75,0.75;"
|
local color_button_size = ";0.75,0.75;"
|
||||||
local color_square_size = ";0.69,0.69;"
|
local color_square_size = ";0.69,0.69;"
|
||||||
|
|
||||||
|
function unifieddyes.make_readable_color(color)
|
||||||
|
local s = string.gsub(color, "_", " ")
|
||||||
|
s = string.gsub(s, "s50", "(low saturation)")
|
||||||
|
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
|
local dye = "dye:"..colorname
|
||||||
@ -829,26 +919,29 @@ function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local tooltip = "tooltip["..colorname..";"..
|
||||||
|
unifieddyes.make_readable_color(colorname)..
|
||||||
|
"\n(dye:"..colorname..")]"
|
||||||
|
|
||||||
if dye == painting_with then
|
if dye == painting_with then
|
||||||
overlay = "^unifieddyes_select_overlay.png"
|
overlay = "^unifieddyes_select_overlay.png"
|
||||||
selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
|
selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..tooltip
|
||||||
"tooltip["..colorname..";"..colorname.."]"
|
|
||||||
end
|
end
|
||||||
local form
|
|
||||||
|
|
||||||
|
local form
|
||||||
if unavail_overlay == "" then
|
if unavail_overlay == "" then
|
||||||
form = "image_button["..
|
form = "image_button["..
|
||||||
(hp*hps)..","..(v2*vps+vs)..
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
color_button_size..
|
color_button_size..
|
||||||
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
|
||||||
colorname..";]"..
|
colorname..";]"..
|
||||||
"tooltip["..colorname..";"..colorname.."]"
|
tooltip
|
||||||
else
|
else
|
||||||
form = "image["..
|
form = "image["..
|
||||||
(hp*hps)..","..(v2*vps+vs)..
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
color_square_size..
|
color_square_size..
|
||||||
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
|
||||||
"tooltip["..colorname.." (unavailable);"..colorname.."]"
|
tooltip
|
||||||
end
|
end
|
||||||
|
|
||||||
return form, selindic
|
return form, selindic
|
||||||
@ -866,24 +959,29 @@ function unifieddyes.show_airbrush_form(player)
|
|||||||
local nodepalette = "extended"
|
local nodepalette = "extended"
|
||||||
local showall = unifieddyes.player_showall[player_name]
|
local showall = unifieddyes.player_showall[player_name]
|
||||||
|
|
||||||
t[1] = "size[15,8.5]label[7,-0.25;Select a color:]"
|
t[1] = "size[14.5,8.5]label[7,-0.3;Select a color:]"
|
||||||
local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]"
|
local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]"
|
||||||
|
|
||||||
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
||||||
if last_right_click then
|
if last_right_click then
|
||||||
if last_right_click.def and last_right_click.def.paramtype2 then
|
if last_right_click.def and last_right_click.def.palette then
|
||||||
if last_right_click.def.paramtype2 == "colorwallmounted" then
|
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
nodepalette = "wallmounted"
|
nodepalette = "wallmounted"
|
||||||
elseif last_right_click.def.paramtype2 == "color" then
|
elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then
|
||||||
t[#t+1] = "label[0.5,8.25;(Right-clicked a node that supports all 256 colors, showing them all)]"
|
t[#t+1] = "label[0.5,8.25;(Right-clicked a node that supports all 256 colors, showing them all)]"
|
||||||
showall = true
|
showall = true
|
||||||
elseif last_right_click.def.paramtype2 == "colorfacedir" then
|
elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and last_right_click.def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(last_right_click.def.palette, "unifieddyes_palette_") then
|
||||||
nodepalette = "split"
|
nodepalette = "split"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not last_right_click.def.groups or not last_right_click.def.groups.ud_param2_colorable then
|
if 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
|
||||||
t[#t+1] = "label[0.5,8.25;(Right-clicked a node not supported by the Airbrush, showing all colors)]"
|
t[#t+1] = "label[0.5,8.25;(Right-clicked a node not supported by the Airbrush, showing all colors)]"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -897,7 +995,7 @@ function unifieddyes.show_airbrush_form(player)
|
|||||||
|
|
||||||
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
local hue = h[1]
|
local hue = h[1]
|
||||||
local hp=hi-0.5
|
local hp=hi-1
|
||||||
|
|
||||||
local r = h[2]
|
local r = h[2]
|
||||||
local g = h[3]
|
local g = h[3]
|
||||||
@ -925,7 +1023,7 @@ function unifieddyes.show_airbrush_form(player)
|
|||||||
|
|
||||||
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
local hue = h[1]
|
local hue = h[1]
|
||||||
local hp=hi-0.5
|
local hp=hi-1
|
||||||
|
|
||||||
local r = h[2]
|
local r = h[2]
|
||||||
local g = h[3]
|
local g = h[3]
|
||||||
@ -957,7 +1055,7 @@ function unifieddyes.show_airbrush_form(player)
|
|||||||
local v2=5
|
local v2=5
|
||||||
for y = 0, 15 do
|
for y = 0, 15 do
|
||||||
|
|
||||||
local hp=(15-y)+0.5
|
local hp=15-y
|
||||||
|
|
||||||
local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
||||||
local grey = "grey_"..y
|
local grey = "grey_"..y
|
||||||
@ -976,48 +1074,52 @@ function unifieddyes.show_airbrush_form(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not creative then
|
if not creative then
|
||||||
t[#t+1] = "image[10.3,"
|
t[#t+1] = "image[10,"
|
||||||
t[#t+1] = (vps*5+vs)
|
t[#t+1] = (vps*5.55+vs)
|
||||||
t[#t+1] = color_button_size
|
t[#t+1] = color_button_size
|
||||||
t[#t+1] = "unifieddyes_onhand_overlay.png]label[11.0,"
|
t[#t+1] = "unifieddyes_onhand_overlay.png]label[10.7,"
|
||||||
t[#t+1] = (vps*5.02+vs)
|
t[#t+1] = (vps*5.51+vs)
|
||||||
t[#t+1] = ";Dyes]"
|
t[#t+1] = ";Dyes]"
|
||||||
t[#t+1] = "label[11.0,"
|
t[#t+1] = "label[10.7,"
|
||||||
t[#t+1] = (vps*5.18+vs)
|
t[#t+1] = (vps*5.67+vs)
|
||||||
t[#t+1] = ";on hand]"
|
t[#t+1] = ";on hand]"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t[#t+1] = "image[11.9,"
|
t[#t+1] = "image[10,"
|
||||||
t[#t+1] = (vps*5+vs)
|
t[#t+1] = (vps*5+vs)
|
||||||
t[#t+1] = color_button_size
|
t[#t+1] = color_button_size
|
||||||
t[#t+1] = selindic
|
t[#t+1] = selindic
|
||||||
|
|
||||||
if painting_with then
|
if painting_with then
|
||||||
t[#t+1] = "label[12.6,"
|
t[#t+1] = "label[10.7,"
|
||||||
t[#t+1] = (vps*5.02+vs)
|
t[#t+1] = (vps*4.90+vs)
|
||||||
t[#t+1] = ";Your selection:]"
|
t[#t+1] = ";Your selection:]"
|
||||||
t[#t+1] = "label[12.6,"
|
t[#t+1] = "label[10.7,"
|
||||||
t[#t+1] = (vps*5.18+vs)
|
t[#t+1] = (vps*5.07+vs)
|
||||||
t[#t+1] = ";"
|
t[#t+1] = ";"
|
||||||
|
t[#t+1] = unifieddyes.make_readable_color(string.sub(painting_with, 5))
|
||||||
|
t[#t+1] = "]label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.24+vs)
|
||||||
|
t[#t+1] = ";("
|
||||||
t[#t+1] = painting_with
|
t[#t+1] = painting_with
|
||||||
t[#t+1] = "]"
|
t[#t+1] = ")]"
|
||||||
else
|
else
|
||||||
t[#t+1] = "label[12.6,"
|
t[#t+1] = "label[10.7,"
|
||||||
t[#t+1] = (vps*5.1+vs)
|
t[#t+1] = (vps*5.07+vs)
|
||||||
t[#t+1] = ";Your selection]"
|
t[#t+1] = ";Your selection]"
|
||||||
end
|
end
|
||||||
|
|
||||||
t[#t+1] = "button_exit[11,8;2,1;cancel;Cancel]button_exit[13,8;2,1;accept;Accept]"
|
t[#t+1] = "button_exit[10.5,8;2,1;cancel;Cancel]button_exit[12.5,8;2,1;accept;Accept]"
|
||||||
|
|
||||||
|
|
||||||
if last_right_click and last_right_click.def and nodepalette ~= "extended" then
|
if last_right_click and last_right_click.def and nodepalette ~= "extended" then
|
||||||
if showall then
|
if showall then
|
||||||
t[#t+1] = "button[0.5,8;2,1;show_avail;Show Available]"
|
t[#t+1] = "button[0,8;2,1;show_avail;Show Available]"
|
||||||
t[#t+1] = "label[2.5,8.25;(Currently showing all 256 colors)]"
|
t[#t+1] = "label[2,8.25;(Currently showing all 256 colors)]"
|
||||||
else
|
else
|
||||||
t[#t+1] = "button[0.5,8;2,1;show_all;Show All Colors]"
|
t[#t+1] = "button[0,8;2,1;show_all;Show All Colors]"
|
||||||
t[#t+1] = "label[2.5,8.25;(Currently only showing what the right-clicked node can use)]"
|
t[#t+1] = "label[2,8.25;(Currently only showing what the right-clicked node can use)]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1065,7 +1167,7 @@ minetest.register_tool("unifieddyes:airbrush", {
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "unifieddyes:airbrush",
|
output = "unifieddyes:airbrush",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "default:gold_ingot", "", "bucket:bucket_empty" },
|
{ "basic_materials:brass_ingot", "", "basic_materials:plastic_sheet" },
|
||||||
{ "", "default:steel_ingot", "" },
|
{ "", "default:steel_ingot", "" },
|
||||||
{ "", "", "default:steel_ingot" }
|
{ "", "", "default:steel_ingot" }
|
||||||
},
|
},
|
||||||
@ -1369,7 +1471,7 @@ for _,i in ipairs(unifieddyes.base_color_crafts) do
|
|||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "dye:"..j[1]..color..j[2].." "..yield,
|
output = "dye:"..j[1]..color..j[2].." "..j[6],
|
||||||
recipe = {
|
recipe = {
|
||||||
"dye:"..color,
|
"dye:"..color,
|
||||||
firstdye,
|
firstdye,
|
||||||
|
74
locale/ru.txt
Normal file
74
locale/ru.txt
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# Translation by @drakes_journey
|
||||||
|
|
||||||
|
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 = Темная красная краска
|
||||||
|
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 = Средне-красная краска
|
||||||
|
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) = Краснофиолетовая краска (низкая насыщенность)
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded! = [UnifiedDyes] загружен!
|
Reference in New Issue
Block a user