From 2b5664c0004b2f4ed8c712b8b6f75d9d3294c829 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 26 Feb 2017 11:11:19 -0500 Subject: updated lots of mods: blox, bobblocks, homedecor, coloredwood, gloopblocks, moreblocks, plasticbox, replacer, solidcolor, stained_glass, technic, unifiedbricks, and unifieddyes (in most of these, it's to upgrade to the Unified Dyes "extended" palette) --- blox/init.lua | 71 +- bobblocks/blocks.lua | 48 +- building_blocks/init.lua | 11 + coloredwood/init.lua | 128 +++- computer/computers.lua | 13 + computer/textures/computer_hueg_box_bk.png | Bin 0 -> 88 bytes computer/textures/computer_hueg_box_bt.png | Bin 0 -> 108 bytes computer/textures/computer_hueg_box_ft.png | Bin 0 -> 130 bytes computer/textures/computer_hueg_box_lt.png | Bin 0 -> 100 bytes computer/textures/computer_hueg_box_rt.png | Bin 0 -> 97 bytes computer/textures/computer_hueg_box_tp.png | Bin 0 -> 220 bytes gloopblocks/crafts.lua | 5 + gloopblocks/depends.txt | 1 + homedecor/bathroom_furniture.lua | 30 +- homedecor/doors_and_gates.lua | 27 +- homedecor/gastronomy.lua | 3 +- homedecor/lighting.lua | 37 +- homedecor/textures/homedecor_gate_half_door_fb.png | Bin 0 -> 2085 bytes homedecor/textures/homedecor_gate_half_door_lr.png | Bin 0 -> 684 bytes homedecor/textures/homedecor_gate_half_door_tb.png | Bin 0 -> 421 bytes .../textures/homedecor_gate_half_door_white_fb.png | Bin 0 -> 1080 bytes .../textures/homedecor_gate_half_door_white_lr.png | Bin 0 -> 384 bytes .../textures/homedecor_gate_half_door_white_tb.png | Bin 0 -> 310 bytes lavalamp/init.lua | 25 +- lrfurn/coffeetable.lua | 26 - moreblocks/CHANGELOG.md | 12 +- moreblocks/depends.txt | 1 + moreblocks/stairsplus/init.lua | 2 + moreblocks/stairsplus/microblocks.lua | 4 + moreblocks/stairsplus/panels.lua | 4 + moreblocks/stairsplus/registrations.lua | 17 +- moreblocks/stairsplus/slabs.lua | 4 + moreblocks/stairsplus/slopes.lua | 4 + moreblocks/stairsplus/stairs.lua | 4 + plasticbox/init.lua | 21 +- replacer/init.lua | 12 +- solidcolor/init.lua | 21 +- stained_glass/init.lua | 203 ++---- technic/config.lua | 3 + technic/radiation.lua | 109 ++- unifiedbricks/init.lua | 47 +- unifieddyes/init.lua | 756 ++++++++++++--------- unifieddyes/textures/unifieddyes_dye.png | Bin 0 -> 150 bytes .../textures/unifieddyes_palette_extended.png | Bin 0 -> 290 bytes 44 files changed, 1023 insertions(+), 626 deletions(-) create mode 100644 computer/textures/computer_hueg_box_bk.png create mode 100644 computer/textures/computer_hueg_box_bt.png create mode 100644 computer/textures/computer_hueg_box_ft.png create mode 100644 computer/textures/computer_hueg_box_lt.png create mode 100644 computer/textures/computer_hueg_box_rt.png create mode 100644 computer/textures/computer_hueg_box_tp.png create mode 100644 homedecor/textures/homedecor_gate_half_door_fb.png create mode 100644 homedecor/textures/homedecor_gate_half_door_lr.png create mode 100644 homedecor/textures/homedecor_gate_half_door_tb.png create mode 100644 homedecor/textures/homedecor_gate_half_door_white_fb.png create mode 100644 homedecor/textures/homedecor_gate_half_door_white_lr.png create mode 100644 homedecor/textures/homedecor_gate_half_door_white_tb.png create mode 100644 unifieddyes/textures/unifieddyes_dye.png create mode 100644 unifieddyes/textures/unifieddyes_palette_extended.png diff --git a/blox/init.lua b/blox/init.lua index 763bbb3..919a714 100644 --- a/blox/init.lua +++ b/blox/init.lua @@ -97,6 +97,8 @@ minetest.register_node("blox:glowdust", { -- param2-colored nodes: standard patterns +blox.old_89_color_nodes = {} + for _, nodeclass in ipairs(NodeClass) do minetest.register_node("blox:stone_"..nodeclass, { @@ -107,7 +109,8 @@ for _, nodeclass in ipairs(NodeClass) do "blox_stone_"..nodeclass..".png" }, mesh = "blox_block_with_overlay.obj", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -124,7 +127,8 @@ for _, nodeclass in ipairs(NodeClass) do "blox_cobble_"..nodeclass..".png" }, mesh = "blox_block_with_overlay.obj", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -141,7 +145,8 @@ for _, nodeclass in ipairs(NodeClass) do "blox_wood_"..nodeclass..".png" }, mesh = "blox_block_with_overlay.obj", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -149,6 +154,10 @@ for _, nodeclass in ipairs(NodeClass) do sounds = default.node_sound_wood_defaults(), after_dig_node = unifieddyes.after_dig_node }) + + table.insert(blox.old_89_color_nodes, "blox:stone_"..nodeclass) + table.insert(blox.old_89_color_nodes, "blox:cobble_"..nodeclass) + table.insert(blox.old_89_color_nodes, "blox:wood_"..nodeclass) end -- param2-colored nodes: tinted wood, cobble, stone, stone square @@ -156,7 +165,8 @@ end minetest.register_node("blox:wood_tinted", { description = "Blox tinted wood", tiles = { "blox_wood_tinted.png" }, - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -168,7 +178,8 @@ minetest.register_node("blox:wood_tinted", { minetest.register_node("blox:stone_square", { description = "Blox stone square", tiles = { "blox_stone_square.png" }, - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -180,7 +191,8 @@ minetest.register_node("blox:stone_square", { minetest.register_node("blox:cobble_tinted", { description = "Blox tinted cobble", tiles = { "blox_cobble_tinted.png" }, - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -193,7 +205,8 @@ minetest.register_node("blox:cobble_tinted", { minetest.register_node("blox:stone_tinted", { description = "Blox tinted stone", tiles = { "blox_stone_tinted.png" }, - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, paramtype = "light", paramtype2 = "color", is_ground_content = true, @@ -203,18 +216,21 @@ minetest.register_node("blox:stone_tinted", { drop = "default:cobble" }) +table.insert(blox.old_89_color_nodes, "blox:wood_tinted") +table.insert(blox.old_89_color_nodes, "blox:stone_square") +table.insert(blox.old_89_color_nodes, "blox:cobble_tinted") +table.insert(blox.old_89_color_nodes, "blox:stone_tinted") + -- Override default stone and default cobble minetest.override_item("default:stone", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:stone_tinted", groups = {cracky = 3, stone = 1, ud_param2_colorable = 1}, }) minetest.override_item("default:cobble", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:cobble_tinted", groups = {cracky = 3, stone = 2, ud_param2_colorable = 1}, }) @@ -223,8 +239,7 @@ local dye_color = "unifieddyes:white" if moreblocks then minetest.override_item("moreblocks:stone_tile", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:stone_square", groups = {cracky = 3, ud_param2_colorable = 1}, }) @@ -234,8 +249,7 @@ if moreblocks then }) minetest.override_item("moreblocks:circle_stone_bricks", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:stone_loop", groups = {cracky = 3, ud_param2_colorable = 1}, }) @@ -245,8 +259,7 @@ if moreblocks then }) minetest.override_item("moreblocks:iron_checker", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:stone_checker", groups = {cracky = 3, ud_param2_colorable = 1}, }) @@ -256,8 +269,7 @@ if moreblocks then }) minetest.override_item("moreblocks:wood_tile", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:wood_quarter", groups = {wood = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, ud_param2_colorable = 1}, }) @@ -267,8 +279,7 @@ if moreblocks then }) minetest.override_item("moreblocks:wood_tile_flipped", { - paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", ud_replacement_node = "blox:wood_quarter", groups = {wood = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, ud_param2_colorable = 1}, }) @@ -294,7 +305,6 @@ if minetest.get_modpath("coloredwood") then }) else minetest.override_item("default:wood", { - paramtype2 = "color", ud_replacement_node = "blox:wood_tinted", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, ud_param2_colorable = 1}, }) @@ -551,10 +561,25 @@ minetest.register_lbm({ color = "dark_grey" end - local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color) + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") minetest.set_node(pos, { name = "blox:"..material.."_"..pattern, param2 = paletteidx }) local meta = minetest.get_meta(pos) meta:set_string("dye", "unifieddyes:"..color) + meta:set_string("palette", "ext") + end +}) + +minetest.register_lbm({ + name = "blox:recolor_stuff", + label = "Convert 89-color blocks to use UD extended palette", + run_at_every_load = false, + nodenames = blox.old_89_color_nodes, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end end }) diff --git a/bobblocks/blocks.lua b/bobblocks/blocks.lua index f0a516e..e5c9af0 100644 --- a/bobblocks/blocks.lua +++ b/bobblocks/blocks.lua @@ -39,7 +39,8 @@ minetest.register_node("bobblocks:block", { tiles = {"bobblocks_block.png"}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -59,7 +60,8 @@ minetest.register_node("bobblocks:block_off", { drawtype = "glasslike", tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity}, paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = false, use_texture_alpha = true, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1}, @@ -81,7 +83,8 @@ minetest.register_node("bobblocks:pole", { inventory_image = ("bobblocks_pole_inv.png"), paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -102,7 +105,8 @@ minetest.register_node("bobblocks:pole_off", { tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, use_texture_alpha = true, @@ -137,7 +141,8 @@ minetest.register_node("bobblocks:wavyblock", { tiles = {"bobblocks_wavyblock.png"}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -158,7 +163,8 @@ minetest.register_node("bobblocks:wavyblock_off", { drawtype = "glasslike", tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity}, paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = false, use_texture_alpha = true, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1}, @@ -180,7 +186,8 @@ minetest.register_node("bobblocks:wavypole", { inventory_image = ("bobblocks_wavypole_inv.png"), paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -276,11 +283,11 @@ minetest.register_lbm({ newcolor = "light_grey" end - local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..newcolor, false) + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..newcolor, "extended") local newnode = "bobblocks:block" if string.find(basename, "grey") then - paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:grey", false) + paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:grey", "extended") if string.find(basename, "pole") then newnode = "bobblocks:wavypole" else @@ -295,5 +302,28 @@ minetest.register_lbm({ local meta = minetest.get_meta(pos) minetest.set_node(pos, { name = newnode, param2 = paletteidx }) meta:set_string("dye", "unifieddyes:"..newcolor) + meta:set_string("palette", "ext") + end +}) + +minetest.register_lbm({ + name = "bobblocks:recolor_stuff", + label = "Convert 89-color fences to use UD extended palette", + run_at_every_load = false, + nodenames = { + "bobblocks:block", + "bobblocks:block_off", + "bobblocks:pole", + "bobblocks:pole_off", + "bobblocks:wavyblock", + "bobblocks:wavyblock_off", + "bobblocks:wavypole" + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end end }) diff --git a/building_blocks/init.lua b/building_blocks/init.lua index a4d1ed7..c8c6f64 100644 --- a/building_blocks/init.lua +++ b/building_blocks/init.lua @@ -332,6 +332,16 @@ if minetest.get_modpath("moreblocks") then }), } ) + + for _, i in ipairs(stairsplus.shapes_list) do + local class = i[1] + local cut = i[2] + minetest.unregister_item("moreblocks:"..class.."tar"..cut) + minetest.register_alias("moreblocks:"..class.."tar"..cut, "building_blocks:"..class.."tar"..cut) + + end + minetest.unregister_item("moreblocks:tar") + stairsplus:register_all( "building_blocks", "tar", @@ -343,6 +353,7 @@ if minetest.get_modpath("moreblocks") then sounds = default.node_sound_stone_defaults(), } ) + stairsplus:register_all( "building_blocks", "grate", diff --git a/coloredwood/init.lua b/coloredwood/init.lua index b6f1e28..914fa25 100644 --- a/coloredwood/init.lua +++ b/coloredwood/init.lua @@ -147,21 +147,22 @@ end -- the actual nodes! +minetest.register_node("coloredwood:wood_block", { + description = "Colored wooden planks", + tiles = { "coloredwood_base.png" }, + paramtype = "light", + paramtype2 = "color", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, + walkable = true, + sunlight_propagates = false, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1, ud_param2_colorable = 1}, + sounds = default.node_sound_wood_defaults(), + after_dig_node = unifieddyes.after_dig_node, + drop = "default:wood" +}) + for _, color in ipairs(coloredwood.hues_plus_greys) do - minetest.register_node("coloredwood:wood_"..color, { - description = "Colored wooden planks", - tiles = { "coloredwood_base.png" }, - paramtype = "light", - paramtype2 = "colorfacedir", - palette = "unifieddyes_palette_"..color.."s.png", - walkable = true, - sunlight_propagates = false, - ud_replacement_node = "coloredwood:wood_"..color, - groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1, ud_param2_colorable = 1}, - sounds = default.node_sound_wood_defaults(), - after_dig_node = unifieddyes.after_dig_node, - drop = "default:wood" - }) -- moreblocks/stairsplus support @@ -226,8 +227,10 @@ end end minetest.override_item("default:wood", { - paramtype2 = "colorfacedir", - ud_replacement_node = "coloredwood:wood_grey", + paramtype2 = "color", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, + ud_replacement_node = "coloredwood:wood_block", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, ud_param2_colorable = 1}, }) @@ -237,7 +240,8 @@ minetest.register_node("coloredwood:fence", { tiles = { "coloredwood_fence_base.png" }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, walkable = true, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), @@ -250,6 +254,8 @@ minetest.register_node("coloredwood:fence", { }) minetest.override_item("default:fence_wood", { + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, ud_replacement_node = "coloredwood:fence", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, ud_param2_colorable = 1} }) @@ -258,8 +264,10 @@ minetest.override_item("default:fence_wood", { -- convert the old static nodes coloredwood.old_static_nodes = {} +coloredwood.old_13_color_nodes = {} for _, hue in ipairs(coloredwood.hues) do + table.insert(coloredwood.old_13_color_nodes, "coloredwood:wood_"..hue) for _, sat in ipairs({"", "_s50"}) do for _, val in ipairs ({"dark_", "medium_", "light_", ""}) do table.insert(coloredwood.old_static_nodes, "coloredwood:wood_"..val..hue..sat) @@ -273,6 +281,9 @@ for _, shade in ipairs(coloredwood.greys) do table.insert(coloredwood.old_static_nodes, "coloredwood:fence_"..shade) end +table.insert(coloredwood.old_13_color_nodes, "coloredwood:wood_grey") + + -- add all of the stairsplus nodes, if moreblocks is installed. if coloredwood.enable_stairsplus then for _, shape in ipairs(circular_saw.names) do @@ -298,6 +309,28 @@ if coloredwood.enable_stairsplus then end end +local old_shades = { + "", + "", + "", + "light_", + "medium_", + "medium_", + "dark_", + "dark_" +} + +local old_greys = { + "white", + "white", + "light_grey", + "grey", + "dark_grey", + "black", + "white", + "white" +} + minetest.register_lbm({ name = "coloredwood:convert", label = "Convert wood blocks, fences, stairsplus stuff, etc to use param2 color", @@ -306,15 +339,13 @@ minetest.register_lbm({ action = function(pos, node) local meta = minetest.get_meta(pos) - if meta and (meta:get_string("dye") ~= "") then return end -- node has already been converted before. - local name = node.name local hue, sat, val = unifieddyes.get_hsv(name) - local color = val..hue..sat - local s1, s2 = is_stairsplus(name) + if meta and (meta:get_string("dye") ~= "") then return end -- node has already been converted before. + if s1 then if not s2 then print("impossible conversion request! name = "..node.name.." --> ".."coloredwood:"..s1.."_wood_"..hue.."*nil*") return end @@ -328,18 +359,59 @@ minetest.register_lbm({ meta:set_string("dye", "unifieddyes:"..color) elseif string.find(name, ":fence") then - local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color, false) + local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") minetest.set_node(pos, { name = "coloredwood:fence", param2 = paletteidx }) meta:set_string("dye", "unifieddyes:"..color) + meta:set_string("palette", "ext") else - local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color, true) - if hue ~= 0 and hue ~= nil then - minetest.set_node(pos, { name = "coloredwood:wood_"..coloredwood.hues[hue], param2 = paletteidx }) - meta:set_string("dye", "unifieddyes:"..color) + if hue == "aqua" then + hue = "spring" + elseif hue == "skyblue" then + hue = "azure" + elseif hue == "redviolet" then + hue = "rose" + end + + color = val..hue..sat + + local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") + minetest.set_node(pos, { name = "coloredwood:wood_block", param2 = paletteidx }) + meta:set_string("dye", "unifieddyes:"..color) + meta:set_string("palette", "ext") + end + end +}) + +table.insert(coloredwood.old_13_color_nodes, "coloredwood:fence") + +minetest.register_lbm({ + name = "coloredwood:recolor_basics", + label = "Convert fences and base 13-color wood to use UD extended palette", + run_at_every_load = false, + nodenames = coloredwood.old_13_color_nodes, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + if node.name == "coloredwood:fence" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) else - minetest.set_node(pos, { name = "coloredwood:wood_grey", param2 = paletteidx }) - meta:set_string("dye", "unifieddyes:"..color) + local hue = string.sub(node.name, 18) + local shadenum = math.floor(node.param2/32) + 1 + local shade = old_shades[shadenum] + local sat = "" + + if hue == "grey" then + hue = old_greys[shadenum] + shade = "" + sat = "" + elseif shadenum == 3 or shadenum == 6 or shadenum == 8 then + sat = "_s50" + end + + local newcolor = unifieddyes.convert_classic_palette[unifieddyes.getpaletteidx("unifieddyes:"..shade..hue..sat)] + minetest.swap_node(pos, { name = "coloredwood:wood_block", param2 = newcolor }) end + meta:set_string("palette", "ext") end end }) diff --git a/computer/computers.lua b/computer/computers.lua index 5a7fed4..b9d3dc4 100644 --- a/computer/computers.lua +++ b/computer/computers.lua @@ -153,6 +153,19 @@ computer.register("computer:admiral128", { }) }) +-- XBox lookalike +computer.register("computer:hueg_box", { + description = "HUEG Box", + tiles_off = { }, + node_box = computer.pixelnodebox(16, { + -- X Y Z W H L + { 0, 0, 7, 16, 6, 9 }, -- Console + { 2, 0, 1, 11, 3, 6 }, -- Controller + { 2, 0, 0, 2, 3, 1 }, + { 11, 0, 0, 2, 3, 1 }, + }) +}) + -- Generic Flat Screen LCD (16x9) with keyboard local mo_sbox = { type = "fixed", diff --git a/computer/textures/computer_hueg_box_bk.png b/computer/textures/computer_hueg_box_bk.png new file mode 100644 index 0000000..d0dbb84 Binary files /dev/null and b/computer/textures/computer_hueg_box_bk.png differ diff --git a/computer/textures/computer_hueg_box_bt.png b/computer/textures/computer_hueg_box_bt.png new file mode 100644 index 0000000..631736a Binary files /dev/null and b/computer/textures/computer_hueg_box_bt.png differ diff --git a/computer/textures/computer_hueg_box_ft.png b/computer/textures/computer_hueg_box_ft.png new file mode 100644 index 0000000..dbd8681 Binary files /dev/null and b/computer/textures/computer_hueg_box_ft.png differ diff --git a/computer/textures/computer_hueg_box_lt.png b/computer/textures/computer_hueg_box_lt.png new file mode 100644 index 0000000..bf20692 Binary files /dev/null and b/computer/textures/computer_hueg_box_lt.png differ diff --git a/computer/textures/computer_hueg_box_rt.png b/computer/textures/computer_hueg_box_rt.png new file mode 100644 index 0000000..19f06ce Binary files /dev/null and b/computer/textures/computer_hueg_box_rt.png differ diff --git a/computer/textures/computer_hueg_box_tp.png b/computer/textures/computer_hueg_box_tp.png new file mode 100644 index 0000000..543d262 Binary files /dev/null and b/computer/textures/computer_hueg_box_tp.png differ diff --git a/gloopblocks/crafts.lua b/gloopblocks/crafts.lua index 8edb58f..d404621 100644 --- a/gloopblocks/crafts.lua +++ b/gloopblocks/crafts.lua @@ -372,3 +372,8 @@ minetest.register_craft({ {"xpanes:bar", "xpanes:bar", "xpanes:bar"}, }, }) + +if minetest.get_modpath("technic") then + technic.register_grinder_recipe({input={"gloopblocks:pumice"},output="default:sand"}) + technic.register_grinder_recipe({input={"gloopblocks:basalt"},output="default:cobble"}) +end diff --git a/gloopblocks/depends.txt b/gloopblocks/depends.txt index 23fe580..8b07d49 100644 --- a/gloopblocks/depends.txt +++ b/gloopblocks/depends.txt @@ -8,3 +8,4 @@ intllib? wool? xdecor? caverealms? +technic? diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 0e839fd..d7cd0c6 100644 --- a/homedecor/bathroom_furniture.lua +++ b/homedecor/bathroom_furniture.lua @@ -11,7 +11,8 @@ minetest.register_node("homedecor:bathroom_tiles_dark", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -27,7 +28,8 @@ minetest.register_node("homedecor:bathroom_tiles_medium", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -43,7 +45,8 @@ minetest.register_node("homedecor:bathroom_tiles_light", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -156,10 +159,29 @@ minetest.register_lbm({ color = color.."_s50" end - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) + local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") minetest.set_node(pos, { name = newname, param2 = paletteidx }) local meta = minetest.get_meta(pos) meta:set_string("dye", "unifieddyes:"..color) + meta:set_string("palette", "ext") + end +}) + +minetest.register_lbm({ + name = "homedecor:recolor_bathroom_tiles", + label = "Convert bathroom tiles to use UD extended palette", + run_at_every_load = false, + nodenames = { + "homedecor:bathroom_tiles_light", + "homedecor:bathroom_tiles_medium", + "homedecor:bathroom_tiles_dark", + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end end }) diff --git a/homedecor/doors_and_gates.lua b/homedecor/doors_and_gates.lua index 81d8583..f29ea24 100644 --- a/homedecor/doors_and_gates.lua +++ b/homedecor/doors_and_gates.lua @@ -293,10 +293,12 @@ end -- Gates local gate_list = { - { "picket", S("Unpainted Picket Fence Gate") }, - { "picket_white", S("White Picket Fence Gate") }, - { "barbed_wire", S("Barbed Wire Fence Gate") }, - { "chainlink", S("Chainlink Fence Gate") }, + { "picket", S("Unpainted Picket Fence Gate") }, + { "picket_white", S("White Picket Fence Gate") }, + { "barbed_wire", S("Barbed Wire Fence Gate") }, + { "chainlink", S("Chainlink Fence Gate") }, + { "half_door", S("\"Half\" Door") }, + { "half_door_white", S("\"Half\" Door (white)") } } local gate_models_closed = { @@ -315,7 +317,12 @@ local gate_models_closed = { { -8/16, 7/16, 13/32, 8/16, 8/16, 15/32 }, -- top piece { -8/16, -8/16, 13/32, 8/16, -7/16, 15/32 }, -- bottom piece { -8/16, -8/16, 7/16, 8/16, 8/16, 7/16 }, -- the chainlink itself - { -8/16, -3/16, 6/16, -6/16, 3/16, 8/16 }} -- the lump representing the lock + { -8/16, -3/16, 6/16, -6/16, 3/16, 8/16 }}, -- the lump representing the lock + + {{ -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 }}, -- the whole door :P + + {{ -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 }}, -- the whole door :P + } local gate_models_open = { @@ -334,7 +341,11 @@ local gate_models_open = { { 13/32, 7/16, -8/16, 15/32, 8/16, 8/16 }, -- top piece { 13/32, -8/16, -8/16, 15/32, -7/16, 8/16 }, -- bottom piece { 7/16, -8/16, -8/16, 7/16, 8/16, 8/16 }, -- the chainlink itself - { 6/16, -3/16, -8/16, 8/16, 3/16, -6/16 }} -- the lump representing the lock + { 6/16, -3/16, -8/16, 8/16, 3/16, -6/16 }}, -- the lump representing the lock + + {{ 6/16, -8/16, -8/16, 8/16, 8/16, 8/16 }}, -- the whole door :P + + {{ 6/16, -8/16, -8/16, 8/16, 8/16, 8/16 }}, -- the whole door :P } for i, g in ipairs(gate_list) do @@ -409,8 +420,8 @@ for i, g in ipairs(gate_list) do def.selection_box.fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 } def.node_box.fixed = gate_models_open[i] def.tiles = { - tiles[1], - tiles[2], + tiles[1].."^[transformR90", + tiles[2].."^[transformR270", tiles[6], tiles[5], tiles[4], diff --git a/homedecor/gastronomy.lua b/homedecor/gastronomy.lua index 911d151..51f6526 100644 --- a/homedecor/gastronomy.lua +++ b/homedecor/gastronomy.lua @@ -191,8 +191,7 @@ homedecor.register("beer_mug", { z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] } minetest.add_item(pos_fwd, "vessels:drinking_glass 1") end - minetest.item_eat(2) - itemstack:take_item() + minetest.do_item_eat(2, nil, itemstack, user, pointed_thing) return itemstack end end diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index 369c5bd..4199558 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -414,7 +414,8 @@ local function reg_lamp(suffix, nxt, light, brightness) inventory_image = "homedecor_table_lamp_foot_inv.png^homedecor_table_lamp_top_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, walkable = false, light_source = light, selection_box = tlamp_cbox, @@ -442,7 +443,8 @@ local function reg_lamp(suffix, nxt, light, brightness) inventory_image = "homedecor_standing_lamp_foot_inv.png^homedecor_standing_lamp_top_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, walkable = false, light_source = light, groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, @@ -610,7 +612,7 @@ minetest.register_lbm({ color = "white" end - local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") local old_fdir local new_node = newname @@ -640,6 +642,10 @@ minetest.register_lbm({ param2 = paletteidx end + if string.find(name, "table_lamp") or string.find(name, "standing_lamp") then + meta:set_string("palette", "ext") + end + minetest.set_node(pos, { name = new_node, param2 = param2 }) local meta = minetest.get_meta(pos) meta:set_string("dye", "unifieddyes:"..color) @@ -691,3 +697,28 @@ minetest.register_lbm({ meta:set_string("dye", "unifieddyes:"..color) end }) + +minetest.register_lbm({ + name = "homedecor:recolor_lighting", + label = "Convert some kinds of lights to use UD extended palette", + run_at_every_load = false, + nodenames = { + "homedecor:table_lamp_off", + "homedecor:table_lamp_low", + "homedecor:table_lamp_med", + "homedecor:table_lamp_hi", + "homedecor:table_lamp_max", + "homedecor:standing_lamp_off", + "homedecor:standing_lamp_low", + "homedecor:standing_lamp_med", + "homedecor:standing_lamp_hi", + "homedecor:standing_lamp_max", + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end + end +}) diff --git a/homedecor/textures/homedecor_gate_half_door_fb.png b/homedecor/textures/homedecor_gate_half_door_fb.png new file mode 100644 index 0000000..c9be70a Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_fb.png differ diff --git a/homedecor/textures/homedecor_gate_half_door_lr.png b/homedecor/textures/homedecor_gate_half_door_lr.png new file mode 100644 index 0000000..48329d8 Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_lr.png differ diff --git a/homedecor/textures/homedecor_gate_half_door_tb.png b/homedecor/textures/homedecor_gate_half_door_tb.png new file mode 100644 index 0000000..03b360f Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_tb.png differ diff --git a/homedecor/textures/homedecor_gate_half_door_white_fb.png b/homedecor/textures/homedecor_gate_half_door_white_fb.png new file mode 100644 index 0000000..ca5c5d1 Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_white_fb.png differ diff --git a/homedecor/textures/homedecor_gate_half_door_white_lr.png b/homedecor/textures/homedecor_gate_half_door_white_lr.png new file mode 100644 index 0000000..038d20d Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_white_lr.png differ diff --git a/homedecor/textures/homedecor_gate_half_door_white_tb.png b/homedecor/textures/homedecor_gate_half_door_white_tb.png new file mode 100644 index 0000000..2d592e7 Binary files /dev/null and b/homedecor/textures/homedecor_gate_half_door_white_tb.png differ diff --git a/lavalamp/init.lua b/lavalamp/init.lua index bac1616..5a90074 100644 --- a/lavalamp/init.lua +++ b/lavalamp/init.lua @@ -22,7 +22,8 @@ minetest.register_node("lavalamp:lavalamp", { inventory_image = "lavalamp_lamp_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, walkable = false, light_source = 14, @@ -50,7 +51,8 @@ minetest.register_node("lavalamp:lavalamp_off", { }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, walkable = false, selection_box = { @@ -117,7 +119,7 @@ minetest.register_lbm({ color = "violet" end - local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") minetest.set_node(pos, { name = "lavalamp:lavalamp", param2 = paletteidx }) local meta = minetest.get_meta(pos) @@ -125,3 +127,20 @@ minetest.register_lbm({ end }) + +minetest.register_lbm({ + name = "lavalamp:recolor", + label = "Convert 89-color lamps to use UD extended palette", + run_at_every_load = false, + nodenames = { + "lavalamp:lavalamp", + "lavalamp:lavalamp_off" + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end + end +}) diff --git a/lrfurn/coffeetable.lua b/lrfurn/coffeetable.lua index 399d940..d2a920a 100644 --- a/lrfurn/coffeetable.lua +++ b/lrfurn/coffeetable.lua @@ -1,32 +1,6 @@ local S = homedecor_i18n.gettext ---[[ - local node = minetest.get_node(pos) - local yaw = placer:get_look_yaw() - local dir = minetest.yaw_to_dir(yaw-1.5) - local fdir = minetest.dir_to_facedir(dir) - - print(placer:get_look_yaw(), yaw) - print(node.param2, fdir) - - if lrfurn.check_right(pos, fdir, false, placer) then - local pos2 = find_coffee_table_second_node(pos, fdir) -]]-- - -local function find_second_node(pos, param2) - if param2 == 0 then - pos.z = pos.z+1 - elseif param2 == 1 then - pos.x = pos.x+1 - elseif param2 == 2 then - pos.z = pos.z-1 - elseif param2 == 3 then - pos.x = pos.x-1 - end - return pos -end - minetest.register_alias("lrfurn:coffeetable_back", "lrfurn:coffeetable") minetest.register_alias("lrfurn:coffeetable_front", "air") diff --git a/moreblocks/CHANGELOG.md b/moreblocks/CHANGELOG.md index e3c422f..23564f8 100644 --- a/moreblocks/CHANGELOG.md +++ b/moreblocks/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Added + +- 3 new node shapes in the circular saw (thin slabs, available in + "L-shaped", "corner-shaped" and "U-shaped" variations), all with 1/16 + thickness. +- Stone Block, Desert Stone Block, Obsidian Block, Sandstone Block, Coral + Skeleton and Straw are now present as Stairs+ nodes. + ## [1.0.0] - 2017-02-19 -- Initial versioned release. \ No newline at end of file +- Initial versioned release. diff --git a/moreblocks/depends.txt b/moreblocks/depends.txt index 198fe8a..8f1c124 100644 --- a/moreblocks/depends.txt +++ b/moreblocks/depends.txt @@ -1,2 +1,3 @@ default intllib? +farming? diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 87a356f..598f21c 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -12,6 +12,8 @@ local modpath = minetest.get_modpath("moreblocks").. "/stairsplus" stairsplus = {} stairsplus.expect_infinite_stacks = false +stairsplus.shapes_list = {} + if not minetest.get_modpath("unified_inventory") and minetest.setting_getbool("creative_mode") then stairsplus.expect_infinite_stacks = true diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index 727278e..50d8487 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -65,6 +65,10 @@ local microblocks_defs = { } } +for k,v in pairs(microblocks_defs) do + table.insert(stairsplus.shapes_list, { "micro_", k }) +end + function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new) local defs = stairsplus.copytable(microblocks_defs) for alternate, def in pairs(defs) do diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index fb18f05..98e77fd 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -65,6 +65,10 @@ local panels_defs = { } } +for k,v in pairs(panels_defs) do + table.insert(stairsplus.shapes_list, { "panel_", k }) +end + function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new) local defs = stairsplus.copytable(panels_defs) for alternate, def in pairs(defs) do diff --git a/moreblocks/stairsplus/registrations.lua b/moreblocks/stairsplus/registrations.lua index ccadedc..be08b43 100644 --- a/moreblocks/stairsplus/registrations.lua +++ b/moreblocks/stairsplus/registrations.lua @@ -7,6 +7,7 @@ Licensed under the zlib license. See LICENSE.md for more information. local default_nodes = { -- Default stairs/slabs/panels/microblocks: "stone", + "stone_block", "cobble", "mossycobble", "brick", @@ -17,6 +18,7 @@ local default_nodes = { -- Default stairs/slabs/panels/microblocks: "bronzeblock", "diamondblock", "desert_stone", + "desert_stone_block", "desert_cobble", "meselamp", "glass", @@ -31,20 +33,29 @@ local default_nodes = { -- Default stairs/slabs/panels/microblocks: "aspen_tree", "aspen_wood", "obsidian", + "obsidian_block", + "obsidianbrick", "obsidian_glass", "stonebrick", "desert_stonebrick", "sandstonebrick", - "obsidianbrick", + "sandstone_block", + "coral_skeleton", + "farming:straw" } for _, name in pairs(default_nodes) do - local nodename = "default:" .. name + local nodename = "default:"..name + local a,b = string.find(name, ":") + if b then + nodename = name + name = string.sub(name, b+1) + end local ndef = minetest.registered_nodes[nodename] if ndef then local drop if type(ndef.drop) == "string" then - drop = ndef.drop:sub(9) + drop = ndef.drop:sub((b or 8)+1) end local tiles = ndef.tiles diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index 5d9a434..ea9dbc5 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -44,6 +44,10 @@ local slabs_defs = { } } +for k,v in pairs(slabs_defs) do + table.insert(stairsplus.shapes_list, { "slab_", k }) +end + function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new) local defs = stairsplus.copytable(slabs_defs) for alternate, def in pairs(defs) do diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index cd8142f..7d18b3d 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -219,6 +219,10 @@ local slopes_defs = { }, } +for k,v in pairs(slopes_defs) do + table.insert(stairsplus.shapes_list, { "slope_", k }) +end + function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new) local defs = stairsplus.copytable(slopes_defs) for alternate, def in pairs(defs) do diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index 8dd29a0..0291e7d 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -105,6 +105,10 @@ local stairs_defs = { }, } +for k,v in pairs(stairs_defs) do + table.insert(stairsplus.shapes_list, { "stair_", k }) +end + function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new) local defs = stairsplus.copytable(stairs_defs) for alternate, def in pairs(defs) do diff --git a/plasticbox/init.lua b/plasticbox/init.lua index 96366f3..afbeed8 100644 --- a/plasticbox/init.lua +++ b/plasticbox/init.lua @@ -5,8 +5,9 @@ minetest.register_node("plasticbox:plasticbox", { groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", after_dig_node = unifieddyes.after_dig_node, + place_param2 = 240, }) stairsplus:register_all("plasticbox", "plasticbox", "plasticbox:plasticbox", { @@ -70,3 +71,21 @@ minetest.register_lbm({ minetest.set_node(pos,node) end, }) + +minetest.register_lbm({ + name = "plasticbox:recolor", + label = "Convert to new palette", + nodenames = {"plasticbox:plasticbox"}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + if node.param2 == 0 then + node.param2 = 240 + else + node.param2 = unifieddyes.convert_classic_palette[node.param2] + end + minetest.swap_node(pos,node) + meta:set_string("palette", "ext") + end + end +}) diff --git a/replacer/init.lua b/replacer/init.lua index 6b7732c..3ab8cce 100644 --- a/replacer/init.lua +++ b/replacer/init.lua @@ -89,17 +89,13 @@ minetest.register_tool( "replacer:replacer", local node = minetest.get_node_or_nil( pos ); --minetest.chat_send_player( name, " Target node: "..minetest.serialize( node ).." at pos "..minetest.serialize( pos ).."."); - - local item = itemstack:to_table(); - -- make sure metadata is always set + local metadata = "default:dirt 0 0"; if( node ~= nil and node.name ) then - item[ "metadata" ] = node.name..' '..node.param1..' '..node.param2; - else - item[ "metadata" ] = "default:dirt 0 0"; + metadata = node.name..' '..node.param1..' '..node.param2; end - itemstack:replace( item ); + itemstack:set_metadata( metadata ); - minetest.chat_send_player( name, "Node replacement tool set to: '"..item[ "metadata" ].."'."); + minetest.chat_send_player( name, "Node replacement tool set to: '"..metadata.."'."); return itemstack; -- nothing consumed but data changed end, diff --git a/solidcolor/init.lua b/solidcolor/init.lua index 0334340..407fc61 100644 --- a/solidcolor/init.lua +++ b/solidcolor/init.lua @@ -5,8 +5,9 @@ minetest.register_node("solidcolor:block", { groups = {dig_immediate=2,ud_param2_colorable=1}, sounds = (default and default.node_sound_stone_defaults()), paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", after_dig_node = unifieddyes.after_dig_node, + place_param2 = 240, }) minetest.register_craft( { @@ -16,3 +17,21 @@ minetest.register_craft( { { "dye:white", "dye:white"}, }, }) + +minetest.register_lbm({ + name = "solidcolor:recolor", + label = "Convert to new palette", + nodenames = {"solidcolor:block"}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + if node.param2 == 0 then + node.param2 = 240 + else + node.param2 = unifieddyes.convert_classic_palette[node.param2] + end + minetest.swap_node(pos,node) + meta:set_string("palette", "ext") + end + end +}) diff --git a/stained_glass/init.lua b/stained_glass/init.lua index f68876b..8e62123 100644 --- a/stained_glass/init.lua +++ b/stained_glass/init.lua @@ -45,7 +45,8 @@ minetest.register_node("stained_glass:stained_glass", { tiles = { "stained_glass.png" }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, use_texture_alpha = true, light_source = myglow, @@ -55,80 +56,26 @@ minetest.register_node("stained_glass:stained_glass", { sounds = default.node_sound_glass_defaults(), drop = "moreblocks:super_glow_glass", after_dig_node = unifieddyes.after_dig_node, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local name = itemstack:get_name() - if name == "moreblocks:sweeper" then - minetest.swap_node(pos, { name = "stained_glass:pastel_stained_glass", param2 = node.param2 }) - return - end - end, drop = "moreblocks:super_glow_glass" }) minetest.override_item("moreblocks:super_glow_glass", { + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, ud_param2_colorable = 1}, ud_replacement_node = "stained_glass:stained_glass" }) --- pastel and faint - -minetest.register_node("stained_glass:pastel_stained_glass", { - description = "Stained Glass", - drawtype = "glasslike", - tiles = { "stained_glass.png" }, - paramtype = "light", - paramtype2 = "color", - palette = "stained_glass_pastels_palette.png", - sunlight_propagates = true, - use_texture_alpha = true, - light_source = myglow, - is_ground_content = true, - walkable = true, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, - sounds = default.node_sound_glass_defaults(), - after_dig_node = unifieddyes.after_dig_node, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local name = itemstack:get_name() - if name == "moreblocks:sweeper" then - minetest.swap_node(pos, { name = "stained_glass:faint_stained_glass", param2 = node.param2 }) - return - end - end, - drop = "moreblocks:super_glow_glass" -}) - -minetest.register_node("stained_glass:faint_stained_glass", { - description = "Stained Glass", - drawtype = "glasslike", - tiles = { "stained_glass.png" }, - paramtype = "light", - paramtype2 = "color", - palette = "stained_glass_faint_palette.png", - sunlight_propagates = true, - use_texture_alpha = true, - light_source = myglow, - is_ground_content = true, - walkable = true, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, - sounds = default.node_sound_glass_defaults(), - after_dig_node = unifieddyes.after_dig_node, - drop = "moreblocks:super_glow_glass" -}) - -- trap glass -minetest.override_item("moreblocks:trap_super_glow_glass", { - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1}, - ud_replacement_node = "stained_glass:stained_trap_glass" -}) - minetest.register_node("stained_glass:stained_trap_glass", { description = "Stained Trap-glass", drawtype = "glasslike", tiles = { "stained_glass.png" }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, use_texture_alpha = true, light_source = myglow, @@ -138,58 +85,14 @@ minetest.register_node("stained_glass:stained_trap_glass", { sounds = default.node_sound_glass_defaults(), drop = "moreblocks:trap_super_glow_glass", after_dig_node = unifieddyes.after_dig_node, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local name = itemstack:get_name() - if name == "moreblocks:sweeper" then - minetest.swap_node(pos, { name = "stained_glass:pastel_stained_trap_glass", param2 = node.param2 }) - return - end - end, - drop = "moreblocks:trap_super_glow_glass" -}) - --- pastel and faint trap - -minetest.register_node("stained_glass:pastel_stained_trap_glass", { - description = "Stained Glass", - drawtype = "glasslike", - tiles = { "stained_glass.png" }, - paramtype = "light", - paramtype2 = "color", - palette = "stained_glass_pastels_palette.png", - sunlight_propagates = true, - use_texture_alpha = true, - light_source = myglow, - is_ground_content = true, - walkable = false, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, - sounds = default.node_sound_glass_defaults(), - after_dig_node = unifieddyes.after_dig_node, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local name = itemstack:get_name() - if name == "moreblocks:sweeper" then - minetest.swap_node(pos, { name = "stained_glass:faint_stained_trap_glass", param2 = node.param2 }) - return - end - end, drop = "moreblocks:trap_super_glow_glass" }) -minetest.register_node("stained_glass:faint_stained_trap_glass", { - description = "Stained Glass", - drawtype = "glasslike", - tiles = { "stained_glass.png" }, - paramtype = "light", - paramtype2 = "color", - palette = "stained_glass_faint_palette.png", - sunlight_propagates = true, - use_texture_alpha = true, - light_source = myglow, - is_ground_content = true, - walkable = false, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, - sounds = default.node_sound_glass_defaults(), - drop = "moreblocks:trap_super_glow_glass" +minetest.override_item("moreblocks:trap_super_glow_glass", { + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, + groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1}, + ud_replacement_node = "stained_glass:stained_trap_glass" }) function stainedglass.makenode(arg) @@ -382,7 +285,6 @@ for i in ipairs(stained_glass_hues) do recipevalue = "group:dye,unicolor_"..shadename..huename if (shadename == "" and stained_glass_hues[i][2]) then - -- print(huename .. " is set to true -- substituting dye:huename ") recipevalue = "dye:"..huename elseif (shadename=="pastel_" or shadename=="faint_") then -- force light_dye for pastel and faint colors @@ -449,12 +351,17 @@ end -- convert in-map static nodes to use param2 coloring minetest.register_lbm({ - name = "stained_glass:convert_brickblocks", + name = "stained_glass:convert_glass", label = "Convert static glass blocks to use param2 color", run_at_every_load = false, nodenames = stainedglass.old_static_nodes, action = function(pos, node) local name = node.name + + name = string.gsub(name, "aqua", "spring") + name = string.gsub(name, "skyblue", "azure") + name = string.gsub(name, "redviolet", "rose") + local n = string.find(name, ":") local color = string.sub(name, n + 1) local h,s,v = unifieddyes.get_hsv(name) @@ -462,52 +369,44 @@ minetest.register_lbm({ if string.find(name, "trap") then n = string.find(color, "_") color = string.sub(color, n + 1) - - if string.find(color, "pastel") then - n = string.find(color, "_") - color = string.sub(color, n + 1) - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:pastel_stained_trap_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) - elseif string.find(color, "faint") then - n = string.find(color, "_") - color = string.sub(color, n + 1) - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:faint_stained_trap_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) - else - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:stained_trap_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) - end + local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") + minetest.set_node(pos, { name = "stained_glass:stained_trap_glass", param2 = paletteidx }) else - if string.find(color, "pastel") then - n = string.find(color, "_") - color = string.sub(color, n + 1) - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:pastel_stained_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) - elseif string.find(color, "faint") then - n = string.find(color, "_") - color = string.sub(color, n + 1) - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:faint_stained_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) - else - local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color) - minetest.set_node(pos, { name = "stained_glass:stained_glass", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..v..h..s) + local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") + minetest.set_node(pos, { name = "stained_glass:stained_glass", param2 = paletteidx }) + end + local meta = minetest.get_meta(pos) + meta:set_string("dye", "unifieddyes:"..v..h..s) + meta:set_string("palette", "ext") + end +}) + +minetest.register_lbm({ + name = "stained_glass:recolor_glass", + label = "Convert glass to use UD extended palette", + run_at_every_load = false, + nodenames = { + "stained_glass:stained_glass", + "stained_glass:stained_trap_glass", + "stained_glass:faint_stained_glass", + "stained_glass:faint_stained_trap_glass", + "stained_glass:pastel_stained_glass", + "stained_glass:pastel_stained_trap_glass" + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + + local newcolor = unifieddyes.convert_classic_palette[node.param2] + if string.find(node.name, "faint") then + newcolor = newcolor - 4*24 + elseif string.find(node.name, "pastel") then + newcolor = newcolor - 3*24 end + minetest.swap_node(pos, { name = "stained_glass:stained_glass", param2 = newcolor }) + meta:set_string("palette", "ext") end end }) print("[stained_glass] Loaded!") - - diff --git a/technic/config.lua b/technic/config.lua index 81a2224..29321f9 100644 --- a/technic/config.lua +++ b/technic/config.lua @@ -9,6 +9,9 @@ local defaults = { enable_wind_mill = "false", enable_frames = "false", enable_corium_griefing = "true", + enable_radiation_protection = "true", + enable_entity_radiation_damage = "true", + enable_longterm_radiation_damage = "true", } for k, v in pairs(defaults) do diff --git a/technic/radiation.lua b/technic/radiation.lua index ac3f166..13936f9 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -242,6 +242,10 @@ local cache_scaled_shielding = {} local rad_dmg_cutoff = 0.2 local radiated_players = {} +local armor_enabled = technic.config:get_bool("enable_radiation_protection") +local entity_damage = technic.config:get_bool("enable_entity_radiation_damage") +local longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage") + local function apply_fractional_damage(o, dmg) local dmg_int = math.floor(dmg) -- The closer you are to getting one more damage point, @@ -257,26 +261,69 @@ local function apply_fractional_damage(o, dmg) return false end -local function dmg_player(pos, player, strength) - local pl_pos = player:getpos() - pl_pos.y = pl_pos.y + abdomen_offset +local function calculate_base_damage(node_pos, object_pos, strength) local shielding = 0 - local dist = vector.distance(pos, pl_pos) + local dist = vector.distance(node_pos, object_pos) - for ray_pos in technic.trace_node_ray(pos, - vector.direction(pos, pl_pos), dist) do + for ray_pos in technic.trace_node_ray(node_pos, + vector.direction(node_pos, object_pos), dist) do local shield_name = minetest.get_node(ray_pos).name - shielding = shielding + node_radiation_resistance(shield_name) * 0.1 + shielding = shielding + node_radiation_resistance(shield_name) * 0.025 end local dmg = (strength * strength) / (math.max(0.75, dist * dist) * math.exp(shielding)) if dmg < rad_dmg_cutoff then return end - apply_fractional_damage(player, dmg) + return dmg +end + +local function calculate_damage_multiplier(object) + local ag = object.get_armor_groups and object:get_armor_groups() + if not ag then + return 0 + end + if ag.immortal then + return 0 + end + if ag.radiation then + return 0.01 * ag.radiation + end + if ag.fleshy then + return math.sqrt(0.01 * ag.fleshy) + end + return 0 +end - local pn = player:get_player_name() - radiated_players[pn] = (radiated_players[pn] or 0) + dmg +local function calculate_object_center(object) + if object:is_player() then + return {x=0, y=abdomen_offset, z=0} + end + return {x=0, y=0, z=0} +end + +local function dmg_object(pos, object, strength) + local obj_pos = vector.add(object:getpos(), calculate_object_center(object)) + local mul + if armor_enabled or entity_damage then + -- we need to check may the object be damaged even if armor is disabled + mul = calculate_damage_multiplier(object) + if mul == 0 then + return + end + end + local dmg = calculate_base_damage(pos, obj_pos, strength) + if not dmg then + return + end + if armor_enabled then + dmg = dmg * mul + end + apply_fractional_damage(object, dmg) + if longterm_damage and object:is_player() then + local pn = object:get_player_name() + radiated_players[pn] = (radiated_players[pn] or 0) + dmg + end end local rad_dmg_mult_sqrt = math.sqrt(1 / rad_dmg_cutoff) @@ -285,8 +332,8 @@ local function dmg_abm(pos, node) local max_dist = strength * rad_dmg_mult_sqrt for _, o in pairs(minetest.get_objects_inside_radius(pos, max_dist + abdomen_offset)) do - if o:is_player() then - dmg_player(pos, o, strength) + if entity_damage or o:is_player() then + dmg_object(pos, o, strength) end end end @@ -299,26 +346,28 @@ if minetest.setting_getbool("enable_damage") then action = dmg_abm, }) - minetest.register_globalstep(function(dtime) - for pn, dmg in pairs(radiated_players) do - dmg = dmg - (dtime / 8) - local player = minetest.get_player_by_name(pn) - local killed - if player and dmg > rad_dmg_cutoff then - killed = apply_fractional_damage(player, (dmg * dtime) / 8) - else - dmg = nil - end - -- on_dieplayer will have already set this if the player died - if not killed then - radiated_players[pn] = dmg + if longterm_damage then + minetest.register_globalstep(function(dtime) + for pn, dmg in pairs(radiated_players) do + dmg = dmg - (dtime / 8) + local player = minetest.get_player_by_name(pn) + local killed + if player and dmg > rad_dmg_cutoff then + killed = apply_fractional_damage(player, (dmg * dtime) / 8) + else + dmg = nil + end + -- on_dieplayer will have already set this if the player died + if not killed then + radiated_players[pn] = dmg + end end - end - end) + end) - minetest.register_on_dieplayer(function(player) - radiated_players[player:get_player_name()] = nil - end) + minetest.register_on_dieplayer(function(player) + radiated_players[player:get_player_name()] = nil + end) + end end -- Radioactive materials that can result from destroying a reactor diff --git a/unifiedbricks/init.lua b/unifiedbricks/init.lua index a4c9758..e3d37d7 100644 --- a/unifiedbricks/init.lua +++ b/unifiedbricks/init.lua @@ -102,7 +102,8 @@ minetest.register_node("unifiedbricks:brickblock", { mesh = "unifiedbricks_brick_block.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = true, groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), @@ -122,7 +123,8 @@ minetest.register_node("unifiedbricks:clayblock", { }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = true, groups = {crumbly=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, sounds = default.node_sound_dirt_defaults({ @@ -147,7 +149,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_dark", { mesh = "unifiedbricks_brick_block.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = true, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), @@ -164,7 +167,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_medium", { mesh = "unifiedbricks_brick_block.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = true, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), @@ -181,7 +185,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_light", { mesh = "unifiedbricks_brick_block.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = true, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), @@ -292,7 +297,7 @@ minetest.register_lbm({ local color2 = string.gsub(color1, "grey", "_grey") if color2 == "_grey" then color2 = "grey" end - local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2) + local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2, "extended") if string.find(type, "multicolor") then @@ -312,16 +317,34 @@ minetest.register_lbm({ end minetest.set_node(pos, { name = "unifiedbricks:brickblock_multicolor_"..shade, param2 = newpalette }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..color1) + elseif string.find(type, "brickblock") then minetest.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..color1) elseif string.find(type, "clayblock") then minetest.set_node(pos, { name = "unifiedbricks:clayblock", param2 = paletteidx }) - local meta = minetest.get_meta(pos) - meta:set_string("dye", "unifieddyes:"..color1) + end + local meta = minetest.get_meta(pos) + meta:set_string("dye", "unifieddyes:"..color1) + meta:set_string("palette", "ext") + end +}) + +minetest.register_lbm({ + name = "unifiedbricks:recolor_bricks", + label = "Convert 89-color bricks to use UD extended palette", + run_at_every_load = false, + nodenames = { + "unifiedbricks:clayblock", + "unifiedbricks:brickblock", + "unifiedbricks:brickblock_multicolor_dark", + "unifiedbricks:brickblock_multicolor_medium", + "unifiedbricks:brickblock_multicolor_light", + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") end end }) diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 76b849e..a70eb21 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -43,7 +43,7 @@ end -- helper functions for other mods that use this one -local HUES = { +unifieddyes.HUES = { "red", "orange", "yellow", @@ -58,19 +58,62 @@ local HUES = { "redviolet" } -local HUES2 = { - "Red", - "Orange", - "Yellow", - "Lime", - "Green", - "Aqua", - "Cyan", - "Sky-blue", - "Blue", - "Violet", - "Magenta", - "Red-violet" +-- the names of the various colors here came from http://www.procato.com/rgb+index/ + +unifieddyes.HUES_EXTENDED = { + { "red", 0xff, 0x00, 0x00 }, + { "vermilion", 0xff, 0x40, 0x00 }, + { "orange", 0xff, 0x80, 0x00 }, + { "amber", 0xff, 0xbf, 0x00 }, + { "yellow", 0xff, 0xff, 0x00 }, + { "lime", 0xbf, 0xff, 0x00 }, + { "chartreuse", 0x80, 0xff, 0x00 }, + { "harlequin", 0x40, 0xff, 0x00 }, + { "green", 0x00, 0xff, 0x00 }, + { "malachite", 0x00, 0xff, 0x40 }, + { "spring", 0x00, 0xff, 0x80 }, + { "turquoise", 0x00, 0xff, 0xbf }, + { "cyan", 0x00, 0xff, 0xff }, + { "cerulean", 0x00, 0xbf, 0xff }, + { "azure", 0x00, 0x80, 0xff }, + { "sapphire", 0x00, 0x40, 0xff }, + { "blue", 0x00, 0x00, 0xff }, + { "indigo", 0x40, 0x00, 0xff }, + { "violet", 0x80, 0x00, 0xff }, + { "mulberry", 0xbf, 0x00, 0xff }, + { "magenta", 0xff, 0x00, 0xff }, + { "fuchsia", 0xff, 0x00, 0xbf }, + { "rose", 0xff, 0x00, 0x80 }, + { "crimson", 0xff, 0x00, 0x40 } +} + +unifieddyes.SATS = { + "", + "_s50" +} + +unifieddyes.VALS = { + "", + "medium_", + "dark_" +} + +unifieddyes.VALS_EXTENDED = { + "faint_", + "pastel_", + "light_", + "bright_", + "", + "medium_", + "dark_" +} + +unifieddyes.GREYS = { + "white", + "light_grey", + "grey", + "dark_grey", + "black" } local default_dyes = { @@ -91,6 +134,14 @@ local default_dyes = { "yellow" } +-- this tiles the "extended" palette sideways and then crops it to 256x1 +-- to convert it from human readable to something the engine can use as a palette. +-- +-- in machine-readable form, the selected color is: +-- [hue] - [shade]*24 for the light colors, or +-- [hue] + [saturation]*24 + [shade]*48 for the dark colors, or +-- 240 + [shade] for the greys, 0 = white. + -- code borrowed from homedecor -- call this function to reset the rotation of a "wallmounted" object on place @@ -128,8 +179,6 @@ end function unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2) local new_fdir = new_param2 % 8 local color = new_param2 - new_fdir - print(new_fdir) - if new_fdir < 2 then new_fdir = 2 minetest.swap_node(pos, { name = node.name, param2 = new_fdir + color }) @@ -164,7 +213,7 @@ end function unifieddyes.get_hsv(name) -- expects a node/item name local hue = "" local a,b - for _, i in ipairs(HUES) do + for _, i in ipairs(unifieddyes.HUES) do a,b = string.find(name, "_"..i) if a and not ( string.find(name, "_redviolet") and i == "red" ) then hue = i @@ -192,9 +241,18 @@ function unifieddyes.get_hsv(name) -- expects a node/item name return hue, sat, val end --- code borrowed from cheapie's plasticbox mod +-- code partially borrowed from cheapie's plasticbox mod + +-- in the function below, color is just a color string, while +-- palette_type can be: +-- +-- false/nil = standard 89 color palette +-- true = 89 color palette split into pieces for colorfacedir +-- "wallmounted" = 32-color abridged palette +-- "extended" = 256 color palette + +function unifieddyes.getpaletteidx(color, palette_type) -function unifieddyes.getpaletteidx(color, is_color_fdir) local origcolor = color local aliases = { ["pink"] = "light_red", @@ -209,6 +267,28 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) ["black"] = 5, } + local grayscale_extended = { + ["white"] = 0, + ["grey_14"] = 1, + ["grey_13"] = 2, + ["grey_12"] = 3, + ["light_grey"] = 3, + ["grey_11"] = 4, + ["grey_10"] = 5, + ["grey_9"] = 6, + ["grey_8"] = 7, + ["grey"] = 7, + ["grey_7"] = 8, + ["grey_6"] = 9, + ["grey_5"] = 10, + ["grey_4"] = 11, + ["dark_grey"] = 11, + ["grey_3"] = 12, + ["grey_2"] = 13, + ["grey_1"] = 14, + ["black"] = 15, + } + local grayscale_wallmounted = { ["white"] = 0, ["light_grey"] = 1, @@ -232,6 +312,33 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) ["redviolet"] = 12, } + local hues_extended = { + ["red"] = 0, + ["vermilion"] = 1, + ["orange"] = 2, + ["amber"] = 3, + ["yellow"] = 4, + ["lime"] = 5, + ["chartreuse"] = 6, + ["harlequin"] = 7, + ["green"] = 8, + ["malachite"] = 9, + ["spring"] = 10, + ["turquoise"] = 11, + ["cyan"] = 12, + ["cerulean"] = 13, + ["azure"] = 14, + ["sapphire"] = 15, + ["blue"] = 16, + ["indigo"] = 17, + ["violet"] = 18, + ["mulberry"] = 19, + ["magenta"] = 20, + ["fuchsia"] = 21, + ["rose"] = 22, + ["crimson"] = 23, + } + local hues_wallmounted = { ["red"] = 0, ["orange"] = 1, @@ -253,6 +360,19 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) ["darks50"] = 7, } + local shades_extended = { + ["faint"] = 0, + ["pastel"] = 1, + ["light"] = 2, + ["bright"] = 3, + [""] = 4, + ["s50"] = 5, + ["medium"] = 6, + ["mediums50"] = 7, + ["dark"] = 8, + ["darks50"] = 9 + } + local shades_wallmounted = { [""] = 1, ["medium"] = 2, @@ -267,24 +387,37 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) return end - if is_color_fdir == "wallmounted" then + if palette_type == "wallmounted" then if grayscale_wallmounted[color] then return (grayscale_wallmounted[color] * 8), 0 end - elseif is_color_fdir then + elseif palette_type == true then if grayscale[color] then return (grayscale[color] * 32), 0 end + elseif palette_type == "extended" then + if grayscale_extended[color] then + return grayscale_extended[color]+240, 0 + end else if grayscale[color] then return grayscale[color], 0 end end - local shade = "" - if string.sub(color,1,6) == "light_" then + local shade = "" -- assume full + if string.sub(color,1,6) == "faint_" then + shade = "faint" + color = string.sub(color,7,-1) + elseif string.sub(color,1,7) == "pastel_" then + shade = "pastel" + color = string.sub(color,8,-1) + elseif string.sub(color,1,6) == "light_" then shade = "light" color = string.sub(color,7,-1) + elseif string.sub(color,1,7) == "bright_" then + shade = "bright" + color = string.sub(color,8,-1) elseif string.sub(color,1,7) == "medium_" then shade = "medium" color = string.sub(color,8,-1) @@ -297,7 +430,7 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) color = string.sub(color,1,-5) end - if is_color_fdir == "wallmounted" then + if palette_type == "wallmounted" then if color == "brown" then return 48,1 elseif color == "pink" then return 56,7 elseif color == "blue" and shade == "light" then return 40,5 @@ -312,10 +445,28 @@ function unifieddyes.getpaletteidx(color, is_color_fdir) color = "red" shade = "light" end - if hues[color] and shades[shade] then - if is_color_fdir then + if palette_type == true then -- it's colorfacedir + if hues[color] and shades[shade] then return (shades[shade] * 32), hues[color] - else + end + elseif palette_type == "extended" then + if hues_extended[color] and shades_extended[shade] then + return (hues_extended[color] + shades_extended[shade]*24), hues_extended[color] + end + else -- it's the 89-color palette + + -- If using this palette, translate new color names back to old. + + if shade == "" then + if color == "spring" then + color = "aqua" + elseif color == "azure" then + color = "skyblue" + elseif color == "rose" then + color = "redviolet" + end + end + if hues[color] and shades[shade] then return (hues[color] * 8 + shades[shade]), hues[color] end end @@ -369,16 +520,20 @@ function unifieddyes.on_use(itemstack, player, pointed_thing) end local newnode = nodedef.ud_replacement_node - local is_color_fdir - - if nodedef.paramtype2 == "color" then - is_color_fdir = false - elseif nodedef.paramtype2 == "colorfacedir" - then is_color_fdir = true - elseif nodedef.paramtype2 == "colorwallmounted" - then is_color_fdir = "wallmounted" + local palette_type + + if nodedef.palette == "unifieddyes_palette_extended.png" then + palette_type = "extended" + elseif nodedef.palette == "unifieddyes_palette.png" then + palette_type = false + elseif nodedef.paramtype2 == "colorfacedir" then + palette_type = true + elseif nodedef.paramtype2 == "colorwallmounted" then + palette_type = "wallmounted" end + print(palette_type) + if minetest.is_protected(pos, playername) and not minetest.check_player_privs(playername, {protection_bypass=true}) then minetest.record_protection_violation(pos, playername) return @@ -386,7 +541,7 @@ function unifieddyes.on_use(itemstack, player, pointed_thing) local stackname = itemstack:get_name() local pos2 = unifieddyes.select_node(pointed_thing) - local paletteidx, hue = unifieddyes.getpaletteidx(stackname, is_color_fdir) + local paletteidx, hue = unifieddyes.getpaletteidx(stackname, palette_type) if paletteidx then @@ -414,11 +569,11 @@ function unifieddyes.on_use(itemstack, player, pointed_thing) node.param2 = paletteidx - local oldpaletteidx, oldhuenum = unifieddyes.getpaletteidx(prevdye, is_color_fdir) + local oldpaletteidx, oldhuenum = unifieddyes.getpaletteidx(prevdye, palette_type) local oldnode = minetest.get_node(pos) local oldhue = nil - for _, i in ipairs(HUES) do + for _, i in ipairs(unifieddyes.HUES) do if string.find(oldnode.name, "_"..i) and not ( string.find(oldnode.name, "_redviolet") and i == "red" ) then oldhue = i @@ -427,54 +582,60 @@ function unifieddyes.on_use(itemstack, player, pointed_thing) end if newnode then -- this path is used when the calling mod want to supply a replacement node - if is_color_fdir == "wallmounted" then + if palette_type == "wallmounted" then node.param2 = paletteidx + (minetest.get_node(pos).param2 % 8) - elseif is_color_fdir then -- we probably need to change the hue of the node too + elseif palette_type == true then -- it's colorfacedir if oldhue ~=0 then -- it's colored, not grey if oldhue ~= nil then -- it's been painted before if hue ~= 0 then -- the player's wielding a colored dye - newnode = string.gsub(newnode, "_"..oldhue, "_"..HUES[hue]) + newnode = string.gsub(newnode, "_"..oldhue, "_"..unifieddyes.HUES[hue]) else -- it's a greyscale dye newnode = string.gsub(newnode, "_"..oldhue, "_grey") end else -- it's never had a color at all if hue ~= 0 then -- and if the wield is greyscale, don't change the node name - newnode = string.gsub(newnode, "_grey", "_"..HUES[hue]) + newnode = string.gsub(newnode, "_grey", "_"..unifieddyes.HUES[hue]) end end else if hue ~= 0 then -- greyscale dye on greyscale node = no hue change - newnode = string.gsub(newnode, "_grey", "_"..HUES[hue]) + newnode = string.gsub(newnode, "_grey", "_"..unifieddyes.HUES[hue]) end end node.param2 = paletteidx + (minetest.get_node(pos).param2 % 32) - else + else -- it's the 89-color palette, or the extended palette node.param2 = paletteidx end node.name = newnode minetest.swap_node(pos, node) + if palette_type == "extended" then + meta:set_string("palette", "ext") + end if not creative_mode then return itemstack end else -- this path is used when you're just painting an existing node, rather than replacing one. newnode = oldnode -- note that here, newnode/oldnode are a full node, not just the name. - if is_color_fdir == "wallmounted" then + if palette_type == "wallmounted" then newnode.param2 = paletteidx + (minetest.get_node(pos).param2 % 8) - elseif is_color_fdir then + elseif palette_type == true then -- it's colorfacedir if oldhue then if hue ~= 0 then - newnode.name = string.gsub(newnode.name, "_"..oldhue, "_"..HUES[hue]) + newnode.name = string.gsub(newnode.name, "_"..oldhue, "_"..unifieddyes.HUES[hue]) else newnode.name = string.gsub(newnode.name, "_"..oldhue, "_grey") end elseif string.find(minetest.get_node(pos).name, "_grey") and hue ~= 0 then - newnode.name = string.gsub(newnode.name, "_grey", "_"..HUES[hue]) + newnode.name = string.gsub(newnode.name, "_grey", "_"..unifieddyes.HUES[hue]) end newnode.param2 = paletteidx + (minetest.get_node(pos).param2 % 32) - else + else -- it's the 89-color palette, or the extended palette newnode.param2 = paletteidx end minetest.swap_node(pos, newnode) + if palette_type == "extended" then + meta:set_string("palette", "ext") + end if not creative_mode then return itemstack end @@ -495,321 +656,284 @@ for _, color in ipairs(default_dyes) do }) end --- Items/recipes needed to generate the few base colors that are not --- provided by the standard dyes mod. +-- build a table to convert from classic/89-color palette to extended palette --- Lime +-- the first five entries are for the old greyscale - white, light, grey, dark, black +unifieddyes.convert_classic_palette = { + 240, + 244, + 247, + 251, + 253 +} -minetest.register_craftitem(":dye:lime", { - description = S("Lime Dye"), - inventory_image = "unifieddyes_lime.png", - groups = { dye=1, excolor_lime=1, unicolor_lime=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use -}) +for hue = 0, 11 do + -- light + local paletteidx = unifieddyes.getpaletteidx("dye:light_"..unifieddyes.HUES[hue+1], false) + unifieddyes.convert_classic_palette[paletteidx] = hue*2 + 48 + for sat = 0, 1 do + for val = 0, 2 do + -- all other shades + local paletteidx = unifieddyes.getpaletteidx("dye:"..unifieddyes.VALS[val+1]..unifieddyes.HUES[hue+1]..unifieddyes.SATS[sat+1], false) + unifieddyes.convert_classic_palette[paletteidx] = hue*2 + sat*24 + (val*48+96) + end + end +end -minetest.register_craft( { - type = "shapeless", - output = "dye:lime 2", - recipe = { - "dye:yellow", - "dye:green", - }, -}) +-- Generate all dyes that are not part of the default minetest_game dyes mod --- Aqua +for _, h in ipairs(unifieddyes.HUES_EXTENDED) do + local hue = h[1] + local r = h[2] + local g = h[3] + local b = h[4] -minetest.register_craftitem(":dye:aqua", { - description = S("Aqua Dye"), - inventory_image = "unifieddyes_aqua.png", - groups = { dye=1, excolor_aqua=1, unicolor_aqua=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use -}) + for v = 0, 6 do + local val = unifieddyes.VALS_EXTENDED[v+1] -minetest.register_craft( { - type = "shapeless", - output = "dye:aqua 2", - recipe = { - "dye:cyan", - "dye:green", - }, -}) + local factor = 40 + if v > 3 then factor = 75 end --- Sky blue + local r2 = math.max(math.min(r + (4-v)*factor, 255), 0) + local g2 = math.max(math.min(g + (4-v)*factor, 255), 0) + local b2 = math.max(math.min(b + (4-v)*factor, 255), 0) -minetest.register_craftitem(":dye:skyblue", { - description = S("Sky-blue Dye"), - inventory_image = "unifieddyes_skyblue.png", - groups = { dye=1, excolor_sky_blue=1, unicolor_sky_blue=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use -}) + -- full-sat color -minetest.register_craft( { - type = "shapeless", - output = "dye:skyblue 2", - recipe = { - "dye:cyan", - "dye:blue", - }, -}) + local desc = hue:gsub("%a", string.upper, 1).." Dye" --- Red-violet + if val ~= "" then + desc = val:sub(1, -2):gsub("%a", string.upper, 1) .." "..desc + end -minetest.register_craftitem(":dye:redviolet", { - description = S("Red-violet Dye"), - inventory_image = "unifieddyes_redviolet.png", - groups = { dye=1, excolor_red_violet=1, unicolor_red_violet=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use -}) + local color = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2) + if minetest.registered_items["dye:"..val..hue] then + minetest.override_item("dye:"..val..hue, { + inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200", + on_use = unifieddyes.on_use + }) + else + minetest.register_craftitem(":dye:"..val..hue, { + description = S(desc), + inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200", + groups = { dye=1, not_in_creative_inventory=1 }, + on_use = unifieddyes.on_use + }) + end + minetest.register_alias("unifieddyes:"..val..hue, "dye:"..val..hue) -minetest.register_craft( { - type = "shapeless", - output = "dye:redviolet 2", - recipe = { - "dye:red", - "dye:magenta", - }, -}) + if v > 3 then -- also register the low-sat version + local pr = 0.299 + local pg = 0.587 + local pb = 0.114 --- Light grey + local p = math.sqrt(r2*r2*pr + g2*g2*pg + b2*b2*pb) + local r3 = math.floor(p+(r2-p)*0.5) + local g3 = math.floor(p+(g2-p)*0.5) + local b3 = math.floor(p+(b2-p)*0.5) -minetest.register_craftitem(":dye:light_grey", { - description = S("Light Grey Dye"), - inventory_image = "unifieddyes_lightgrey.png", - groups = { dye=1, excolor_lightgrey=1, unicolor_light_grey=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use -}) + local color = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) -minetest.register_craft( { - type = "shapeless", - output = "dye:light_grey 2", - recipe = { - "dye:grey", - "dye:white", - }, -}) + minetest.register_craftitem(":dye:"..val..hue.."_s50", { + description = S(desc.." (low saturation)"), + inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200", + groups = { dye=1, not_in_creative_inventory=1 }, + on_use = unifieddyes.on_use + }) + minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50") + end + end +end --- Extra craft for black dye +-- register the greyscales too :P -minetest.register_craft( { - type = "shapeless", - output = "dye:black 4", - recipe = { - "default:coal_lump", - }, -}) +for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes --- Extra craft for dark grey dye + if y ~= 4 and y ~= 8 and Y~= 11 then -- don't register the three greys, they're done separately. -minetest.register_craft( { - type = "shapeless", - output = "dye:dark_grey 3", - recipe = { - "dye:black", - "dye:black", - "dye:white", - }, -}) + local rgb = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17) + local name = "grey_"..y + local desc = "Grey Dye #"..y --- Extra craft for light grey dye + minetest.register_craftitem(":dye:"..name, { + description = S(desc), + inventory_image = "unifieddyes_dye.png^[colorize:#"..rgb..":200", + groups = { dye=1, not_in_creative_inventory=1 }, + on_use = unifieddyes.on_use + }) + minetest.register_alias("unifieddyes:"..name, "dye:"..name) + end +end -minetest.register_craft( { - type = "shapeless", - output = "dye:light_grey 3", - recipe = { - "dye:black", - "dye:white", - "dye:white", - }, +minetest.override_item("dye:grey", { + inventory_image = "unifieddyes_dye.png^[colorize:#888888:200", + on_use = unifieddyes.on_use }) --- Extra craft for green dye - -minetest.register_craft( { - type = "shapeless", - output = "dye:green 4", - recipe = { - "default:cactus", - }, +minetest.override_item("dye:dark_grey", { + inventory_image = "unifieddyes_dye.png^[colorize:#444444:200", + on_use = unifieddyes.on_use }) --- ================================================================= - --- Generate all of additional variants of hue, saturation, and --- brightness. - --- "s50" in a file/item name means "saturation: 50%". --- Brightness levels in the textures are 33% ("dark"), 66% ("medium"), --- 100% ("full", but not so-named), and 150% ("light"). - +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 }, + on_use = unifieddyes.on_use +}) -for i = 1, 12 do +local base_color_crafts = { + { "red", "flowers:rose", nil, nil, 4 }, + { "vermilion", "dye:red", "dye:orange", nil, 3 }, + { "orange", "flowers:tulip", nil, nil, 4 }, + { "orange", "dye:red", "dye:yellow", nil, 2 }, + { "amber", "dye:orange", "dye:yellow", nil, 2 }, + { "yellow", "flowers:dandelion_yellow", nil, nil, 4 }, + { "lime", "dye:yellow", "dye:chartreuse", nil, 2 }, + { "chartreuse", "dye:yellow", "dye:green", nil, 2 }, + { "harlequin", "dye:chartreuse", "dye:green", nil, 2 }, + { "green", "default:cactus", nil, nil, 4 }, + { "green", "dye:yellow", "dye:blue", nil, 2 }, + { "malachite", "dye:green", "dye:spring", nil, 2 }, + { "spring", "dye:green", "dye:cyan", nil, 2 }, + { "turquoise", "dye:spring", "dye:cyan", nil, 2 }, + { "cyan", "dye:green", "dye:blue", nil, 2 }, + { "cerulean", "dye:cyan", "dye:azure", nil, 2 }, + { "azure", "dye:cyan", "dye:blue", nil, 2 }, + { "sapphire", "dye:azure", "dye:blue", nil, 2 }, + { "blue", "flowers:geranium", nil, nil, 4 }, + { "indigo", "dye:blue", "dye:violet", nil, 2 }, + { "violet", "flowers:viola", nil, nil, 4 }, + { "violet", "dye:blue", "dye:magenta", nil, 2 }, + { "mulberry", "dye:violet", "dye:magenta", nil, 2 }, + { "magenta", "dye:blue", "dye:red", nil, 2 }, + { "fuchsia", "dye:magenta", "dye:rose", nil, 2 }, + { "rose", "dye:magenta", "dye:red", nil, 2 }, + { "crimson", "dye:rose", "dye:red", nil, 2 }, + + { "black", "default:coal_lump", nil, nil, 4 }, + { "white", "flowers:dandelion_white", nil, nil, 4 }, +} - local hue = HUES[i] - local hue2 = HUES2[i] +local shade_crafts = { + { "faint_", "", "dye:white", "dye:white", "dye:white", 4 }, + { "pastel_", "", "dye:white", "dye:white", nil, 3 }, + { "light_", "", "dye:white", nil, nil, 2 }, + { "bright_", "", "color", "dye:white", nil, 3 }, + { "", "_s50", "dye:light_grey", nil, nil, 2 }, + { "", "_s50", "dye:black", "dye:white", "dye:white", 3 }, + { "medium_", "", "dye:black", nil, nil, 2 }, + { "medium_", "_s50", "dye:grey", nil, nil, 2 }, + { "medium_", "_s50", "dye:black", "dye:white", nil, 3 }, + { "dark_", "", "dye:black", "dye:black", nil, 3 }, + { "dark_", "_s50", "dye:dark_grey", nil, nil, 2 }, + { "dark_", "_s50", "dye:black", "dye:black", "dye:white", 4 }, +} - minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:dark_" .. hue .. "_s50 2", - recipe = { - "dye:" .. hue, - "dye:dark_grey", - }, - }) +for _,i in ipairs(base_color_crafts) do + local color = i[1] + local dye1 = i[2] + local dye2 = i[3] + local dye3 = i[4] + local yield = i[5] minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:dark_" .. hue .. "_s50 4", - recipe = { - "dye:" .. hue, - "dye:black", - "dye:black", - "dye:white" - }, - }) - - if hue == "green" then - - minetest.register_craft( { - type = "shapeless", - output = "dye:dark_green 3", - recipe = { - "dye:" .. hue, - "dye:black", - "dye:black", - }, - }) - else - minetest.register_craft( { type = "shapeless", - output = "unifieddyes:dark_" .. hue .. " 3", + output = "dye:"..color.." "..yield, recipe = { - "dye:" .. hue, - "dye:black", - "dye:black", - }, - }) - end - - minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:medium_" .. hue .. "_s50 2", - recipe = { - "dye:" .. hue, - "dye:grey", - }, + dye1, + dye2, + dye3, + }, }) - minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:medium_" .. hue .. "_s50 3", - recipe = { - "dye:" .. hue, - "dye:black", - "dye:white", - }, - }) + for _,j in ipairs(shade_crafts) do + local shade = j[1] + local sat = j[2] + local dye4 = j[3] + local dye5 = j[4] + local dye6 = j[5] + + if dye4 == "color" then dye4 = "dye:"..color end + + if color ~= "black" and color ~= "white" and not string.find(color, "grey") then + + minetest.register_craft( { + type = "shapeless", + output = "dye:"..shade..color..sat.." "..yield, + recipe = { + "dye:"..color, + dye4, + dye5, + dye6 + }, + }) + end + end +end - minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:medium_" .. hue .. " 2", - recipe = { - "dye:" .. hue, - "dye:black", - }, - }) +local greymixes = { + { 1, "dye:black", "dye:black", "dye:black", "dye:dark_grey", 4 }, + { 2, "dye:black", "dye:black", "dye:dark_grey", nil, 3 }, + { 3, "dye:black", "dye:dark_grey", nil, nil, 2 }, + { 4, "dye:white", "dye:black", "dye:black", nil, 3 }, + { 5, "dye:dark_grey", "dye:dark_grey", "dye:grey", nil, 3 }, + { 6, "dye:dark_grey", "dye:grey", nil, nil, 2 }, + { 7, "dye:dark_grey", "dye:grey", "dye:grey", nil, 3 }, + { 8, "dye:white", "dye:black", nil, nil, 2 }, + { 9, "dye:grey", "dye:grey", "dye:light_grey", nil, 3 }, + { 10, "dye:grey", "dye:light_grey", "dye:light_grey", nil, 3 }, + { 11, "dye:white", "dye:white", "dye:black", nil, 3 }, + { 12, "dye:light_grey", "dye:light_grey", "dye:white", nil, 3 }, + { 13, "dye:light_grey", "dye:white", nil, nil, 2 }, + { 14, "dye:white", "dye:white", "dye:light_grey", nil, 3 }, +} - minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:" .. hue .. "_s50 2", - recipe = { - "dye:" .. hue, - "dye:grey", - "dye:white", - }, - }) +for _, i in ipairs(greymixes) do + local shade = i[1] + local dye1 = i[2] + local dye2 = i[3] + local dye3 = i[4] + local dye4 = i[5] + local yield = i[6] + local color = "grey_"..shade + if shade == 4 then + color = "dark_grey" + elseif shade == 8 then + color = "grey" + elseif shade == 11 then + color = "light_grey" + end minetest.register_craft( { - type = "shapeless", - output = "unifieddyes:" .. hue .. "_s50 4", - recipe = { - "dye:" .. hue, - "dye:white", - "dye:white", - "dye:black", - }, - }) - - if hue ~= "red" then - minetest.register_craft( { type = "shapeless", - output = "unifieddyes:light_" .. hue .. " 2", + output = "dye:"..color.." "..yield, recipe = { - "dye:" .. hue, - "dye:white", - }, - }) - end - - minetest.register_craftitem("unifieddyes:dark_" .. hue .. "_s50", { - description = S("Dark " .. hue2 .. " Dye (low saturation)"), - inventory_image = "unifieddyes_dark_" .. hue .. "_s50.png", - groups = { dye=1, ["unicolor_dark_"..hue.."_s50"]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use - }) - - if hue ~= "green" then - minetest.register_craftitem("unifieddyes:dark_" .. hue, { - description = S("Dark " .. hue2 .. " Dye"), - inventory_image = "unifieddyes_dark_" .. hue .. ".png", - groups = { dye=1, ["unicolor_dark_"..hue]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use - }) - end - - minetest.register_craftitem("unifieddyes:medium_" .. hue .. "_s50", { - description = S("Medium " .. hue2 .. " Dye (low saturation)"), - inventory_image = "unifieddyes_medium_" .. hue .. "_s50.png", - groups = { dye=1, ["unicolor_medium_"..hue.."_s50"]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use - }) - - minetest.register_craftitem("unifieddyes:medium_" .. hue, { - description = S("Medium " .. hue2 .. " Dye"), - inventory_image = "unifieddyes_medium_" .. hue .. ".png", - groups = { dye=1, ["unicolor_medium_"..hue]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use - }) - - minetest.register_craftitem("unifieddyes:" .. hue .. "_s50", { - description = S(hue2 .. " Dye (low saturation)"), - inventory_image = "unifieddyes_" .. hue .. "_s50.png", - groups = { dye=1, ["unicolor_"..hue.."_s50"]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use + dye1, + dye2, + dye3, + dye4, + }, }) - - if hue ~= "red" then - minetest.register_craftitem("unifieddyes:light_" .. hue, { - description = S("Light " .. hue2 .. " Dye"), - inventory_image = "unifieddyes_light_" .. hue .. ".png", - groups = { dye=1, ["unicolor_light_"..hue]=1, not_in_creative_inventory=1 }, - on_use = unifieddyes.on_use - }) - end - minetest.register_alias("unifieddyes:"..hue, "dye:"..hue) - minetest.register_alias("unifieddyes:pigment_"..hue, "dye:"..hue) end minetest.register_alias("unifieddyes:light_red", "dye:pink") minetest.register_alias("unifieddyes:dark_green", "dye:dark_green") minetest.register_alias("unifieddyes:black", "dye:black") minetest.register_alias("unifieddyes:darkgrey", "dye:dark_grey") -minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey") +minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey") minetest.register_alias("unifieddyes:grey", "dye:grey") minetest.register_alias("unifieddyes:lightgrey", "dye:light_grey") -minetest.register_alias("unifieddyes:light_grey", "dye:light_grey") +minetest.register_alias("unifieddyes:light_grey", "dye:light_grey") minetest.register_alias("unifieddyes:white", "dye:white") +minetest.register_alias("unifieddyes:grey_0", "dye:black") +minetest.register_alias("unifieddyes:grey_4", "dye:dark_grey") +minetest.register_alias("unifieddyes:grey_8", "dye:grey") +minetest.register_alias("unifieddyes:grey_11", "dye:light_grey") +minetest.register_alias("unifieddyes:grey_15", "dye:white") + minetest.register_alias("unifieddyes:white_paint", "dye:white") minetest.register_alias("unifieddyes:titanium_dioxide", "dye:white") minetest.register_alias("unifieddyes:lightgrey_paint", "dye:light_grey") @@ -817,5 +941,13 @@ minetest.register_alias("unifieddyes:grey_paint", "dye:grey") minetest.register_alias("unifieddyes:darkgrey_paint", "dye:dark_grey") minetest.register_alias("unifieddyes:carbon_black", "dye:black") +-- aqua -> spring, skyblue -> azure, and redviolet -> rose aliases +-- note that technically, lime should be aliased, but can't be (there IS +-- lime in the new color table, it's just shifted up a bit) + +minetest.register_alias("unifieddyes:aqua", "unifieddyes:spring") +minetest.register_alias("unifieddyes:skyblue", "unifieddyes:azure") +minetest.register_alias("unifieddyes:redviolet", "unifieddyes:rose") + print(S("[UnifiedDyes] Loaded!")) diff --git a/unifieddyes/textures/unifieddyes_dye.png b/unifieddyes/textures/unifieddyes_dye.png new file mode 100644 index 0000000..ee792e5 Binary files /dev/null and b/unifieddyes/textures/unifieddyes_dye.png differ diff --git a/unifieddyes/textures/unifieddyes_palette_extended.png b/unifieddyes/textures/unifieddyes_palette_extended.png new file mode 100644 index 0000000..2ff0323 Binary files /dev/null and b/unifieddyes/textures/unifieddyes_palette_extended.png differ -- cgit v1.2.3