diff --git a/build-date b/build-date index b412a4f0..c5ec98b1 100644 --- a/build-date +++ b/build-date @@ -1 +1 @@ -20210325-1929 +20210326-2343 diff --git a/mods/homedecor_common/nodeboxes.lua b/mods/homedecor_common/nodeboxes.lua index 0fafe1ab..6960072b 100644 --- a/mods/homedecor_common/nodeboxes.lua +++ b/mods/homedecor_common/nodeboxes.lua @@ -9,16 +9,17 @@ homedecor.box = { -- bottom slab (starting from -y) with height optionally shifted upwards slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end, -- slab starting from -z (+z with negative depth) - slab_z = function(depth) + slab_z = function(depth, shift) -- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth, -- but since conventionally a lot of nodes place slabs against +z for player convenience, we define -- a "negative" depth as a depth extending from the other side, i.e. +z + local s = shift or 0 if depth > 0 then -- slab starting from -z - return { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5+depth } + return { -0.5, -0.5, -0.5+s, 0.5, 0.5, -0.5+depth+s } else -- slab starting from +z (z1=0.5-(-depth)) - return { -0.5, -0.5, 0.5+depth, 0.5, 0.5, 0.5 } + return { -0.5, -0.5, 0.5+depth+s, 0.5, 0.5, 0.5+s } end end, bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end, diff --git a/mods/homedecor_furniture/init.lua b/mods/homedecor_furniture/init.lua index 5c317ddb..bcb9dea4 100644 --- a/mods/homedecor_furniture/init.lua +++ b/mods/homedecor_furniture/init.lua @@ -1,38 +1,5 @@ local S = minetest.get_translator("homedecor_furniture") -local table_colors = { - { "", S("Table"), homedecor.plain_wood }, - { "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood }, - { "_white", S("White Table"), homedecor.white_wood } -} - -for _, t in ipairs(table_colors) do - local suffix, desc, texture = unpack(t) - - homedecor.register("table"..suffix, { - description = desc, - tiles = { texture }, - node_box = { - type = "fixed", - fixed = { - { -0.4, -0.5, -0.4, -0.3, 0.4, -0.3 }, - { 0.3, -0.5, -0.4, 0.4, 0.4, -0.3 }, - { -0.4, -0.5, 0.3, -0.3, 0.4, 0.4 }, - { 0.3, -0.5, 0.3, 0.4, 0.4, 0.4 }, - { -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 }, - { -0.4, -0.2, -0.3, -0.3, -0.1, 0.3 }, - { 0.3, -0.2, -0.4, 0.4, -0.1, 0.3 }, - { -0.3, -0.2, -0.4, 0.4, -0.1, -0.3 }, - { -0.3, -0.2, 0.3, 0.3, -0.1, 0.4 }, - }, - }, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - }) -end - - - local ob_cbox = { type = "fixed", fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0.5 } @@ -69,224 +36,3 @@ homedecor.register("wall_shelf", { } } }) - --- Crafts - - -minetest.register_craft({ - output = "homedecor:table", - recipe = { - { "group:wood","group:wood", "group:wood" }, - { "group:stick", "", "group:stick" }, - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "homedecor:table_mahogany", - recipe = { - "homedecor:table", - "dye:brown", - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "homedecor:table_mahogany", - recipe = { - "homedecor:table", - "unifieddyes:dark_orange", - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "homedecor:table_white", - recipe = { - "homedecor:table", - "dye:white", - }, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "homedecor:table", - burntime = 30, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "homedecor:table_mahogany", - burntime = 30, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "homedecor:table_white", - burntime = 30, -}) - -minetest.register_craft({ - output = "homedecor:standing_lamp_off", - recipe = { - {"homedecor:table_lamp_off"}, - {"group:stick"}, - {"group:stick"}, - }, -}) - -unifieddyes.register_color_craft({ - output = "homedecor:standing_lamp_off", - palette = "extended", - type = "shapeless", - neutral_node = "homedecor:standing_lamp_off", - recipe = { - "NEUTRAL_NODE", - "MAIN_DYE" - } -}) - -minetest.register_craft({ - type = "fuel", - recipe = "homedecor:table_lamp_off", - burntime = 10, -}) - -minetest.register_craft({ - output = "homedecor:table_lamp_off", - recipe = { - { "wool:white", "default:torch", "wool:white"}, - { "", "group:stick", ""}, - { "", "stairs:slab_wood", "" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:table_lamp_off", - recipe = { - { "cottages:wool", "default:torch", "cottages:wool"}, - { "", "group:stick", ""}, - { "", "stairs:slab_wood", "" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:table_lamp_off", - recipe = { - { "wool:white", "default:torch", "wool:white"}, - { "", "group:stick", ""}, - { "", "moreblocks:slab_wood", "" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:table_lamp_off", - recipe = { - { "cottages:wool", "default:torch", "cottages:wool"}, - { "", "group:stick", ""}, - { "", "moreblocks:slab_wood", "" }, - }, -}) - -unifieddyes.register_color_craft({ - output = "homedecor:table_lamp_off", - palette = "extended", - type = "shapeless", - neutral_node = "homedecor:table_lamp_off", - recipe = { - "NEUTRAL_NODE", - "MAIN_DYE" - } -}) - -minetest.register_craft({ - output = "homedecor:toilet", - recipe = { - { "","","bucket:bucket_water"}, - { "group:marble","group:marble", "group:marble" }, - { "", "bucket:bucket_empty", "" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:sink", - recipe = { - { "group:marble","bucket:bucket_empty", "group:marble" }, - { "", "group:marble", "" } - }, -}) - -minetest.register_craft({ - output = "homedecor:taps", - recipe = { - { "default:steel_ingot","bucket:bucket_water", "default:steel_ingot" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:taps_brass", - recipe = { - { "technic:brass_ingot","bucket:bucket_water", "technic:brass_ingot" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:shower_tray", - recipe = { - { "group:marble","bucket:bucket_empty", "group:marble" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:shower_head", - recipe = { - {"default:steel_ingot", "bucket:bucket_water"}, - }, -}) - -minetest.register_craft({ - output = "homedecor:bathtub_clawfoot_brass_taps", - recipe = { - { "homedecor:taps_brass", "", "" }, - { "group:marble", "", "group:marble" }, - {"default:steel_ingot", "group:marble", "default:steel_ingot"}, - }, -}) - -minetest.register_craft({ - output = "homedecor:bathtub_clawfoot_chrome_taps", - recipe = { - { "homedecor:taps", "", "" }, - { "group:marble", "", "group:marble" }, - {"default:steel_ingot", "group:marble", "default:steel_ingot"}, - }, -}) - -minetest.register_craft({ - output = "homedecor:bars 6", - recipe = { - { "default:steel_ingot","default:steel_ingot","default:steel_ingot" }, - { "homedecor:pole_wrought_iron","homedecor:pole_wrought_iron","homedecor:pole_wrought_iron" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:L_binding_bars 3", - recipe = { - { "homedecor:bars","" }, - { "homedecor:bars","homedecor:bars" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:torch_wall 10", - recipe = { - { "default:coal_lump" }, - { "default:steel_ingot" }, - }, -}) - --- Aliases for 3dforniture mod. - -minetest.register_alias("3dforniture:table", "homedecor:table") -minetest.register_alias('table', 'homedecor:table') diff --git a/mods/homedecor_furniture_medieval/init.lua b/mods/homedecor_furniture_medieval/init.lua index efb331f0..7db474ac 100644 --- a/mods/homedecor_furniture_medieval/init.lua +++ b/mods/homedecor_furniture_medieval/init.lua @@ -57,6 +57,24 @@ homedecor.register("chains", { sounds = default.node_sound_stone_defaults(), }) +-- Crafts + +minetest.register_craft({ + output = "homedecor:bars 6", + recipe = { + { "default:steel_ingot","default:steel_ingot","default:steel_ingot" }, + { "homedecor:pole_wrought_iron","homedecor:pole_wrought_iron","homedecor:pole_wrought_iron" }, + }, +}) + +minetest.register_craft({ + output = "homedecor:L_binding_bars 3", + recipe = { + { "homedecor:bars","" }, + { "homedecor:bars","homedecor:bars" }, + }, +}) + minetest.register_alias("3dforniture:bars", "homedecor:bars") minetest.register_alias("3dforniture:L_binding_bars", "homedecor:L_binding_bars") minetest.register_alias("3dforniture:chains", "homedecor:chains") diff --git a/mods/homedecor_kitchen/init.lua b/mods/homedecor_kitchen/init.lua index 7197b8a6..d4d7303c 100644 --- a/mods/homedecor_kitchen/init.lua +++ b/mods/homedecor_kitchen/init.lua @@ -137,13 +137,20 @@ homedecor.register("dishwasher_"..m, { end local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png" -local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)" - .."^(homedecor_kitchen_cabinet_bevel.png^[colorize:#46321580)" +local cabinet_sides_colored = "(homedecor_generic_wood_plain.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png" + +local ic_cabinet_sides = string.gsub(cabinet_sides, "%^", "&") +local ic_cabinet_sides_colored = string.gsub(cabinet_sides_colored, "%^", "&") + +local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)^homedecor_kitchen_cabinet_bevel.png" +local cabinet_bottom_colored = "homedecor_generic_wood_plain.png^homedecor_kitchen_cabinet_bevel.png" local function N_(x) return x end local counter_materials = { "", N_("granite"), N_("marble"), N_("steel") } +homedecor.kitchen_convert_nodes = {} + for _, mat in ipairs(counter_materials) do local desc = S("Kitchen Cabinet") @@ -151,29 +158,138 @@ for _, mat in ipairs(counter_materials) do if mat ~= "" then desc = S("Kitchen Cabinet (@1 top)", S(mat)) + desc2 = S("Kitchen Cabinet with drawers (@1 top)", S(mat)) material = "_"..mat end - homedecor.register("kitchen_cabinet"..material, { + homedecor.register("kitchen_cabinet_colorable"..material, { description = desc, - tiles = { 'homedecor_kitchen_cabinet_top'..material..'.png', - cabinet_bottom, - cabinet_sides, - cabinet_sides, - cabinet_sides, - 'homedecor_kitchen_cabinet_front.png'}, - groups = { snappy = 3 }, + tiles = { + 'homedecor_kitchen_cabinet_top'..material..'.png', + cabinet_bottom, + cabinet_sides, + cabinet_sides, + cabinet_sides, + 'homedecor_kitchen_cabinet_front.png^homedecor_kitchen_cabinet_bevel.png' + }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_cabinet_top"..material..".png" + .."{homedecor_kitchen_cabinet_front.png" + .."{"..ic_cabinet_sides, + mesh = "homedecor_kitchen_cabinet.obj", + paramtype2 = "wallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + airbrush_replacement_node = "homedecor:kitchen_cabinet_colored"..material, + place_param2 = 0, + groups = { snappy = 3, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), infotext=S("Kitchen Cabinet"), inventory = { size=24, lockable=true, }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end }) + + homedecor.register("kitchen_cabinet_colored"..material, { + description = desc, + tiles = { + {name = 'homedecor_kitchen_cabinet_top'..material..'.png', color = 0xFFFFFFFF}, + {name = cabinet_bottom, color = 0xFFFFFFFF }, + cabinet_sides_colored, + cabinet_sides_colored, + cabinet_sides_colored, + 'homedecor_kitchen_cabinet_colored_front.png^homedecor_kitchen_cabinet_bevel.png' + }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_cabinet_top"..material..".png" + .."{homedecor_kitchen_cabinet_front.png" + .."{"..ic_cabinet_sides_colored, + mesh = "homedecor_kitchen_cabinet.obj", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 }, + sounds = default.node_sound_wood_defaults(), + infotext=S("Kitchen Cabinet"), + inventory = { + size=24, + lockable=true, + }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end + }) + + homedecor.register("kitchen_cabinet_colorable_with_drawers"..material, { + description = desc2, + tiles = { + 'homedecor_kitchen_cabinet_top'..material..'.png', + cabinet_bottom, + cabinet_sides, + cabinet_sides, + cabinet_sides, + 'homedecor_kitchen_cabinet_front_with_drawers.png^homedecor_kitchen_cabinet_bevel.png' + }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_cabinet_top"..material..".png" + .."{homedecor_kitchen_cabinet_front_with_drawers.png" + .."{"..ic_cabinet_sides, + mesh = "homedecor_kitchen_cabinet.obj", + paramtype2 = "wallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_with_drawers"..material, + place_param2 = 0, + groups = { snappy = 3, ud_param2_colorable = 1}, + sounds = default.node_sound_wood_defaults(), + infotext=S("Kitchen Cabinet with drawers"), + inventory = { + size=24, + lockable=true, + }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end + }) + + homedecor.register("kitchen_cabinet_colored_with_drawers"..material, { + description = desc2, + tiles = { + {name = 'homedecor_kitchen_cabinet_top'..material..'.png', color = 0xFFFFFFFF}, + {name = cabinet_bottom, color = 0xFFFFFFFF }, + cabinet_sides_colored, + cabinet_sides_colored, + cabinet_sides_colored, + 'homedecor_kitchen_cabinet_colored_front_with_drawers.png^homedecor_kitchen_cabinet_bevel.png' + }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_cabinet_top"..material..".png" + .."{homedecor_kitchen_cabinet_colored_front_with_drawers.png" + .."{"..ic_cabinet_sides_colored, + mesh = "homedecor_kitchen_cabinet.obj", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 }, + sounds = default.node_sound_wood_defaults(), + infotext=S("Kitchen Cabinet with drawers"), + inventory = { + size=24, + lockable=true, + }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end + }) + + homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet"..material + homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_locked"..material + end -local kitchen_cabinet_half_box = homedecor.nodebox.slab_y(0.5, 0.5) -homedecor.register("kitchen_cabinet_half", { +local kitchen_cabinet_half_box = homedecor.nodebox.slab_z(0.5, 0.5) + +homedecor.register("kitchen_cabinet_colorable_half", { description = S('Half-height Kitchen Cabinet (on ceiling)'), tiles = { cabinet_sides, @@ -181,29 +297,77 @@ homedecor.register("kitchen_cabinet_half", { cabinet_sides, cabinet_sides, cabinet_sides, - 'homedecor_kitchen_cabinet_front_half.png' + 'homedecor_kitchen_cabinet_front_half.png^homedecor_kitchen_cabinet_half_bevel.png' }, + mesh = "homedecor_kitchen_cabinet_half.obj", + paramtype2 = "wallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_half", + place_param2 = 0, selection_box = kitchen_cabinet_half_box, node_box = kitchen_cabinet_half_box, - groups = { snappy = 3 }, + groups = { snappy = 3, ud_param2_colorable = 1 }, sounds = default.node_sound_wood_defaults(), infotext=S("Kitchen Cabinet"), inventory = { size=12, lockable=true, }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end }) -homedecor.register("kitchen_cabinet_with_sink", { +homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_half" +homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_half_locked" + +homedecor.register("kitchen_cabinet_colored_half", { + description = S('Half-height Kitchen Cabinet (on ceiling)'), + tiles = { + { name = cabinet_sides, color = 0xFFFFFFFF }, + cabinet_bottom_colored, + cabinet_sides_colored, + cabinet_sides_colored, + cabinet_sides_colored, + 'homedecor_kitchen_cabinet_colored_front_half.png^homedecor_kitchen_cabinet_half_bevel.png' + }, + mesh = "homedecor_kitchen_cabinet_half.obj", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + selection_box = kitchen_cabinet_half_box, + node_box = kitchen_cabinet_half_box, + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 }, + sounds = default.node_sound_wood_defaults(), + infotext=S("Kitchen Cabinet"), + inventory = { + size=12, + lockable=true, + }, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end +}) + +homedecor.register("kitchen_cabinet_colorable_with_sink", { description = S("Kitchen Cabinet with sink"), mesh = "homedecor_kitchen_sink.obj", tiles = { "homedecor_kitchen_sink_top.png", - "homedecor_kitchen_cabinet_front.png", + cabinet_bottom, cabinet_sides, - cabinet_bottom + cabinet_sides, + cabinet_sides, + "homedecor_kitchen_cabinet_front.png^homedecor_kitchen_cabinet_bevel.png" }, - groups = { snappy = 3 }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_sink_top.png" + .."{homedecor_kitchen_cabinet_front.png" + .."{"..ic_cabinet_sides, + paramtype2 = "wallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_with_sink", + place_param2 = 0, + groups = { snappy = 3, ud_param2_colorable = 1 }, sounds = default.node_sound_wood_defaults(), infotext=S("Under-sink cabinet"), inventory = { @@ -222,6 +386,54 @@ homedecor.register("kitchen_cabinet_with_sink", { }, on_destruct = function(pos) homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z}) + end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + end +}) + +homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_with_sink" +homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_with_sink_locked" + +homedecor.register("kitchen_cabinet_colored_with_sink", { + description = S("Kitchen Cabinet with sink"), + mesh = "homedecor_kitchen_sink.obj", + tiles = { + { name = "homedecor_kitchen_sink_top.png", color = 0xFFFFFFFF }, + { name = cabinet_bottom, color = 0xFFFFFFFF}, + cabinet_sides_colored, + cabinet_sides_colored, + cabinet_sides_colored, + "homedecor_kitchen_cabinet_colored_front.png^homedecor_kitchen_cabinet_bevel.png", + }, + inventory_image = "[inventorycube" + .."{homedecor_kitchen_sink_top.png" + .."{homedecor_kitchen_cabinet_front.png" + .."{"..ic_cabinet_sides_colored, + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 }, + sounds = default.node_sound_wood_defaults(), + infotext=S("Under-sink cabinet"), + inventory = { + size=16, + lockable=true, + }, + node_box = { + type = "fixed", + fixed = { + { -8/16, -8/16, -8/16, 8/16, 6/16, 8/16 }, + { -8/16, 6/16, -8/16, -6/16, 8/16, 8/16 }, + { 6/16, 6/16, -8/16, 8/16, 8/16, 8/16 }, + { -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 }, + { -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, + } + }, + on_destruct = function(pos) + homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z}) + end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) end }) @@ -555,3 +767,29 @@ minetest.register_craft({ { "homedecor:toilet_paper", "homedecor:toilet_paper" } }, }) + +minetest.register_lbm({ + name = ":homedecor:convert_kitchen_cabinets", + label = "Convert homedecor kitchen cabinets to use [color]wallmounted", + run_at_every_load = false, + nodenames = homedecor.kitchen_convert_nodes, + action = function(pos, node) + local name = node.name + local newname = string.gsub(name, "_cabinet", "_cabinet_colorable") + + local old_fdir = math.floor(node.param2 % 32) + local new_fdir = 3 + + if old_fdir == 0 then + new_fdir = 3 + elseif old_fdir == 1 then + new_fdir = 4 + elseif old_fdir == 2 then + new_fdir = 2 + elseif old_fdir == 3 then + new_fdir = 5 + end + + minetest.swap_node(pos, { name = newname, param2 = new_fdir }) + end +}) diff --git a/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet.obj b/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet.obj new file mode 100644 index 00000000..86f0be0b --- /dev/null +++ b/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet.obj @@ -0,0 +1,50 @@ +# Blender v2.83.5 OBJ File: 'kitchen_cabinet.blend' +# www.blender.org +o Cube_Cube.001 +v 0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vn 0.0000 0.0000 1.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 -1.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 1.0000 0.0000 0.0000 +g Cube_Cube.001_top +s off +f 8/1/1 4/2/1 2/3/1 6/4/1 +g Cube_Cube.001_bottom +f 7/5/2 5/6/2 1/7/2 3/8/2 +g Cube_Cube.001_right +f 5/9/3 7/5/3 8/1/3 6/10/3 +g Cube_Cube.001_left +f 4/2/4 3/8/4 1/11/4 2/12/4 +g Cube_Cube.001_back +f 7/13/5 3/14/5 4/15/5 8/16/5 +g Cube_Cube.001_front +f 6/17/6 2/18/6 1/19/6 5/20/6 diff --git a/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet_half.obj b/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet_half.obj new file mode 100644 index 00000000..39c0b0e4 --- /dev/null +++ b/mods/homedecor_kitchen/models/homedecor_kitchen_cabinet_half.obj @@ -0,0 +1,52 @@ +# Blender v2.83.5 OBJ File: 'kitchen_cabinet_half.blend' +# www.blender.org +o Cube_Cube.001 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.000000 +v -0.500000 -0.500000 0.500000 +v 0.500000 0.500000 -0.000000 +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 -0.000000 +v -0.500000 0.500000 0.500000 +v 0.500000 -0.500000 0.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt -0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.500000 +vt 1.000000 0.500000 +vn 0.0000 0.0000 1.0000 +vn 0.0000 -0.0000 -1.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 -1.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 1.0000 -0.0000 0.0000 +g Cube_Cube.001_top +s off +f 1/1/1 5/2/1 7/3/1 3/4/1 +g Cube_Cube.001_bottom +f 2/5/2 6/6/2 4/7/2 8/8/2 +g Cube_Cube.001_right +f 7/3/3 5/9/3 4/10/3 6/11/3 +g Cube_Cube.001_left +f 1/12/4 3/4/4 2/13/4 8/14/4 +g Cube_Cube.001_back +f 3/15/5 7/16/5 6/17/5 2/18/5 +g Cube_Cube.001_front +f 5/19/6 1/20/6 8/21/6 4/22/6 diff --git a/mods/homedecor_kitchen/models/homedecor_kitchen_sink.obj b/mods/homedecor_kitchen/models/homedecor_kitchen_sink.obj index 832fae10..bb80812d 100644 --- a/mods/homedecor_kitchen/models/homedecor_kitchen_sink.obj +++ b/mods/homedecor_kitchen/models/homedecor_kitchen_sink.obj @@ -1,101 +1,166 @@ -v -0.5 -0.5 -0.5 -v 0.5 -0.5 -0.5 -v 0.5 -0.5 0.5 -v -0.5 -0.5 0.5 -v -0.5 0.5 0.5 -v -0.5 0.5 -0.5 -v 0.5 0.5 -0.5 -v 0.5 0.5 0.5 -v -0.387 0.5 0.388 -v -0.387 0.5 -0.387 -v 0.388 0.5 -0.387 -v 0.388 0.5 0.388 -v -0.387 0.4 0.388 -v -0.387 0.4 -0.387 -v 0.388 0.4 -0.387 -v 0.388 0.4 0.388 -v 0.063 0.4 -0.062 -v 0.063 0.4 0.063 -v -0.062 0.4 -0.062 -v -0.062 0.4 0.063 -v 0.063 0.313 0.063 -v 0.063 0.313 -0.062 -v -0.062 0.313 0.063 -v -0.062 0.313 -0.062 -vt 0.469 0.906 -vt 0.469 0.531 -vt 0.531 0.469 -vt 0.531 0.969 -vt 0.031 0.969 -vt 0.094 0.906 -vt 0.031 0.469 -vt 0.094 0.531 -vt 0.813 0.5 -vt 0.813 0.938 -vt 0.781 0.938 -vt 0.781 0.5 -vt 0.688 0.5 -vt 0.719 0.5 -vt 0.719 0.938 -vt 0.688 0.938 -vt 0.906 0.5 -vt 0.906 0.938 -vt 0.875 0.938 -vt 0.875 0.5 -vt 0.594 0.5 -vt 0.625 0.5 -vt 0.625 0.938 -vt 0.594 0.938 -vt 0.313 0.75 -vt 0.313 0.688 -vt 0.25 0.688 -vt 0.25 0.75 -vt 0.219 0.375 -vt 0.219 0.313 -vt 0.25 0.313 -vt 0.25 0.375 -vt 0.25 0.406 -vt 0.313 0.375 -vt 0.313 0.406 -vt 0.313 0.313 -vt 0.344 0.313 -vt 0.344 0.375 -vt 0.25 0.281 -vt 0.313 0.281 -vt 0 0 -vt 1 0 -vt 1 1 -vt 0 1 -vn 0 1 0 -vn -1 0 0 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn 0 -1 0 -g 1 +# Blender v2.83.5 OBJ File: 'kitchen_sink.blend' +# www.blender.org +o Cube_Cube.001 +v 0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.000000 -0.500000 0.500000 +v 0.000000 0.500000 0.500000 +v 0.000000 0.062500 0.437500 +v -0.062500 0.062500 0.375000 +v 0.062500 0.062500 0.375000 +v 0.062500 -0.062500 0.437500 +v 0.000000 -0.062500 0.437500 +v 0.062500 -0.062500 0.375000 +v -0.062500 -0.062500 0.437500 +v -0.062500 0.062500 0.437500 +v -0.062500 -0.062500 0.375000 +v 0.000000 0.375000 0.437500 +v 0.062500 0.062500 0.437500 +v 0.000000 -0.375000 0.437500 +v -0.375000 -0.375000 0.437500 +v -0.375000 0.375000 0.500000 +v -0.375000 0.375000 0.437500 +v 0.375000 0.375000 0.437500 +v 0.000000 0.375000 0.500000 +v 0.375000 0.375000 0.500000 +v 0.000000 -0.375000 0.500000 +v 0.375000 -0.375000 0.500000 +v 0.375000 -0.375000 0.437500 +v -0.375000 -0.375000 0.500000 +vt 0.437500 0.375000 +vt 0.562500 0.437500 +vt 0.437500 0.437500 +vt 0.125000 0.875000 +vt 0.875000 0.875000 +vt 1.000000 1.000000 +vt 0.625000 0.500000 +vt 0.625000 0.562500 +vt 0.562500 0.562500 +vt 0.875000 0.062500 +vt 0.125000 0.125000 +vt 0.125000 0.062500 +vt 0.875000 0.875000 +vt 0.437500 0.562500 +vt 0.562500 0.562500 +vt 0.875000 0.125000 +vt 0.125000 0.125000 +vt 0.000000 0.000000 +vt 0.375000 0.500000 +vt 0.375000 0.437500 +vt 0.437500 0.625000 +vt 0.437500 0.562500 +vt 0.875000 0.500000 +vt 0.875000 0.125000 +vt 0.937500 0.500000 +vt 0.125000 0.500000 +vt 0.125000 0.875000 +vt 0.062500 0.875000 +vt 0.562500 0.437500 +vt 0.437500 0.437500 +vt 0.125000 0.937500 +vt 0.875000 0.937500 +vt 0.937500 0.125000 +vt 0.937500 0.875000 +vt 0.062500 0.500000 +vt 0.062500 0.125000 +vt 0.562500 0.375000 +vt 0.625000 0.437500 +vt 0.375000 0.562500 +vt 0.562500 0.625000 +vt 0.562500 0.500000 +vt 0.437500 0.500000 +vt 0.000000 1.000000 +vt 0.000000 0.500000 +vt 0.125000 0.500000 +vt 0.875000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.500000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 0.500000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 1.0000 +vn -0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 -0.0000 +vn 1.0000 0.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +g Cube_Cube.001_top s off -f 9/1/1 10/2/1 6/3/1 5/4/1 -f 5/4/1 8/5/1 12/6/1 9/1/1 -f 7/7/1 6/3/1 10/2/1 11/8/1 -f 8/5/1 7/7/1 11/8/1 12/6/1 -f 15/9/2 16/10/2 12/11/2 11/12/2 -f 16/13/3 13/14/3 9/15/3 12/16/3 -f 13/17/4 14/18/4 10/19/4 9/20/4 -f 14/21/5 15/22/5 11/23/5 10/24/5 -f 13/2/1 16/1/1 18/25/1 20/26/1 -f 19/27/1 14/8/1 13/2/1 20/26/1 -f 17/28/1 15/6/1 14/8/1 19/27/1 -f 16/1/1 15/6/1 17/28/1 18/25/1 -f 17/29/2 22/30/2 21/31/2 18/32/2 -f 18/33/3 21/32/3 23/34/3 20/35/3 -f 20/34/4 23/36/4 24/37/4 19/38/4 -f 19/31/5 24/39/5 22/40/5 17/36/5 -f 24/27/1 23/26/1 21/25/1 22/28/1 -g 2 -f 2/41/3 1/42/3 6/43/3 7/44/3 -g 3 -f 1/41/2 4/42/2 5/43/2 6/44/2 -f 2/42/4 7/43/4 8/44/4 3/41/4 -f 4/41/5 3/42/5 8/43/5 5/44/5 -g 4 -f 1/43/6 2/44/6 3/41/6 4/42/6 +f 14/1/1 13/2/1 16/3/1 +f 32/4/2 24/5/2 8/6/2 +f 11/7/3 18/8/3 12/9/3 +f 28/10/1 31/11/1 30/12/1 +f 25/13/2 17/14/2 18/15/2 +f 28/16/2 30/17/2 2/18/2 +f 15/19/4 14/20/4 16/3/4 +f 12/9/5 17/21/5 19/22/5 +f 20/23/3 26/24/3 27/25/3 +f 22/26/4 23/27/4 32/28/4 +f 26/24/2 21/29/2 14/30/2 +f 32/31/5 25/13/5 24/32/5 +f 12/9/2 19/22/2 16/3/2 13/2/2 +f 28/10/1 26/24/1 31/11/1 +f 26/24/3 28/33/3 27/25/3 +f 27/25/3 24/34/3 20/23/3 +f 24/34/3 25/13/3 20/23/3 +f 32/28/4 29/35/4 22/26/4 +f 29/35/4 30/36/4 22/26/4 +f 30/36/4 31/11/4 22/26/4 +f 32/31/5 23/27/5 25/13/5 +f 14/1/1 21/37/1 13/2/1 +f 12/9/3 13/2/3 11/7/3 +f 13/2/3 21/38/3 11/7/3 +f 16/3/4 19/22/4 15/19/4 +f 19/22/4 17/39/4 15/19/4 +f 12/9/5 18/40/5 17/21/5 +f 11/41/2 20/23/2 18/15/2 +f 20/23/2 25/13/2 18/15/2 +f 25/13/2 23/27/2 17/14/2 +f 23/27/2 22/26/2 17/14/2 +f 22/26/2 15/42/2 17/14/2 +f 14/30/2 15/42/2 22/26/2 +f 22/26/2 31/11/2 14/30/2 +f 31/11/2 26/24/2 14/30/2 +f 26/24/2 20/23/2 21/29/2 +f 20/23/2 11/41/2 21/29/2 +f 4/43/2 9/44/2 32/4/2 +f 9/44/2 29/45/2 32/4/2 +f 27/46/2 10/47/2 24/5/2 +f 10/47/2 8/6/2 24/5/2 +f 4/43/2 32/4/2 8/6/2 +f 6/48/2 10/47/2 28/16/2 +f 10/47/2 27/46/2 28/16/2 +f 29/45/2 9/44/2 30/17/2 +f 9/44/2 2/18/2 30/17/2 +f 6/48/2 28/16/2 2/18/2 +g Cube_Cube.001_bottom +f 5/49/6 1/50/6 3/51/6 7/52/6 +g Cube_Cube.001_right +f 8/6/4 10/53/4 6/54/4 5/55/4 7/52/4 +g Cube_Cube.001_left +f 9/56/3 4/43/3 3/51/3 1/57/3 2/58/3 +g Cube_Cube.001_back +f 7/59/1 3/60/1 4/61/1 8/62/1 +g Cube_Cube.001_front +f 1/63/5 5/64/5 6/65/5 2/66/5 diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_bevel.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_bevel.png index 137eb3ee..ad6dac3f 100644 Binary files a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_bevel.png and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_bevel.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front.png new file mode 100644 index 00000000..382026f3 Binary files /dev/null and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_half.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_half.png new file mode 100644 index 00000000..0c180fa5 Binary files /dev/null and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_half.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_with_drawers.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_with_drawers.png new file mode 100644 index 00000000..c367510a Binary files /dev/null and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_colored_front_with_drawers.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front.png index 406739f8..8f66ff64 100644 Binary files a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front.png and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_half.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_half.png index 2e6a60ca..d5d8e31b 100644 Binary files a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_half.png and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_half.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_with_drawers.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_with_drawers.png new file mode 100644 index 00000000..510243b2 Binary files /dev/null and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_front_with_drawers.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_half_bevel.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_half_bevel.png new file mode 100644 index 00000000..1c12493c Binary files /dev/null and b/mods/homedecor_kitchen/textures/homedecor_kitchen_cabinet_half_bevel.png differ diff --git a/mods/homedecor_kitchen/textures/homedecor_kitchen_sink_top.png b/mods/homedecor_kitchen/textures/homedecor_kitchen_sink_top.png index fc70835c..ccb117ea 100644 Binary files a/mods/homedecor_kitchen/textures/homedecor_kitchen_sink_top.png and b/mods/homedecor_kitchen/textures/homedecor_kitchen_sink_top.png differ diff --git a/mods/homedecor_lighting/init.lua b/mods/homedecor_lighting/init.lua index ab473868..6d7ba80f 100644 --- a/mods/homedecor_lighting/init.lua +++ b/mods/homedecor_lighting/init.lua @@ -1789,6 +1789,14 @@ unifieddyes.register_color_craft({ } }) + +minetest.register_craft({ + output = "homedecor:torch_wall 10", + recipe = { + { "default:coal_lump" }, + { "default:steel_ingot" }, + }, +}) -- aliases minetest.register_alias("chains:chain_top", "homedecor:chain_steel_top") diff --git a/mods/homedecor_tables/misc.lua b/mods/homedecor_tables/misc.lua index 51fb3993..de062240 100644 --- a/mods/homedecor_tables/misc.lua +++ b/mods/homedecor_tables/misc.lua @@ -2,25 +2,58 @@ local S = minetest.get_translator("homedecor_tables") -local materials = { +-- Various kinds of table legs + +local table_shapes = {"large_square", "small_square", "small_round"} + +local tabletop_materials = { { "glass", - S("Small square glass table"), - S("Small round glass table"), - S("Large glass table piece"), + S("Small square glass tabletop"), + S("Small round glass tabletop"), + S("Large glass tabletop piece"), }, { "wood", - S("Small square wooden table"), - S("Small round wooden table"), - S("Large wooden table piece"), + S("Small square wooden tabletop"), + S("Small round wooden tabletop"), + S("Large wooden tabletop piece"), } } +leg_materials = { + { "brass", S("brass") }, + { "wrought_iron", S("wrought iron") }, + { "wood", S("wood") } +} + +for _, t in ipairs(leg_materials) do + local name, desc = unpack(t) + homedecor.register("table_legs_"..name, { + description = S("Table Legs (@1)", desc), + drawtype = "plantlike", + tiles = {"homedecor_table_legs_"..name..".png"}, + inventory_image = "homedecor_table_legs_"..name..".png", + wield_image = "homedecor_table_legs_"..name..".png", + walkable = false, + groups = {snappy=3}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } + }, + }) +end + +minetest.register_alias("homedecor:utility_table_legs", "homedecor:table_legs_wood") +minetest.register_alias("homedecor:utility_table_top", "homedecor:wood_table_small_square") + +-- table tops and combined tables + local tables_cbox = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, } -for i, mat in ipairs(materials) do +for i, mat in ipairs(tabletop_materials) do local m, small_s, small_r, large = unpack(mat) local s @@ -30,179 +63,102 @@ for i, mat in ipairs(materials) do s = default.node_sound_wood_defaults() end --- small square tables + for _, shape in ipairs(table_shapes) do - homedecor.register(m.."_table_small_square", { - description = small_s, - mesh = "homedecor_table_small_square.obj", - tiles = { 'homedecor_'..m..'_table_small_square.png' }, - wield_image = 'homedecor_'..m..'_table_small_square_inv.png', - inventory_image = 'homedecor_'..m..'_table_small_square_inv.png', - groups = { snappy = 3 }, - sounds = s, - selection_box = tables_cbox, - collision_box = tables_cbox, - on_place = minetest.rotate_node - }) + homedecor.register(m.."_table_"..shape, { + description = shape.." "..m.." tabletop", + mesh = "homedecor_table_"..shape..".obj", + tiles = { + 'homedecor_'..m..'_table_'..shape..'.png', + 'homedecor_'..m..'_table_edges.png', + 'homedecor_blanktile.png', + 'homedecor_blanktile.png', + 'homedecor_blanktile.png', + }, + wield_image = 'homedecor_'..m..'_table_'..shape..'_inv.png', + groups = { snappy = 3 }, + sounds = s, + selection_box = tables_cbox, + collision_box = tables_cbox, + on_place = function(itemstack, placer, pointed_thing) + local player_name = placer:get_player_name() + if minetest.is_protected(pointed_thing.under, player_name) then return end + local node = minetest.get_node(pointed_thing.under) + if string.find(node.name, "homedecor:table_legs") then + local newname = string.format("homedecor:%s_table_%s_with_%s_legs", + m, shape, string.sub(node.name, 22)) + minetest.set_node(pointed_thing.under, {name = newname}) + if not creative.is_enabled_for(player_name) then + itemstack:take_item() + return itemstack + end + else + return minetest.rotate_node(itemstack, placer, pointed_thing) + end + end + }) --- small round tables + for _, l in ipairs(leg_materials) do + local leg_mat, desc = unpack(l) - homedecor.register(m..'_table_small_round', { - description = small_r, - mesh = "homedecor_table_small_round.obj", - tiles = { "homedecor_"..m.."_table_small_round.png" }, - wield_image = 'homedecor_'..m..'_table_small_round_inv.png', - inventory_image = 'homedecor_'..m..'_table_small_round_inv.png', - groups = { snappy = 3 }, - sounds = s, - selection_box = tables_cbox, - collision_box = tables_cbox, - on_place = minetest.rotate_node - }) - --- Large square table pieces - - homedecor.register(m..'_table_large', { - description = large, - tiles = { - 'homedecor_'..m..'_table_large_tb.png', - 'homedecor_'..m..'_table_large_tb.png', - 'homedecor_'..m..'_table_large_edges.png', - 'homedecor_'..m..'_table_large_edges.png', - 'homedecor_'..m..'_table_large_edges.png', - 'homedecor_'..m..'_table_large_edges.png' - }, - wield_image = 'homedecor_'..m..'_table_large_inv.png', - inventory_image = 'homedecor_'..m..'_table_large_inv.png', - groups = { snappy = 3 }, - sounds = s, - node_box = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, - }, - selection_box = tables_cbox, - on_place = minetest.rotate_node - }) + homedecor.register(string.format("%s_table_%s_with_%s_legs", m, shape, leg_mat), { + description = string.format("%s %s table with %s legs", shape, m, leg_mat), + mesh = "homedecor_table_"..shape..".obj", + tiles = { + 'homedecor_blanktile.png', + 'homedecor_blanktile.png', + 'homedecor_'..m..'_table_'..shape..'.png', + 'homedecor_'..m..'_table_edges.png', + "homedecor_table_legs_"..leg_mat..".png", + }, + groups = { snappy = 3 }, + sounds = s, + }) + end + end minetest.register_alias('homedecor:'..m..'_table_large_b', 'homedecor:'..m..'_table_large') minetest.register_alias('homedecor:'..m..'_table_small_square_b', 'homedecor:'..m..'_table_small_square') minetest.register_alias('homedecor:'..m..'_table_small_round_b', 'homedecor:'..m..'_table_small_round') + minetest.register_alias('homedecor:'..m..'_table_large', 'homedecor:'..m..'_table_large_square') end --- conversion routines for old non-6dfacedir tables +-- old-style tables that used to be from 3dforniture. -local tlist_s = {} -local tlist_t = {} -local dirs2 = { 9, 18, 7, 12 } - -for i in ipairs(materials) do - local m = materials[i][1] - table.insert(tlist_s, "homedecor:"..m.."_table_large_s") - table.insert(tlist_s, "homedecor:"..m.."_table_small_square_s") - table.insert(tlist_s, "homedecor:"..m.."_table_small_round_s") - - table.insert(tlist_t, "homedecor:"..m.."_table_large_t") - table.insert(tlist_t, "homedecor:"..m.."_table_small_square_t") - table.insert(tlist_t, "homedecor:"..m.."_table_small_round_t") -end - -minetest.register_abm({ - nodenames = tlist_s, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local newnode = string.sub(node.name, 1, -3) -- strip the "_s" from the name - local fdir = node.param2 or 0 - minetest.set_node(pos, {name = newnode, param2 = dirs2[fdir+1]}) - end -}) - -minetest.register_abm({ - nodenames = tlist_t, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local newnode = string.sub(node.name, 1, -3) -- strip the "_t" from the name - minetest.set_node(pos, { name = newnode, param2 = 20 }) - end -}) - --- other tables - -homedecor.register("utility_table_top", { - description = S("Utility Table"), - tiles = { - 'homedecor_utility_table_tb.png', - 'homedecor_utility_table_tb.png', - 'homedecor_utility_table_edges.png', - 'homedecor_utility_table_edges.png', - 'homedecor_utility_table_edges.png', - 'homedecor_utility_table_edges.png' - }, - wield_image = 'homedecor_utility_table_tb.png', - inventory_image = 'homedecor_utility_table_tb.png', - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - paramtype2 = "wallmounted", - node_box = { - type = "wallmounted", - wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, - wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }, - }, - selection_box = { - type = "wallmounted", - wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, - wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }, - }, -}) - --- Various kinds of table legs - --- local above -materials = { - { "brass", S("brass") }, - { "wrought_iron", S("wrought iron") }, +local table_colors = { + { "", S("Table"), homedecor.plain_wood }, + { "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood }, + { "_white", S("White Table"), homedecor.white_wood } } -for _, t in ipairs(materials) do -local name, desc = unpack(t) -homedecor.register("table_legs_"..name, { - description = S("Table Legs (@1)", desc), - drawtype = "plantlike", - tiles = {"homedecor_table_legs_"..name..".png"}, - inventory_image = "homedecor_table_legs_"..name..".png", - wield_image = "homedecor_table_legs_"..name..".png", - walkable = false, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } - }, -}) +for _, t in ipairs(table_colors) do + local suffix, desc, texture = unpack(t) + + homedecor.register("table"..suffix, { + description = desc, + tiles = { texture }, + node_box = { + type = "fixed", + fixed = { + { -0.4, -0.5, -0.4, -0.3, 0.4, -0.3 }, + { 0.3, -0.5, -0.4, 0.4, 0.4, -0.3 }, + { -0.4, -0.5, 0.3, -0.3, 0.4, 0.4 }, + { 0.3, -0.5, 0.3, 0.4, 0.4, 0.4 }, + { -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 }, + { -0.4, -0.2, -0.3, -0.3, -0.1, 0.3 }, + { 0.3, -0.2, -0.4, 0.4, -0.1, 0.3 }, + { -0.3, -0.2, -0.4, 0.4, -0.1, -0.3 }, + { -0.3, -0.2, 0.3, 0.3, -0.1, 0.4 }, + }, + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + }) end -homedecor.register("utility_table_legs", { - description = S("Legs for Utility Table"), - drawtype = "plantlike", - tiles = { 'homedecor_utility_table_legs.png' }, - inventory_image = 'homedecor_utility_table_legs_inv.png', - wield_image = 'homedecor_utility_table_legs.png', - walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } - }, -}) - -- crafting - minetest.register_craft( { output = "homedecor:glass_table_small_round_b 15", recipe = { @@ -226,8 +182,6 @@ minetest.register_craft( { } }) --- - minetest.register_craft( { output = "homedecor:wood_table_small_round_b 15", recipe = { @@ -305,7 +259,73 @@ minetest.register_craft({ burntime = 30, }) +for _, shape in ipairs (table_shapes) do + for _, leg in ipairs(leg_materials) do + for _, mat in ipairs(tabletop_materials) do + minetest.register_craft({ + output = "homedecor:"..mat[1].."_table_"..shape.."_with_"..leg[1].."_legs", + type = "shapeless", + recipe = { + "homedecor:"..mat[1].."_table_"..shape, + "homedecor:table_legs_"..leg[1] + }, + }) + end + end +end +minetest.register_craft({ + output = "homedecor:table", + recipe = { + { "group:wood","group:wood", "group:wood" }, + { "group:stick", "", "group:stick" }, + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:table_mahogany", + recipe = { + "homedecor:table", + "dye:brown", + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:table_mahogany", + recipe = { + "homedecor:table", + "unifieddyes:dark_orange", + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:table_white", + recipe = { + "homedecor:table", + "dye:white", + }, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "homedecor:table", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "homedecor:table_mahogany", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "homedecor:table_white", + burntime = 30, +}) -- recycling @@ -368,3 +388,8 @@ minetest.register_craft({ "homedecor:wood_table_large" } }) + +-- Aliases for the above 3dforniture-like tables + +minetest.register_alias("3dforniture:table", "homedecor:table") +minetest.register_alias('table', 'homedecor:table') diff --git a/mods/homedecor_tables/mod.conf b/mods/homedecor_tables/mod.conf index a652f4c6..32011ac5 100644 --- a/mods/homedecor_tables/mod.conf +++ b/mods/homedecor_tables/mod.conf @@ -1,3 +1,4 @@ name = homedecor_tables description = Homedecor mod: tables depends = homedecor_common, default, basic_materials +optional_depends = creative diff --git a/mods/homedecor_tables/models/homedecor_table_large_square.obj b/mods/homedecor_tables/models/homedecor_table_large_square.obj new file mode 100644 index 00000000..e570fdd7 --- /dev/null +++ b/mods/homedecor_tables/models/homedecor_table_large_square.obj @@ -0,0 +1,107 @@ +# Blender v2.83.5 OBJ File: 'homedecor table with legs.blend' +# www.blender.org +o Cube_Cube.001 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.437500 -0.500000 +v -0.353553 -0.500000 0.353554 +v -0.353553 0.437515 0.353554 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.437515 -0.353553 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.437500 -0.500000 +v 0.500000 -0.437500 0.500000 +v -0.500000 -0.437500 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.437500 0.500000 +v 0.500000 0.437500 -0.500000 +v 0.500000 0.437500 0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.437500 0.500000 +v -0.500000 0.500000 0.500000 +v 0.353553 -0.500000 0.353554 +v 0.353553 0.437515 0.353554 +v -0.353553 -0.500000 -0.353553 +v -0.353553 0.437515 -0.353553 +vt -0.000000 -0.000000 +vt 1.000000 -0.000000 +vt 1.000000 0.500000 +vt -0.000000 0.500000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt -0.000000 0.500000 +vt 1.000000 0.500000 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt -0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +vt 0.000000 -0.000000 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt -0.000000 0.937500 +vt -0.000000 1.000000 +vt -0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +g Cube_Cube.001_top-bottom +s off +f 14/1/1 2/2/1 10/3/1 1/4/1 +f 11/5/2 13/6/2 15/7/2 12/8/2 +g Cube_Cube.001_edges +f 11/5/3 12/9/3 10/10/3 2/11/3 +f 13/6/4 14/12/4 1/13/4 15/14/4 +f 12/15/5 15/16/5 1/17/5 10/18/5 +f 13/19/6 11/20/6 2/21/6 14/22/6 +g Cube_Cube.001_top-bot_with_legs +f 20/23/2 3/24/2 4/25/2 18/26/2 +f 16/27/1 17/28/1 19/29/1 5/30/1 +g Cube_Cube.001_edges_with_legs +f 20/31/5 19/32/5 17/33/5 3/34/5 +f 4/25/3 3/35/3 17/36/3 16/37/3 +f 19/38/4 20/39/4 18/26/4 5/40/4 +f 4/41/6 16/42/6 5/43/6 18/44/6 +g Cube_Cube.001_legs +f 21/45/7 23/46/7 24/47/7 22/48/7 +f 6/49/8 8/50/8 9/51/8 7/52/8 diff --git a/mods/homedecor_tables/models/homedecor_table_small_round.obj b/mods/homedecor_tables/models/homedecor_table_small_round.obj index 41bd5e8a..8e7ddeb5 100644 --- a/mods/homedecor_tables/models/homedecor_table_small_round.obj +++ b/mods/homedecor_tables/models/homedecor_table_small_round.obj @@ -1,300 +1,1456 @@ -v 0.049 -0.499 -0.498 -v 0.049 -0.453 -0.498 -v 0.145 -0.499 -0.478 -v 0.145 -0.453 -0.478 -v 0.236 -0.499 -0.441 -v 0.236 -0.453 -0.441 -v 0.317 -0.499 -0.387 -v 0.317 -0.453 -0.387 -v 0.387 -0.499 -0.317 -v 0.387 -0.453 -0.317 -v 0.441 -0.499 -0.236 -v 0.441 -0.453 -0.236 -v 0.478 -0.499 -0.145 -v 0.478 -0.453 -0.145 -v 0.498 -0.499 -0.049 -v 0.498 -0.453 -0.049 -v 0.498 -0.499 0.049 -v 0.498 -0.453 0.049 -v 0.478 -0.499 0.145 -v 0.478 -0.453 0.145 -v 0.441 -0.499 0.236 -v 0.441 -0.453 0.236 -v 0.387 -0.499 0.317 -v 0.387 -0.453 0.317 -v 0.317 -0.499 0.387 -v 0.317 -0.453 0.387 -v 0.236 -0.499 0.441 -v 0.236 -0.453 0.441 -v 0.145 -0.499 0.478 -v 0.145 -0.453 0.478 -v 0.049 -0.499 0.498 -v 0.049 -0.453 0.498 -v -0.049 -0.499 0.498 -v -0.049 -0.453 0.498 -v -0.145 -0.499 0.478 -v -0.145 -0.453 0.478 -v -0.236 -0.499 0.441 -v -0.236 -0.453 0.441 -v -0.317 -0.499 0.387 -v -0.317 -0.453 0.387 -v -0.387 -0.499 0.317 -v -0.387 -0.453 0.317 -v -0.441 -0.499 0.236 -v -0.441 -0.453 0.236 -v -0.478 -0.499 0.145 -v -0.478 -0.453 0.145 -v -0.498 -0.499 0.049 -v -0.498 -0.453 0.049 -v -0.498 -0.499 -0.049 -v -0.498 -0.453 -0.049 -v -0.478 -0.499 -0.145 -v -0.478 -0.453 -0.145 -v -0.441 -0.499 -0.236 -v -0.441 -0.453 -0.236 -v -0.387 -0.499 -0.317 -v -0.387 -0.453 -0.317 -v -0.317 -0.499 -0.387 -v -0.317 -0.453 -0.387 -v -0.236 -0.499 -0.441 -v -0.236 -0.453 -0.441 -v -0.145 -0.499 -0.478 -v -0.145 -0.453 -0.478 -v -0.049 -0.499 -0.498 -v -0.049 -0.453 -0.498 -v 0.046 -0.437 -0.469 -v 0.137 -0.437 -0.451 -v 0.222 -0.437 -0.416 -v 0.299 -0.437 -0.364 -v 0.364 -0.437 -0.299 -v 0.416 -0.437 -0.222 -v 0.451 -0.437 -0.137 -v 0.469 -0.437 -0.046 -v 0.469 -0.437 0.046 -v 0.451 -0.437 0.137 -v 0.416 -0.437 0.222 -v 0.364 -0.437 0.299 -v 0.299 -0.437 0.364 -v 0.222 -0.437 0.416 -v 0.137 -0.437 0.451 -v 0.046 -0.437 0.469 -v -0.046 -0.437 0.469 -v -0.137 -0.437 0.451 -v -0.222 -0.437 0.416 -v -0.299 -0.437 0.364 -v -0.364 -0.437 0.299 -v -0.416 -0.437 0.222 -v -0.451 -0.437 0.137 -v -0.469 -0.437 0.046 -v -0.469 -0.437 -0.046 -v -0.451 -0.437 -0.137 -v -0.416 -0.437 -0.222 -v -0.364 -0.437 -0.299 -v -0.299 -0.437 -0.364 -v -0.222 -0.437 -0.416 -v -0.137 -0.437 -0.451 -v -0.046 -0.437 -0.469 -vt 0.277 0.123 -vt 0.277 0.096 -vt 0.333 0.096 -vt 0.333 0.123 -vt 0.389 0.096 -vt 0.389 0.123 -vt 0.444 0.096 -vt 0.444 0.123 -vt 0.5 0.096 -vt 0.5 0.123 -vt 0.556 0.096 -vt 0.556 0.123 -vt 0.611 0.096 -vt 0.611 0.123 -vt 0.667 0.096 -vt 0.667 0.123 -vt 0.723 0.096 -vt 0.723 0.123 -vt 0.277 0.404 -vt 0.277 0.377 -vt 0.333 0.377 -vt 0.333 0.404 -vt 0.389 0.377 -vt 0.389 0.404 -vt 0.444 0.377 -vt 0.444 0.404 -vt 0.5 0.377 -vt 0.5 0.404 -vt 0.556 0.377 -vt 0.556 0.404 -vt 0.611 0.377 -vt 0.611 0.404 -vt 0.667 0.377 -vt 0.667 0.404 -vt 0.723 0.377 -vt 0.723 0.404 -vt 0.277 0.311 -vt 0.277 0.283 -vt 0.333 0.283 -vt 0.333 0.311 -vt 0.389 0.283 -vt 0.389 0.311 -vt 0.444 0.283 -vt 0.444 0.311 -vt 0.5 0.283 -vt 0.5 0.311 -vt 0.556 0.283 -vt 0.556 0.311 -vt 0.611 0.283 -vt 0.611 0.311 -vt 0.667 0.283 -vt 0.667 0.311 -vt 0.723 0.283 -vt 0.723 0.311 -vt 0.277 0.217 -vt 0.277 0.189 -vt 0.333 0.189 -vt 0.333 0.217 -vt 0.389 0.189 -vt 0.389 0.217 -vt 0.444 0.189 -vt 0.444 0.217 -vt 0.5 0.189 -vt 0.5 0.217 -vt 0.556 0.189 -vt 0.556 0.217 -vt 0.611 0.189 -vt 0.611 0.217 -vt 0.667 0.217 -vt 0.667 0.189 -vt 0.723 0.189 -vt 0.723 0.217 -vt 0.728 0.526 -vt 0.685 0.535 -vt 0.644 0.552 -vt 0.607 0.576 -vt 0.576 0.607 -vt 0.552 0.644 -vt 0.535 0.685 -vt 0.526 0.728 -vt 0.526 0.772 -vt 0.535 0.815 -vt 0.552 0.856 -vt 0.576 0.893 -vt 0.607 0.924 -vt 0.644 0.948 -vt 0.685 0.965 -vt 0.728 0.974 -vt 0.772 0.974 -vt 0.815 0.965 -vt 0.856 0.948 -vt 0.893 0.924 -vt 0.924 0.893 -vt 0.948 0.856 -vt 0.965 0.815 -vt 0.974 0.772 -vt 0.974 0.728 -vt 0.965 0.685 -vt 0.948 0.644 -vt 0.924 0.607 -vt 0.893 0.576 -vt 0.856 0.552 -vt 0.815 0.535 -vt 0.772 0.526 -vt 0.192 0.558 -vt 0.23 0.551 -vt 0.27 0.551 -vt 0.308 0.558 -vt 0.344 0.573 -vt 0.377 0.595 -vt 0.405 0.623 -vt 0.427 0.656 -vt 0.442 0.692 -vt 0.449 0.73 -vt 0.449 0.77 -vt 0.442 0.808 -vt 0.427 0.844 -vt 0.405 0.877 -vt 0.377 0.905 -vt 0.344 0.927 -vt 0.308 0.942 -vt 0.27 0.949 -vt 0.23 0.949 -vt 0.192 0.942 -vt 0.156 0.927 -vt 0.123 0.905 -vt 0.095 0.877 -vt 0.073 0.844 -vt 0.058 0.808 -vt 0.051 0.77 -vt 0.051 0.73 -vt 0.058 0.692 -vt 0.073 0.656 -vt 0.095 0.623 -vt 0.123 0.595 -vt 0.156 0.573 -g 1 +# Blender v2.83.5 OBJ File: 'homedecor round table with legs.blend' +# www.blender.org +o Cube_Cube.001 +v 0.277785 -0.500000 -0.415735 +v -0.500000 -0.468750 0.000000 +v 0.277785 0.468750 0.415735 +v -0.500000 -0.500000 0.000000 +v 0.317196 0.468750 0.386505 +v 0.497592 -0.500000 -0.049009 +v 0.297348 0.500000 0.362320 +v 0.490393 -0.500000 -0.097545 +v 0.235698 -0.500000 -0.440961 +v 0.353553 0.468750 0.353554 +v 0.478470 -0.500000 -0.145142 +v -0.235699 0.468750 0.440960 +v 0.490393 -0.500000 0.097545 +v 0.478470 -0.500000 0.145142 +v 0.440961 -0.500000 0.235699 +v -0.277786 0.468750 0.415735 +v 0.461940 -0.500000 0.191342 +v -0.317197 0.468750 0.386505 +v 0.497592 -0.500000 0.049009 +v -0.297348 0.500000 0.362319 +v 0.461940 -0.500000 -0.191342 +v 0.145142 -0.500000 -0.478470 +v 0.317197 0.468750 -0.386505 +v -0.277786 -0.500000 -0.415734 +v 0.353553 0.468750 -0.353553 +v 0.191342 -0.500000 -0.461940 +v 0.331430 0.500000 -0.331430 +v 0.500000 -0.500000 0.000000 +v -0.490393 0.468750 0.097545 +v -0.497592 -0.500000 0.049009 +v -0.459706 0.500000 0.091441 +v 0.415735 -0.500000 0.277785 +v 0.386505 -0.500000 0.317197 +v -0.461940 0.468750 0.191342 +v -0.415735 -0.500000 -0.277784 +v -0.440961 -0.500000 -0.235698 +v -0.440961 0.468750 0.235698 +v -0.490393 -0.500000 -0.097545 +v -0.386506 -0.500000 -0.317196 +v 0.145142 0.468750 0.478470 +v -0.353554 -0.500000 -0.353553 +v 0.191341 0.468750 0.461940 +v -0.317198 -0.500000 -0.386505 +v 0.179368 0.500000 0.433034 +v -0.191343 -0.500000 -0.461939 +v 0.220949 0.500000 0.413367 +v -0.235700 -0.500000 -0.440960 +v 0.235698 0.468750 0.440961 +v -0.461940 -0.500000 -0.191341 +v -0.478470 -0.500000 -0.145142 +v 0.097545 0.468750 0.490393 +v -0.497592 -0.500000 -0.049008 +v -0.191342 0.468750 0.461940 +v -0.097547 -0.500000 -0.490392 +v -0.179369 0.500000 0.433034 +v -0.145144 -0.500000 -0.478470 +v -0.049010 -0.500000 -0.497592 +v -0.097546 0.468750 0.490393 +v 0.000000 -0.500000 -0.500000 +v -0.478470 0.468750 0.145142 +v -0.386506 -0.500000 0.317196 +v -0.415735 -0.500000 0.277785 +v -0.145143 0.468750 0.478470 +v 0.049008 -0.500000 0.497592 +v -0.000000 -0.500000 0.500000 +v 0.362320 0.500000 -0.297348 +v -0.353554 -0.500000 0.353553 +v 0.386505 0.468750 -0.317197 +v -0.049009 -0.500000 0.497592 +v 0.389720 0.500000 -0.260403 +v 0.049009 -0.500000 -0.497592 +v 0.415735 0.468750 -0.277785 +v 0.097545 -0.500000 -0.490393 +v 0.440961 -0.500000 -0.235698 +v 0.440961 0.468750 -0.235698 +v 0.415735 -0.500000 -0.277785 +v 0.097545 0.468750 -0.490393 +v 0.386505 -0.500000 -0.317197 +v 0.091441 0.500000 -0.459706 +v -0.145143 -0.500000 0.478470 +v -0.478470 -0.500000 0.145142 +v 0.049009 0.468750 -0.497592 +v -0.097546 -0.500000 0.490393 +v -0.049009 0.468750 0.497592 +v -0.191342 -0.500000 0.461940 +v -0.045942 0.500000 0.466455 +v 0.097545 -0.500000 0.490393 +v 0.235698 -0.500000 0.440961 +v -0.353554 0.468750 0.353553 +v 0.191341 -0.500000 0.461940 +v -0.000000 0.468750 0.500000 +v 0.145142 -0.500000 0.478470 +v -0.440961 -0.500000 0.235698 +v -0.461940 -0.500000 0.191342 +v 0.049008 0.468750 0.497592 +v -0.490393 -0.500000 0.097545 +v -0.415735 0.468750 0.277785 +v 0.353553 -0.500000 -0.353553 +v -0.389720 0.500000 0.260402 +v 0.317197 -0.500000 -0.386505 +v -0.317197 -0.500000 0.386505 +v -0.386506 0.468750 0.317196 +v -0.277786 -0.500000 0.415735 +v 0.000000 0.468750 -0.500000 +v -0.235699 -0.500000 0.440960 +v 0.353553 -0.500000 0.353554 +v -0.045943 0.500000 -0.466455 +v 0.317196 -0.500000 0.386505 +v -0.049010 0.468750 -0.497592 +v 0.277785 -0.500000 0.415735 +v -0.136061 0.500000 -0.448529 +v 0.277785 0.437500 0.415735 +v -0.145144 0.468750 -0.478470 +v -0.500000 0.437500 0.000000 +v -0.097547 0.468750 -0.490392 +v -0.091443 0.500000 -0.459706 +v 0.490393 0.437500 -0.097545 +v -0.497592 0.468750 -0.049008 +v 0.478470 0.437500 -0.145142 +v -0.478470 0.468750 -0.145142 +v -0.461940 0.468750 -0.191341 +v 0.440961 0.437500 0.235699 +v -0.433034 0.500000 -0.179368 +v 0.461940 0.437500 0.191342 +v 0.497592 0.437500 0.049009 +v -0.235700 0.468750 -0.440960 +v -0.191343 0.468750 -0.461939 +v 0.145142 0.437500 -0.478470 +v -0.179370 0.500000 -0.433033 +v -0.297349 0.500000 -0.362319 +v 0.191342 0.437500 -0.461940 +v -0.317198 0.468750 -0.386505 +v 0.500000 0.437500 0.000000 +v -0.353554 0.468750 -0.353553 +v -0.331430 0.500000 -0.331429 +v 0.415735 0.437500 0.277785 +v -0.386506 0.468750 -0.317196 +v -0.415735 0.437500 -0.277784 +v -0.490393 0.468750 -0.097545 +v -0.440961 0.468750 -0.235698 +v -0.415735 0.468750 -0.277784 +v -0.389720 0.500000 -0.260402 +v 0.386505 0.468750 0.317197 +v 0.362319 0.500000 0.297348 +v -0.461940 0.437500 -0.191341 +v 0.415735 0.468750 0.277785 +v -0.478470 0.437500 -0.145142 +v 0.389720 0.500000 0.260403 +v -0.497592 0.437500 -0.049008 +v -0.466455 0.500000 0.045942 +v -0.497592 0.468750 0.049009 +v 0.500000 0.468750 0.000000 +v -0.049010 0.437500 -0.497592 +v 0.468712 0.500000 0.000000 +v 0.000000 0.437500 -0.500000 +v 0.179368 0.500000 -0.433034 +v -0.386506 0.437500 0.317196 +v 0.191342 0.468750 -0.461940 +v -0.415735 0.437500 0.277785 +v -0.277786 0.468750 -0.415734 +v -0.260403 0.500000 -0.389720 +v -0.000000 0.437500 0.500000 +v 0.136060 0.500000 -0.448530 +v 0.145142 0.468750 -0.478470 +v -0.049009 0.437500 0.497592 +v 0.461940 0.468750 -0.191342 +v 0.049009 0.437500 -0.497592 +v 0.097545 0.437500 -0.490393 +v 0.497592 0.468750 0.049009 +v 0.415735 0.437500 -0.277785 +v 0.433034 0.500000 0.179369 +v 0.386505 0.437500 -0.317197 +v 0.461940 0.468750 0.191342 +v 0.440961 0.468750 0.235699 +v 0.478470 0.468750 0.145142 +v -0.191342 0.437500 0.461940 +v 0.459706 0.500000 0.091441 +v 0.490393 0.468750 0.097545 +v 0.448530 0.500000 -0.136060 +v 0.478470 0.468750 -0.145142 +v -0.440961 0.437500 0.235698 +v 0.235698 0.468750 -0.440961 +v 0.490393 0.468750 -0.097545 +v 0.317197 0.437500 -0.386505 +v 0.497592 0.468750 -0.049009 +v -0.317197 0.437500 0.386505 +v 0.466455 0.500000 -0.045942 +v -0.500000 0.468750 0.000000 +v -0.235699 0.437500 0.440960 +v 0.277785 0.468750 -0.415735 +v 0.260403 0.500000 -0.389720 +v 0.260403 -0.437500 -0.389720 +v 0.277785 -0.468750 -0.415735 +v -0.468712 -0.437500 0.000000 +v 0.466455 -0.437500 -0.045942 +v 0.497592 -0.468750 -0.049009 +v 0.490393 -0.468750 -0.097545 +v 0.459706 -0.437500 -0.091441 +v 0.235698 -0.468750 -0.440961 +v 0.220950 -0.437500 -0.413367 +v 0.478470 -0.468750 -0.145142 +v 0.448530 -0.437500 -0.136060 +v 0.490393 -0.468750 0.097545 +v 0.459706 -0.437500 0.091441 +v 0.448530 -0.437500 0.136060 +v 0.478470 -0.468750 0.145142 +v 0.413367 -0.437500 0.220949 +v 0.440961 -0.468750 0.235699 +v 0.461940 -0.468750 0.191342 +v 0.433034 -0.437500 0.179369 +v 0.497592 -0.468750 0.049009 +v 0.466455 -0.437500 0.045942 +v 0.433034 -0.437500 -0.179368 +v 0.461940 -0.468750 -0.191342 +v 0.145142 -0.468750 -0.478470 +v 0.136060 -0.437500 -0.448530 +v -0.260403 -0.437500 -0.389720 +v -0.277786 -0.468750 -0.415734 +v 0.191342 -0.468750 -0.461940 +v 0.179368 -0.437500 -0.433034 +v 0.468712 -0.437500 0.000000 +v 0.500000 -0.468750 0.000000 +v -0.497592 -0.468750 0.049009 +v -0.466455 -0.437500 0.045942 +v 0.389720 -0.437500 0.260403 +v 0.415735 -0.468750 0.277785 +v 0.362319 -0.437500 0.297348 +v 0.386505 -0.468750 0.317197 +v -0.389720 -0.437500 -0.260402 +v -0.415735 -0.468750 -0.277784 +v -0.440961 -0.468750 -0.235698 +v -0.413368 -0.437500 -0.220949 +v -0.459706 -0.437500 -0.091441 +v -0.490393 -0.468750 -0.097545 +v -0.362320 -0.437500 -0.297347 +v -0.386506 -0.468750 -0.317196 +v -0.331430 -0.437500 -0.331429 +v -0.353554 -0.468750 -0.353553 +v -0.317198 -0.468750 -0.386505 +v -0.297349 -0.437500 -0.362319 +v -0.179370 -0.437500 -0.433033 +v -0.191343 -0.468750 -0.461939 +v -0.235700 -0.468750 -0.440960 +v -0.220951 -0.437500 -0.413367 +v -0.433034 -0.437500 -0.179368 +v -0.461940 -0.468750 -0.191341 +v -0.478470 -0.468750 -0.145142 +v -0.448530 -0.437500 -0.136059 +v -0.497592 -0.468750 -0.049008 +v -0.466455 -0.437500 -0.045942 +v -0.091443 -0.437500 -0.459706 +v -0.097547 -0.468750 -0.490392 +v -0.145144 -0.468750 -0.478470 +v -0.136061 -0.437500 -0.448529 +v -0.049010 -0.468750 -0.497592 +v -0.045943 -0.437500 -0.466455 +v -0.000000 -0.437500 -0.468712 +v 0.000000 -0.468750 -0.500000 +v -0.386506 -0.468750 0.317196 +v -0.362320 -0.437500 0.297348 +v -0.389720 -0.437500 0.260402 +v -0.415735 -0.468750 0.277785 +v 0.049008 -0.468750 0.497592 +v 0.045942 -0.437500 0.466455 +v -0.000000 -0.437500 0.468712 +v -0.000000 -0.468750 0.500000 +v -0.353554 -0.468750 0.353553 +v -0.331430 -0.437500 0.331429 +v -0.045942 -0.437500 0.466455 +v -0.049009 -0.468750 0.497592 +v 0.049009 -0.468750 -0.497592 +v 0.045942 -0.437500 -0.466455 +v 0.091441 -0.437500 -0.459706 +v 0.097545 -0.468750 -0.490393 +v 0.440961 -0.468750 -0.235698 +v 0.413367 -0.437500 -0.220950 +v 0.415735 -0.468750 -0.277785 +v 0.389720 -0.437500 -0.260403 +v 0.386505 -0.468750 -0.317197 +v 0.362320 -0.437500 -0.297348 +v -0.136061 -0.437500 0.448530 +v -0.145143 -0.468750 0.478470 +v -0.448530 -0.437500 0.136060 +v -0.478470 -0.468750 0.145142 +v -0.097546 -0.468750 0.490393 +v -0.091442 -0.437500 0.459706 +v -0.179369 -0.437500 0.433034 +v -0.191342 -0.468750 0.461940 +v 0.097545 -0.468750 0.490393 +v 0.091441 -0.437500 0.459706 +v 0.235698 -0.468750 0.440961 +v 0.220949 -0.437500 0.413367 +v 0.179368 -0.437500 0.433034 +v 0.191341 -0.468750 0.461940 +v 0.145142 -0.468750 0.478470 +v 0.136060 -0.437500 0.448530 +v -0.440961 -0.468750 0.235698 +v -0.413368 -0.437500 0.220949 +v -0.461940 -0.468750 0.191342 +v -0.433034 -0.437500 0.179369 +v -0.459706 -0.437500 0.091441 +v -0.490393 -0.468750 0.097545 +v 0.331430 -0.437500 -0.331430 +v 0.353553 -0.468750 -0.353553 +v 0.317197 -0.468750 -0.386505 +v 0.297348 -0.437500 -0.362319 +v -0.297348 -0.437500 0.362319 +v -0.317197 -0.468750 0.386505 +v -0.277786 -0.468750 0.415735 +v -0.260403 -0.437500 0.389720 +v -0.220950 -0.437500 0.413367 +v -0.235699 -0.468750 0.440960 +v 0.353553 -0.468750 0.353554 +v 0.331430 -0.437500 0.331430 +v 0.297348 -0.437500 0.362320 +v 0.317196 -0.468750 0.386505 +v 0.277785 -0.468750 0.415735 +v 0.260403 -0.437500 0.389720 +v 0.317196 0.437500 0.386505 +v -0.468712 0.500000 0.000000 +v 0.353553 0.437500 0.353554 +v -0.277786 0.437500 0.415735 +v 0.459706 0.500000 -0.091441 +v 0.220950 0.500000 -0.413367 +v 0.353553 0.437500 -0.353553 +v 0.448530 0.500000 0.136060 +v -0.490393 0.437500 0.097545 +v 0.413367 0.500000 0.220949 +v -0.461940 0.437500 0.191342 +v 0.145142 0.437500 0.478470 +v 0.466455 0.500000 0.045942 +v 0.433034 0.500000 -0.179368 +v 0.191341 0.437500 0.461940 +v 0.235698 0.437500 0.440961 +v 0.097545 0.437500 0.490393 +v -0.097546 0.437500 0.490393 +v -0.478470 0.437500 0.145142 +v -0.145143 0.437500 0.478470 +v 0.440961 0.437500 -0.235698 +v -0.413368 0.500000 -0.220949 +v -0.459706 0.500000 -0.091441 +v -0.362320 0.500000 -0.297347 +v -0.353554 0.437500 0.353553 +v 0.049008 0.437500 0.497592 +v -0.220951 0.500000 -0.413367 +v -0.448530 0.500000 -0.136059 +v -0.466455 0.500000 -0.045942 +v -0.145144 0.437500 -0.478470 +v -0.097547 0.437500 -0.490392 +v -0.000000 0.500000 -0.468712 +v -0.362320 0.500000 0.297348 +v -0.235700 0.437500 -0.440960 +v 0.045942 0.500000 0.466455 +v -0.000000 0.500000 0.468712 +v -0.191343 0.437500 -0.461939 +v -0.317198 0.437500 -0.386505 +v -0.331430 0.500000 0.331429 +v -0.353554 0.437500 -0.353553 +v -0.386506 0.437500 -0.317196 +v 0.045942 0.500000 -0.466455 +v -0.490393 0.437500 -0.097545 +v -0.440961 0.437500 -0.235698 +v 0.413367 0.500000 -0.220950 +v 0.386505 0.437500 0.317197 +v -0.136061 0.500000 0.448530 +v -0.448530 0.500000 0.136060 +v -0.497592 0.437500 0.049009 +v -0.091442 0.500000 0.459706 +v -0.277786 0.437500 -0.415734 +v 0.091441 0.500000 0.459706 +v 0.461940 0.437500 -0.191342 +v 0.136060 0.500000 0.448530 +v -0.413368 0.500000 0.220949 +v -0.433034 0.500000 0.179369 +v 0.478470 0.437500 0.145142 +v 0.490393 0.437500 0.097545 +v 0.297348 0.500000 -0.362319 +v 0.235698 0.437500 -0.440961 +v -0.260403 0.500000 0.389720 +v -0.220950 0.500000 0.413367 +v 0.497592 0.437500 -0.049009 +v 0.331430 0.500000 0.331430 +v 0.277785 0.437500 -0.415735 +v 0.260403 0.500000 0.389720 +v -0.353553 -0.500000 0.353554 +v -0.353553 0.437515 0.353554 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.437515 -0.353553 +v 0.353553 -0.500000 0.353554 +v 0.353553 0.437515 0.353554 +v -0.353553 -0.500000 -0.353553 +v -0.353553 0.437515 -0.353553 +vt 0.500000 0.000000 +vt 0.549008 0.001204 +vt 0.597545 0.004804 +vt 0.645142 0.010765 +vt 0.691342 0.019030 +vt 0.735698 0.029520 +vt 0.777785 0.042133 +vt 0.817197 0.056747 +vt 0.853553 0.073223 +vt 0.886505 0.091402 +vt 0.915735 0.111107 +vt 0.940961 0.132151 +vt 0.961940 0.154329 +vt 0.978470 0.177429 +vt 0.990393 0.201227 +vt 0.997592 0.225496 +vt 1.000000 0.250000 +vt 0.997592 0.274504 +vt 0.990393 0.298773 +vt 0.978470 0.322571 +vt 0.961940 0.345671 +vt 0.940960 0.367849 +vt 0.915735 0.388893 +vt 0.886505 0.408598 +vt 0.853553 0.426777 +vt 0.817196 0.443253 +vt 0.777785 0.457868 +vt 0.735698 0.470480 +vt 0.691341 0.480970 +vt 0.645142 0.489235 +vt 0.597545 0.495196 +vt 0.549008 0.498796 +vt 0.500000 0.500000 +vt 0.450991 0.498796 +vt 0.402454 0.495196 +vt 0.354857 0.489235 +vt 0.308658 0.480970 +vt 0.264301 0.470480 +vt 0.222215 0.457867 +vt 0.182803 0.443252 +vt 0.146446 0.426776 +vt 0.113495 0.408598 +vt 0.084265 0.388892 +vt 0.059039 0.367849 +vt 0.038060 0.345671 +vt 0.021530 0.322571 +vt 0.009607 0.298773 +vt 0.002408 0.274504 +vt 0.000000 0.250000 +vt 0.002408 0.225496 +vt 0.009607 0.201228 +vt 0.021530 0.177429 +vt 0.038060 0.154329 +vt 0.059039 0.132151 +vt 0.084265 0.111108 +vt 0.113494 0.091402 +vt 0.146446 0.073224 +vt 0.182803 0.056748 +vt 0.222214 0.042133 +vt 0.264300 0.029520 +vt 0.308657 0.019030 +vt 0.354856 0.010765 +vt 0.402453 0.004804 +vt 0.450990 0.001204 +vt 0.454057 0.983227 +vt 0.408557 0.979853 +vt 0.363939 0.974265 +vt 0.320630 0.966516 +vt 0.279049 0.956683 +vt 0.239597 0.944860 +vt 0.202651 0.931159 +vt 0.168569 0.915714 +vt 0.137680 0.898673 +vt 0.110280 0.880201 +vt 0.086632 0.860474 +vt 0.066966 0.839684 +vt 0.051470 0.818030 +vt 0.040294 0.795721 +vt 0.033545 0.772970 +vt 0.031287 0.750000 +vt 0.033545 0.727029 +vt 0.040294 0.704280 +vt 0.051470 0.681970 +vt 0.066967 0.660316 +vt 0.086633 0.639526 +vt 0.110280 0.619799 +vt 0.137680 0.601326 +vt 0.168570 0.584285 +vt 0.202652 0.568840 +vt 0.239597 0.555140 +vt 0.279050 0.543316 +vt 0.320631 0.533483 +vt 0.363939 0.525735 +vt 0.408558 0.520147 +vt 0.454058 0.516772 +vt 0.500000 0.515644 +vt 0.545941 0.516772 +vt 0.591441 0.520147 +vt 0.636059 0.525735 +vt 0.679368 0.533483 +vt 0.720949 0.543316 +vt 0.760403 0.555140 +vt 0.797348 0.568840 +vt 0.831429 0.584285 +vt 0.862319 0.601326 +vt 0.889720 0.619799 +vt 0.913368 0.639525 +vt 0.933034 0.660315 +vt 0.948529 0.681970 +vt 0.959706 0.704280 +vt 0.966455 0.727029 +vt 0.968712 0.750000 +vt 0.966455 0.772971 +vt 0.959706 0.795721 +vt 0.948530 0.818030 +vt 0.933034 0.839684 +vt 0.913367 0.860475 +vt 0.889720 0.880201 +vt 0.862320 0.898674 +vt 0.831430 0.915715 +vt 0.797348 0.931160 +vt 0.760403 0.944860 +vt 0.720950 0.956684 +vt 0.679368 0.966517 +vt 0.636060 0.974265 +vt 0.591441 0.979853 +vt 0.545942 0.983228 +vt 0.500000 0.984356 +vt 0.156250 0.937500 +vt 0.187500 0.937500 +vt 0.187500 0.968750 +vt 0.156250 0.968750 +vt 0.718750 0.937500 +vt 0.750000 0.937500 +vt 0.750000 0.968750 +vt 0.718750 0.968750 +vt 0.031250 0.968750 +vt -0.000000 0.968750 +vt -0.000000 0.937500 +vt 0.031250 0.937500 +vt 0.250000 0.937500 +vt 0.281250 0.937500 +vt 0.281250 0.968750 +vt 0.250000 0.968750 +vt 0.125000 0.937500 +vt 0.125000 0.968750 +vt 0.312500 0.937500 +vt 0.312500 0.968750 +vt 0.031250 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 0.031250 0.937500 +vt 0.656250 0.937500 +vt 0.687500 0.937500 +vt 0.687500 0.968750 +vt 0.656250 0.968750 +vt 0.781250 0.937500 +vt 0.812500 0.937500 +vt 0.812500 0.968750 +vt 0.781250 0.968750 +vt 0.406250 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.968750 +vt 0.406250 0.968750 +vt 0.593750 0.937500 +vt 0.625000 0.937500 +vt 0.625000 0.968750 +vt 0.593750 0.968750 +vt 0.625000 0.937500 +vt 0.625000 0.968750 +vt 0.218750 0.937500 +vt 0.250000 0.937500 +vt 0.250000 0.968750 +vt 0.218750 0.968750 +vt 0.218750 0.937500 +vt 0.218750 0.968750 +vt 0.875000 0.937500 +vt 0.906250 0.937500 +vt 0.906250 0.968750 +vt 0.875000 0.968750 +vt 0.125000 0.937500 +vt 0.156250 0.937500 +vt 0.156250 0.968750 +vt 0.125000 0.968750 +vt 0.062500 0.937500 +vt 0.093750 0.937500 +vt 0.093750 0.968750 +vt 0.062500 0.968750 +vt 0.375000 0.937500 +vt 0.406250 0.937500 +vt 0.406250 0.968750 +vt 0.375000 0.968750 +vt 0.937500 0.937500 +vt 0.968750 0.937500 +vt 0.968750 0.968750 +vt 0.937500 0.968750 +vt 0.343750 0.937500 +vt 0.343750 0.968750 +vt 0.843750 0.937500 +vt 0.843750 0.968750 +vt 0.656250 0.937500 +vt 0.687500 0.937500 +vt 0.687500 0.968750 +vt 0.656250 0.968750 +vt 0.281250 0.937500 +vt 0.312500 0.937500 +vt 0.312500 0.968750 +vt 0.281250 0.968750 +vt 0.500000 0.937500 +vt 0.531250 0.937500 +vt 0.531250 0.968750 +vt 0.500000 0.968750 +vt 0.906250 0.937500 +vt 0.906250 0.968750 +vt 0.718750 0.937500 +vt 0.750000 0.937500 +vt 0.750000 0.968750 +vt 0.718750 0.968750 +vt 0.937500 0.937500 +vt 0.937500 0.968750 +vt 0.843750 0.937500 +vt 0.875000 0.937500 +vt 0.875000 0.968750 +vt 0.843750 0.968750 +vt 0.562500 0.937500 +vt 0.593750 0.937500 +vt 0.593750 0.968750 +vt 0.562500 0.968750 +vt 0.187500 0.937500 +vt 0.187500 0.968750 +vt 0.062500 0.937500 +vt 0.093750 0.937500 +vt 0.093750 0.968750 +vt 0.062500 0.968750 +vt 0.343750 0.937500 +vt 0.343750 0.968750 +vt 0.968750 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 0.968750 0.968750 +vt 0.375000 0.937500 +vt 0.375000 0.968750 +vt 0.781250 0.937500 +vt 0.812500 0.937500 +vt 0.812500 0.968750 +vt 0.781250 0.968750 +vt 0.437500 0.937500 +vt 0.437500 0.968750 +vt 0.562500 0.937500 +vt 0.562500 0.968750 +vt 0.531250 0.937500 +vt 0.531250 0.968750 +vt 0.468750 0.937500 +vt 0.468750 0.968750 +vt 0.468750 0.937500 +vt 0.468750 0.968750 +vt 0.500000 0.937500 +vt 0.500000 0.968750 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 0.343750 1.000000 +vt 0.312500 1.000000 +vt 0.062500 1.000000 +vt 0.031250 1.000000 +vt 0.093750 1.000000 +vt 0.375000 1.000000 +vt 0.937500 1.000000 +vt 0.906250 1.000000 +vt 0.875000 1.000000 +vt 0.843750 1.000000 +vt 0.968750 1.000000 +vt 1.000000 1.000000 +vt 0.156250 1.000000 +vt 0.125000 1.000000 +vt 0.718750 1.000000 +vt 0.687500 1.000000 +vt 0.406250 1.000000 +vt 0.031250 1.000000 +vt -0.000000 1.000000 +vt 0.812500 1.000000 +vt 0.000000 1.000000 +vt 0.781250 1.000000 +vt 0.843750 1.000000 +vt 0.812500 1.000000 +vt 0.781250 1.000000 +vt 0.750000 1.000000 +vt 0.656250 1.000000 +vt 0.625000 1.000000 +vt 0.968750 1.000000 +vt 0.937500 1.000000 +vt 0.906250 1.000000 +vt 0.875000 1.000000 +vt 1.000000 1.000000 +vt 0.593750 1.000000 +vt 0.562500 1.000000 +vt 0.531250 1.000000 +vt 0.500000 1.000000 +vt 0.218750 1.000000 +vt 0.187500 1.000000 +vt 0.531250 1.000000 +vt 0.500000 1.000000 +vt 0.250000 1.000000 +vt 0.468750 1.000000 +vt 0.468750 1.000000 +vt 0.437500 1.000000 +vt 0.187500 1.000000 +vt 0.218750 1.000000 +vt 0.437500 1.000000 +vt 0.406250 1.000000 +vt 0.125000 1.000000 +vt 0.093750 1.000000 +vt 0.375000 1.000000 +vt 0.562500 1.000000 +vt 0.656250 1.000000 +vt 0.625000 1.000000 +vt 0.593750 1.000000 +vt 0.156250 1.000000 +vt 0.062500 1.000000 +vt 0.281250 1.000000 +vt 0.250000 1.000000 +vt 0.312500 1.000000 +vt 0.281250 1.000000 +vt 0.343750 1.000000 +vt 0.750000 1.000000 +vt 0.718750 1.000000 +vt 0.687500 1.000000 +vt 0.454057 0.983227 +vt 0.408557 0.979853 +vt 0.363939 0.974265 +vt 0.320630 0.966516 +vt 0.279049 0.956683 +vt 0.239597 0.944860 +vt 0.202651 0.931159 +vt 0.168569 0.915714 +vt 0.137680 0.898673 +vt 0.110280 0.880201 +vt 0.086632 0.860474 +vt 0.066966 0.839684 +vt 0.051470 0.818030 +vt 0.040294 0.795721 +vt 0.033545 0.772970 +vt 0.031287 0.750000 +vt 0.033545 0.727029 +vt 0.040294 0.704280 +vt 0.051470 0.681970 +vt 0.066967 0.660316 +vt 0.086633 0.639526 +vt 0.110280 0.619799 +vt 0.137680 0.601326 +vt 0.168570 0.584285 +vt 0.202652 0.568840 +vt 0.239597 0.555140 +vt 0.279050 0.543316 +vt 0.320631 0.533483 +vt 0.363939 0.525735 +vt 0.408558 0.520147 +vt 0.454058 0.516772 +vt 0.500000 0.515644 +vt 0.545941 0.516772 +vt 0.591441 0.520147 +vt 0.636059 0.525735 +vt 0.679368 0.533483 +vt 0.720949 0.543316 +vt 0.760403 0.555140 +vt 0.797348 0.568840 +vt 0.831429 0.584285 +vt 0.862319 0.601326 +vt 0.889720 0.619799 +vt 0.913368 0.639525 +vt 0.933034 0.660315 +vt 0.948529 0.681970 +vt 0.959706 0.704280 +vt 0.966455 0.727029 +vt 0.968712 0.750000 +vt 0.966455 0.772971 +vt 0.959706 0.795721 +vt 0.948530 0.818030 +vt 0.933034 0.839684 +vt 0.913367 0.860475 +vt 0.889720 0.880201 +vt 0.862320 0.898674 +vt 0.831430 0.915715 +vt 0.797348 0.931160 +vt 0.760403 0.944860 +vt 0.720950 0.956684 +vt 0.679368 0.966517 +vt 0.636060 0.974265 +vt 0.591441 0.979853 +vt 0.545942 0.983228 +vt 0.500000 0.984356 +vt 0.500000 0.000000 +vt 0.549008 0.001204 +vt 0.597545 0.004804 +vt 0.645142 0.010765 +vt 0.691342 0.019030 +vt 0.735698 0.029520 +vt 0.777785 0.042133 +vt 0.817197 0.056747 +vt 0.853553 0.073223 +vt 0.886505 0.091402 +vt 0.915735 0.111107 +vt 0.940961 0.132151 +vt 0.961940 0.154329 +vt 0.978470 0.177429 +vt 0.990393 0.201227 +vt 0.997592 0.225496 +vt 1.000000 0.250000 +vt 0.997592 0.274504 +vt 0.990393 0.298773 +vt 0.978470 0.322571 +vt 0.961940 0.345671 +vt 0.940960 0.367849 +vt 0.915735 0.388893 +vt 0.886505 0.408598 +vt 0.853553 0.426777 +vt 0.817196 0.443253 +vt 0.777785 0.457868 +vt 0.735698 0.470480 +vt 0.691341 0.480970 +vt 0.645142 0.489235 +vt 0.597545 0.495196 +vt 0.549008 0.498796 +vt 0.500000 0.500000 +vt 0.450991 0.498796 +vt 0.402454 0.495196 +vt 0.354857 0.489235 +vt 0.308658 0.480970 +vt 0.264301 0.470480 +vt 0.222215 0.457867 +vt 0.182803 0.443252 +vt 0.146446 0.426776 +vt 0.113495 0.408598 +vt 0.084265 0.388892 +vt 0.059039 0.367849 +vt 0.038060 0.345671 +vt 0.021530 0.322571 +vt 0.009607 0.298773 +vt 0.002408 0.274504 +vt 0.000000 0.250000 +vt 0.002408 0.225496 +vt 0.009607 0.201228 +vt 0.021530 0.177429 +vt 0.038060 0.154329 +vt 0.059039 0.132151 +vt 0.084265 0.111108 +vt 0.113494 0.091402 +vt 0.146446 0.073224 +vt 0.182803 0.056748 +vt 0.222214 0.042133 +vt 0.264300 0.029520 +vt 0.308657 0.019030 +vt 0.354856 0.010765 +vt 0.402453 0.004804 +vt 0.450990 0.001204 +vt 0.687500 0.968750 +vt 0.718750 0.968750 +vt 0.718750 1.000000 +vt 0.687500 1.000000 +vt 0.750000 0.968750 +vt 0.781250 0.968750 +vt 0.781250 1.000000 +vt 0.750000 1.000000 +vt 0.656250 0.968750 +vt 0.656250 1.000000 +vt 0.312500 0.968750 +vt 0.343750 0.968750 +vt 0.343750 1.000000 +vt 0.312500 1.000000 +vt 0.250000 0.968750 +vt 0.281250 0.968750 +vt 0.281250 1.000000 +vt 0.250000 1.000000 +vt 0.375000 0.968750 +vt 0.375000 1.000000 +vt 0.281250 0.968750 +vt 0.312500 0.968750 +vt 0.312500 1.000000 +vt 0.281250 1.000000 +vt 0.218750 0.968750 +vt 0.250000 0.968750 +vt 0.250000 1.000000 +vt 0.218750 1.000000 +vt 0.406250 0.968750 +vt 0.437500 0.968750 +vt 0.437500 1.000000 +vt 0.406250 1.000000 +vt 0.031250 0.968750 +vt 0.062500 0.968750 +vt 0.062500 1.000000 +vt 0.031250 1.000000 +vt 0.156250 0.968750 +vt 0.187500 0.968750 +vt 0.187500 1.000000 +vt 0.156250 1.000000 +vt 0.093750 0.968750 +vt 0.093750 1.000000 +vt 0.125000 0.968750 +vt 0.125000 1.000000 +vt 0.593750 0.968750 +vt 0.625000 0.968750 +vt 0.625000 1.000000 +vt 0.593750 1.000000 +vt 0.562500 0.968750 +vt 0.562500 1.000000 +vt 0.531250 0.968750 +vt 0.531250 1.000000 +vt 0.406250 0.968750 +vt 0.406250 1.000000 +vt 0.437500 0.968750 +vt 0.468750 0.968750 +vt 0.468750 1.000000 +vt 0.437500 1.000000 +vt 0.187500 0.968750 +vt 0.187500 1.000000 +vt 0.468750 0.968750 +vt 0.500000 0.968750 +vt 0.500000 1.000000 +vt 0.468750 1.000000 +vt 0.156250 0.968750 +vt 0.156250 1.000000 +vt 0.500000 0.968750 +vt 0.500000 1.000000 +vt 0.218750 0.968750 +vt 0.218750 1.000000 +vt 0.875000 0.968750 +vt 0.906250 0.968750 +vt 0.906250 1.000000 +vt 0.875000 1.000000 +vt 0.531250 0.968750 +vt 0.562500 0.968750 +vt 0.562500 1.000000 +vt 0.531250 1.000000 +vt 0.593750 0.968750 +vt 0.625000 0.968750 +vt 0.625000 1.000000 +vt 0.593750 1.000000 +vt 0.656250 0.968750 +vt 0.687500 0.968750 +vt 0.687500 1.000000 +vt 0.656250 1.000000 +vt 0.906250 0.968750 +vt 0.937500 0.968750 +vt 0.937500 1.000000 +vt 0.906250 1.000000 +vt 0.843750 0.968750 +vt 0.875000 0.968750 +vt 0.875000 1.000000 +vt 0.843750 1.000000 +vt 0.968750 0.968750 +vt 1.000000 0.968750 +vt 1.000000 1.000000 +vt 0.968750 1.000000 +vt 0.718750 0.968750 +vt 0.750000 0.968750 +vt 0.750000 1.000000 +vt 0.718750 1.000000 +vt 0.781250 0.968750 +vt 0.781250 1.000000 +vt 0.812500 0.968750 +vt 0.812500 1.000000 +vt 0.812500 0.968750 +vt 0.812500 1.000000 +vt 0.000000 0.968750 +vt 0.031250 0.968750 +vt 0.031250 1.000000 +vt 0.000000 1.000000 +vt 0.843750 0.968750 +vt 0.843750 1.000000 +vt -0.000000 1.000000 +vt -0.000000 0.968750 +vt 0.375000 0.968750 +vt 0.375000 1.000000 +vt 0.093750 0.968750 +vt 0.125000 0.968750 +vt 0.125000 1.000000 +vt 0.093750 1.000000 +vt 0.968750 0.968750 +vt 1.000000 0.968750 +vt 1.000000 1.000000 +vt 0.968750 1.000000 +vt 0.937500 0.968750 +vt 0.937500 1.000000 +vt 0.343750 0.968750 +vt 0.343750 1.000000 +vt 0.062500 0.968750 +vt 0.062500 1.000000 +vt 0.625000 0.937500 +vt 0.656250 0.937500 +vt 0.562500 0.937500 +vt 0.593750 0.937500 +vt 0.968750 0.937500 +vt 1.000000 0.937500 +vt 0.500000 0.937500 +vt 0.531250 0.937500 +vt 0.468750 0.937500 +vt 0.812500 0.937500 +vt 0.843750 0.937500 +vt 0.468750 0.937500 +vt 0.500000 0.937500 +vt 0.437500 0.937500 +vt 0.937500 0.937500 +vt 0.968750 0.937500 +vt 0.312500 0.937500 +vt 0.343750 0.937500 +vt 0.687500 0.937500 +vt 0.718750 0.937500 +vt 0.437500 0.937500 +vt 0.562500 0.937500 +vt 0.750000 0.937500 +vt 0.781250 0.937500 +vt 0.593750 0.937500 +vt 0.625000 0.937500 +vt 0.531250 0.937500 +vt 0.343750 0.937500 +vt 0.375000 0.937500 +vt 0.406250 0.937500 +vt 0.687500 0.937500 +vt 0.718750 0.937500 +vt 0.093750 0.937500 +vt 0.125000 0.937500 +vt 0.875000 0.937500 +vt 0.906250 0.937500 +vt 0.406250 0.937500 +vt 0.187500 0.937500 +vt 0.218750 0.937500 +vt 0.093750 0.937500 +vt 0.125000 0.937500 +vt 1.000000 0.937500 +vt 0.312500 0.937500 +vt 0.031250 0.937500 +vt 0.062500 0.937500 +vt 0.156250 0.937500 +vt 0.906250 0.937500 +vt 0.250000 0.937500 +vt 0.281250 0.937500 +vt 0.843750 0.937500 +vt 0.875000 0.937500 +vt 0.937500 0.937500 +vt 0.218750 0.937500 +vt 0.250000 0.937500 +vt 0.812500 0.937500 +vt 0.375000 0.937500 +vt 0.031250 0.937500 +vt 0.062500 0.937500 +vt 0.187500 0.937500 +vt 0.656250 0.937500 +vt 0.750000 0.937500 +vt 0.781250 0.937500 +vt 0.000000 0.937500 +vt 0.281250 0.937500 +vt 0.156250 0.937500 +vt -0.000000 0.937500 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 -0.0000 +vn -0.8577 0.0000 0.5141 +vn 0.6716 0.0000 0.7410 +vn -0.9988 0.0000 0.0491 +vn -0.6716 -0.0000 0.7410 +vn -0.9040 0.0000 0.4276 +vn -0.5957 0.0000 0.8032 +vn 0.9988 0.0000 -0.0491 +vn 0.5141 0.0000 0.8577 +vn 0.8032 0.0000 0.5957 +vn 0.7410 0.0000 0.6716 +vn 0.2430 0.0000 -0.9700 +vn -0.3369 -0.0000 -0.9415 +vn 0.4276 0.0000 0.9040 +vn 0.7410 0.0000 -0.6716 +vn -0.8032 0.0000 0.5957 +vn 0.9415 0.0000 0.3369 +vn 0.9040 0.0000 -0.4276 +vn 0.9700 0.0000 -0.2430 +vn -0.3369 0.0000 0.9415 +vn 0.9892 0.0000 -0.1467 +vn -0.9892 0.0000 -0.1467 +vn -0.4276 0.0000 0.9040 +vn 0.8577 -0.0000 0.5141 +vn -0.5141 0.0000 -0.8577 +vn 0.5957 0.0000 -0.8032 +vn -0.0491 0.0000 -0.9988 +vn -0.7410 -0.0000 0.6716 +vn -0.9700 0.0000 -0.2430 +vn 0.9040 -0.0000 0.4276 +vn -0.6716 0.0000 -0.7409 +vn 0.6716 -0.0000 -0.7410 +vn 0.9700 -0.0000 0.2430 +vn -0.9040 0.0000 -0.4276 +vn 0.2430 0.0000 0.9700 +vn 0.8577 0.0000 -0.5141 +vn -0.9700 0.0000 0.2430 +vn -0.9892 0.0000 0.1467 +vn 0.5141 0.0000 -0.8577 +vn 0.9988 0.0000 0.0491 +vn 0.9415 0.0000 -0.3369 +vn 0.8032 0.0000 -0.5957 +vn 0.3369 0.0000 -0.9415 +vn -0.9415 0.0000 -0.3369 +vn -0.9415 0.0000 0.3369 +vn -0.8032 0.0000 -0.5957 +vn 0.5957 0.0000 0.8032 +vn -0.2430 0.0000 0.9700 +vn 0.4276 0.0000 -0.9040 +vn -0.1467 0.0000 -0.9892 +vn 0.3369 0.0000 0.9415 +vn -0.7410 0.0000 -0.6716 +vn 0.1467 0.0000 0.9892 +vn 0.1467 0.0000 -0.9892 +vn -0.5957 0.0000 -0.8032 +vn -0.5141 0.0000 0.8577 +vn 0.9892 0.0000 0.1467 +vn -0.1467 0.0000 0.9892 +vn 0.0491 0.0000 -0.9988 +vn -0.8577 0.0000 -0.5141 +vn -0.0491 0.0000 0.9988 +vn 0.0491 -0.0000 0.9988 +vn -0.9988 0.0000 -0.0491 +vn -0.2430 -0.0000 -0.9700 +vn -0.4276 0.0000 -0.9040 +vn 0.3635 0.7071 -0.6065 +vn 0.6995 0.7071 -0.1038 +vn 0.6859 0.7071 -0.1718 +vn 0.3023 0.7071 -0.6392 +vn 0.6859 0.7071 0.1718 +vn 0.6392 0.7071 0.3023 +vn 0.6995 0.7071 0.1038 +vn 0.7063 0.7071 0.0347 +vn 0.6392 0.7071 -0.3023 +vn -0.4212 0.7071 -0.5680 +vn 0.6658 0.7071 -0.2382 +vn 0.2382 0.7071 -0.6658 +vn -0.7063 0.7071 0.0347 +vn 0.6065 0.7071 0.3635 +vn 0.7063 0.7071 -0.0347 +vn 0.5680 0.7071 0.4212 +vn -0.6065 0.7071 -0.3635 +vn -0.5680 0.7071 -0.4212 +vn -0.5239 0.7071 -0.4749 +vn -0.4749 0.7071 -0.5239 +vn -0.3023 0.7071 -0.6392 +vn -0.6995 0.7071 -0.1038 +vn -0.6658 0.7071 -0.2382 +vn -0.7063 0.7071 -0.0347 +vn -0.6392 0.7071 -0.3023 +vn -0.6859 0.7071 -0.1718 +vn -0.1718 0.7071 -0.6859 +vn -0.3635 0.7071 -0.6065 +vn -0.2382 0.7071 -0.6658 +vn -0.0347 0.7071 -0.7063 +vn -0.1038 0.7071 -0.6995 +vn 0.6658 0.7071 0.2382 +vn -0.5680 0.7071 0.4212 +vn 0.0347 0.7071 0.7063 +vn -0.5239 0.7071 0.4749 +vn -0.0347 0.7071 0.7063 +vn 0.1038 0.7071 -0.6995 +vn 0.6065 0.7071 -0.3635 +vn 0.0347 0.7071 -0.7063 +vn 0.5680 0.7071 -0.4212 +vn -0.1718 0.7071 0.6859 +vn -0.6658 0.7071 0.2382 +vn -0.1038 0.7071 0.6995 +vn -0.2382 0.7071 0.6658 +vn 0.1038 0.7071 0.6995 +vn 0.3023 0.7071 0.6392 +vn 0.1718 0.7071 0.6859 +vn 0.2382 0.7071 0.6658 +vn -0.6392 0.7071 0.3023 +vn -0.6859 0.7071 0.1718 +vn -0.6065 0.7071 0.3635 +vn -0.6995 0.7071 0.1038 +vn 0.4749 0.7071 -0.5239 +vn 0.1718 0.7071 -0.6859 +vn 0.5239 0.7071 -0.4749 +vn 0.4212 0.7071 -0.5680 +vn -0.4212 0.7071 0.5680 +vn -0.3023 0.7071 0.6392 +vn -0.4749 0.7071 0.5239 +vn -0.3635 0.7071 0.6065 +vn 0.4749 0.7071 0.5239 +vn 0.3635 0.7071 0.6065 +vn 0.5239 0.7071 0.4749 +vn 0.4212 0.7071 0.5680 +vn -0.6716 0.0000 -0.7410 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +g Cube_Cube.001_top-bottom s off -f 1/1 2/2 4/3 3/4 -f 3/4 4/3 6/5 5/6 -f 5/6 6/5 8/7 7/8 -f 7/8 8/7 10/9 9/10 -f 9/10 10/9 12/11 11/12 -f 11/12 12/11 14/13 13/14 -f 13/14 14/13 16/15 15/16 -f 15/16 16/15 18/17 17/18 -f 17/19 18/20 20/21 19/22 -f 19/22 20/21 22/23 21/24 -f 21/24 22/23 24/25 23/26 -f 23/26 24/25 26/27 25/28 -f 25/28 26/27 28/29 27/30 -f 27/30 28/29 30/31 29/32 -f 29/32 30/31 32/33 31/34 -f 31/34 32/33 34/35 33/36 -f 33/37 34/38 36/39 35/40 -f 35/40 36/39 38/41 37/42 -f 37/42 38/41 40/43 39/44 -f 39/44 40/43 42/45 41/46 -f 41/46 42/45 44/47 43/48 -f 43/48 44/47 46/49 45/50 -f 45/50 46/49 48/51 47/52 -f 47/52 48/51 50/53 49/54 -f 49/55 50/56 52/57 51/58 -f 51/58 52/57 54/59 53/60 -f 53/60 54/59 56/61 55/62 -f 55/62 56/61 58/63 57/64 -f 57/64 58/63 60/65 59/66 -f 59/66 60/65 62/67 61/68 -f 54/59 52/57 90/57 91/59 -f 63/69 64/70 2/71 1/72 -f 61/68 62/67 64/70 63/69 -f 1/73 3/74 5/75 7/76 9/77 11/78 13/79 15/80 17/81 19/82 21/83 23/84 25/85 27/86 29/87 31/88 33/89 35/90 37/91 39/92 41/93 43/94 45/95 47/96 49/97 51/98 53/99 55/100 57/101 59/102 61/103 63/104 -f 66/105 65/106 96/107 95/108 94/109 93/110 92/111 91/112 90/113 89/114 88/115 87/116 86/117 85/118 84/119 83/120 82/121 81/122 80/123 79/124 78/125 77/126 76/127 75/128 74/129 73/130 72/131 71/132 70/133 69/134 68/135 67/136 -f 10/9 8/7 68/7 69/9 -f 32/33 30/31 79/31 80/33 -f 60/65 58/63 93/63 94/65 -f 38/41 36/39 82/39 83/41 -f 16/15 14/13 71/13 72/15 -f 2/71 64/70 96/70 65/71 -f 44/47 42/45 85/45 86/47 -f 22/23 20/21 74/21 75/23 -f 50/53 48/51 88/51 89/53 -f 6/5 4/3 66/3 67/5 -f 28/29 26/27 77/27 78/29 -f 56/61 54/59 91/59 92/61 -f 12/11 10/9 69/9 70/11 -f 34/35 32/33 80/33 81/35 -f 62/67 60/65 94/65 95/67 -f 40/43 38/41 83/41 84/43 -f 4/3 2/2 65/2 66/3 -f 18/17 16/15 72/15 73/17 -f 46/49 44/47 86/47 87/49 -f 24/25 22/23 75/23 76/25 -f 52/57 50/56 89/56 90/57 -f 8/7 6/5 67/5 68/7 -f 30/31 28/29 78/29 79/31 -f 58/63 56/61 92/61 93/63 -f 36/39 34/38 81/38 82/39 -f 14/13 12/11 70/11 71/13 -f 64/70 62/67 95/67 96/70 -f 42/45 40/43 84/43 85/45 -f 20/21 18/20 73/20 74/21 -f 48/51 46/49 87/49 88/51 -f 26/27 24/25 76/25 77/27 +f 59/1/1 71/2/1 73/3/1 22/4/1 26/5/1 9/6/1 1/7/1 100/8/1 98/9/1 78/10/1 76/11/1 74/12/1 21/13/1 11/14/1 8/15/1 6/16/1 28/17/1 19/18/1 13/19/1 14/20/1 17/21/1 15/22/1 32/23/1 33/24/1 106/25/1 108/26/1 110/27/1 88/28/1 90/29/1 92/30/1 87/31/1 64/32/1 65/33/1 69/34/1 83/35/1 80/36/1 85/37/1 105/38/1 103/39/1 101/40/1 67/41/1 61/42/1 62/43/1 93/44/1 94/45/1 81/46/1 96/47/1 30/48/1 4/49/1 52/50/1 38/51/1 50/52/1 49/53/1 36/54/1 35/55/1 39/56/1 41/57/1 43/58/1 24/59/1 47/60/1 45/61/1 56/62/1 54/63/1 57/64/1 +f 256/65/2 251/66/2 254/67/2 241/68/2 244/69/2 217/70/2 240/71/2 237/72/2 235/73/2 229/74/2 232/75/2 245/76/2 248/77/2 233/78/2 250/79/2 194/80/2 224/81/2 301/82/2 283/83/2 300/84/2 298/85/2 261/86/2 260/87/2 268/88/2 307/89/2 310/90/2 311/91/2 287/92/2 281/93/2 286/94/2 269/95/2 265/96/2 264/97/2 290/98/2 296/99/2 293/100/2 292/101/2 318/102/2 315/103/2 314/104/2 227/105/2 225/106/2 207/107/2 210/108/2 205/109/2 204/110/2 212/111/2 221/112/2 195/113/2 198/114/2 202/115/2 213/116/2 276/117/2 278/118/2 280/119/2 303/120/2 306/121/2 192/122/2 200/123/2 220/124/2 216/125/2 273/126/2 272/127/2 257/128/2 +g Cube_Cube.001_edges +f 93/129/3 62/130/3 262/131/3 297/132/3 +f 108/133/4 106/134/4 313/135/4 316/136/4 +f 223/137/5 2/138/5 4/139/5 30/140/5 +f 67/141/6 101/142/6 308/143/6 267/144/6 +f 94/145/7 93/129/7 297/132/7 299/146/7 +f 101/142/8 103/147/8 309/148/8 308/143/8 +f 196/149/9 222/150/9 28/151/9 6/152/9 +f 88/153/10 110/154/10 317/155/10 291/156/10 +f 33/157/11 32/158/11 226/159/11 228/160/11 +f 106/134/12 33/157/12 228/160/12 313/135/12 +f 22/161/13 73/162/13 274/163/13 215/164/13 +f 56/165/14 45/166/14 242/167/14 253/168/14 +f 90/169/15 88/153/15 291/156/15 294/170/15 +f 78/171/16 98/172/16 304/173/16 279/174/16 +f 62/130/17 61/175/17 259/176/17 262/131/17 +f 17/177/18 14/178/18 206/179/18 209/180/18 +f 21/181/19 74/182/19 275/183/19 214/184/19 +f 8/185/20 11/186/20 201/187/20 197/188/20 +f 85/189/21 80/190/21 282/191/21 288/192/21 +f 6/152/22 8/185/22 197/188/22 196/149/22 +f 38/193/23 52/194/23 249/195/23 234/196/23 +f 105/197/24 85/189/24 288/192/24 312/198/24 +f 32/158/25 15/199/25 208/200/25 226/159/25 +f 47/201/26 24/202/26 218/203/26 243/204/26 +f 100/205/27 1/206/27 193/207/27 305/208/27 +f 59/209/28 57/210/28 255/211/28 258/212/28 +f 61/175/29 67/141/29 267/144/29 259/176/29 +f 50/213/30 38/193/30 234/196/30 247/214/30 +f 15/199/31 17/177/31 209/180/31 208/200/31 +f 43/215/32 41/216/32 238/217/32 239/218/32 +f 98/172/33 100/205/33 305/208/33 304/173/33 +f 14/178/34 13/219/34 203/220/34 206/179/34 +f 36/221/35 49/222/35 246/223/35 231/224/35 +f 87/225/36 92/226/36 295/227/36 289/228/36 +f 74/182/37 76/229/37 277/230/37 275/183/37 +f 96/231/38 81/232/38 284/233/38 302/234/38 +f 30/140/39 96/231/39 302/234/39 223/137/39 +f 1/206/40 9/235/40 199/236/40 193/207/40 +f 19/237/41 28/238/41 222/239/41 211/240/41 +f 11/186/42 21/181/42 214/184/42 201/187/42 +f 76/229/43 78/171/43 279/174/43 277/230/43 +f 26/241/44 22/161/44 215/164/44 219/242/44 +f 49/222/45 50/213/45 247/214/45 246/223/45 +f 81/232/46 94/145/46 299/146/46 284/233/46 +f 39/243/47 35/244/47 230/245/47 236/246/47 +f 110/154/48 108/133/48 316/136/48 317/155/48 +f 80/190/49 83/247/49 285/248/49 282/191/49 +f 9/235/50 26/241/50 219/242/50 199/236/50 +f 57/210/51 54/249/51 252/250/51 255/211/51 +f 92/226/52 90/169/52 294/170/52 295/227/52 +f 41/216/53 39/243/53 236/246/53 238/217/53 +f 64/251/54 87/225/54 289/228/54 263/252/54 +f 73/162/55 71/253/55 271/254/55 274/163/55 +f 24/202/56 43/215/56 239/218/56 218/203/56 +f 103/147/57 105/197/57 312/198/57 309/148/57 +f 13/219/58 19/237/58 211/240/58 203/220/58 +f 83/247/59 69/255/59 270/256/59 285/248/59 +f 71/253/60 59/209/60 258/212/60 271/254/60 +f 35/244/61 36/221/61 231/224/61 230/245/61 +f 69/255/62 65/257/62 266/258/62 270/256/62 +f 263/252/63 266/258/63 65/257/63 64/251/63 +f 52/194/64 4/259/64 2/260/64 249/195/64 +f 54/249/65 56/165/65 253/168/65 252/250/65 +f 45/166/66 47/201/66 243/204/66 242/167/66 +f 193/207/67 199/236/67 200/261/67 192/262/67 +f 196/149/68 197/188/68 198/263/68 195/264/68 +f 197/188/69 201/187/69 202/265/69 198/263/69 +f 199/236/70 219/242/70 220/266/70 200/261/70 +f 206/179/71 203/220/71 204/267/71 205/268/71 +f 208/200/72 209/180/72 210/269/72 207/270/72 +f 203/220/73 211/240/73 212/271/73 204/267/73 +f 211/240/74 222/239/74 221/272/74 212/271/74 +f 214/184/75 275/183/75 276/273/75 213/274/75 +f 218/203/76 239/218/76 240/275/76 217/276/76 +f 201/187/77 214/184/77 213/274/77 202/265/77 +f 219/242/78 215/164/78 216/277/78 220/266/78 +f 224/278/79 194/279/79 2/138/79 223/137/79 +f 226/159/80 208/200/80 207/270/80 225/280/80 +f 222/150/81 196/149/81 195/264/81 221/281/81 +f 228/160/82 226/159/82 225/280/82 227/282/82 +f 230/245/83 231/224/83 232/283/83 229/284/83 +f 236/246/84 230/245/84 229/284/84 235/285/84 +f 238/217/85 236/246/85 235/285/85 237/286/85 +f 239/218/86 238/217/86 237/286/86 240/275/86 +f 242/167/87 243/204/87 244/287/87 241/288/87 +f 234/196/88 249/195/88 250/289/88 233/290/88 +f 246/223/89 247/214/89 248/291/89 245/292/89 +f 249/195/90 2/260/90 194/293/90 250/289/90 +f 231/224/91 246/223/91 245/292/91 232/283/91 +f 247/214/92 234/196/92 233/290/92 248/291/92 +f 252/250/93 253/168/93 254/294/93 251/295/93 +f 243/204/94 218/203/94 217/276/94 244/287/94 +f 253/168/95 242/167/95 241/288/95 254/294/95 +f 258/212/96 255/211/96 256/296/96 257/297/96 +f 255/211/97 252/250/97 251/295/97 256/296/97 +f 209/180/98 206/179/98 205/268/98 210/269/98 +f 262/131/99 259/176/99 260/298/99 261/299/99 +f 264/300/100 265/301/100 266/258/100 263/252/100 +f 259/176/101 267/144/101 268/302/101 260/298/101 +f 270/256/102 266/258/102 265/301/102 269/303/102 +f 274/163/103 271/254/103 272/304/103 273/305/103 +f 275/183/104 277/230/104 278/306/104 276/273/104 +f 271/254/105 258/212/105 257/297/105 272/304/105 +f 277/230/106 279/174/106 280/307/106 278/306/106 +f 282/191/107 285/248/107 286/308/107 281/309/107 +f 284/233/108 299/146/108 300/310/108 283/311/108 +f 285/248/109 270/256/109 269/303/109 286/308/109 +f 288/192/110 282/191/110 281/309/110 287/312/110 +f 263/252/111 289/228/111 290/313/111 264/300/111 +f 294/170/112 291/156/112 292/314/112 293/315/112 +f 289/228/113 295/227/113 296/316/113 290/313/113 +f 295/227/114 294/170/114 293/315/114 296/316/114 +f 299/146/115 297/132/115 298/317/115 300/310/115 +f 302/234/116 284/233/116 283/311/116 301/318/116 +f 297/132/117 262/131/117 261/299/117 298/317/117 +f 223/137/118 302/234/118 301/318/118 224/278/118 +f 304/173/119 305/208/119 306/319/119 303/320/119 +f 215/164/120 274/163/120 273/305/120 216/277/120 +f 279/174/121 304/173/121 303/320/121 280/307/121 +f 305/208/122 193/207/122 192/262/122 306/319/122 +f 308/143/123 309/148/123 310/321/123 307/322/123 +f 312/198/124 288/192/124 287/312/124 311/323/124 +f 267/144/125 308/143/125 307/322/125 268/302/125 +f 309/148/126 312/198/126 311/323/126 310/321/126 +f 316/136/127 313/135/127 314/324/127 315/325/127 +f 291/156/128 317/155/128 318/326/128 292/314/128 +f 313/135/129 228/160/129 227/282/129 314/324/129 +f 317/155/130 316/136/130 315/325/130 318/326/130 +g Cube_Cube.001_top-bot_with_legs +f 107/327/2 116/328/2 111/329/2 129/330/2 345/331/2 161/332/2 130/333/2 135/334/2 342/335/2 142/336/2 340/337/2 123/338/2 346/339/2 341/340/2 347/341/2 320/342/2 150/343/2 31/344/2 366/345/2 374/346/2 373/347/2 99/348/2 351/349/2 357/350/2 20/351/2 379/352/2 380/353/2 55/354/2 365/355/2 368/356/2 86/357/2 354/358/2 353/359/2 370/360/2 372/361/2 44/362/2 46/363/2 384/364/2 7/365/2 382/366/2 144/367/2 148/368/2 328/369/2 171/370/2 326/371/2 177/372/2 331/373/2 154/374/2 187/375/2 323/376/2 179/377/2 332/378/2 363/379/2 70/380/2 66/381/2 27/382/2 377/383/2 191/384/2 324/385/2 156/386/2 163/387/2 79/388/2 360/389/2 350/390/2 +f 155/391/1 167/392/1 168/393/1 128/394/1 131/395/1 378/396/1 383/397/1 184/398/1 325/399/1 172/400/1 170/401/1 339/402/1 371/403/1 119/404/1 117/405/1 381/406/1 133/407/1 125/408/1 376/409/1 375/410/1 124/411/1 122/412/1 136/413/1 364/414/1 321/415/1 319/416/1 112/417/1 334/418/1 333/419/1 330/420/1 335/421/1 344/422/1 162/423/1 165/424/1 336/425/1 338/426/1 176/427/1 189/428/1 322/429/1 186/430/1 343/431/1 157/432/1 159/433/1 181/434/1 329/435/1 337/436/1 327/437/1 367/438/1 114/439/1 149/440/1 361/441/1 147/442/1 145/443/1 362/444/1 138/445/1 359/446/1 358/447/1 356/448/1 369/449/1 352/450/1 355/451/1 348/452/1 349/453/1 153/454/1 +g Cube_Cube.001_edges_with_legs +f 3/455/130 5/456/130 7/457/130 384/458/130 +f 10/459/129 143/460/129 144/461/129 382/462/129 +f 48/463/128 3/455/128 384/458/128 46/464/128 +f 5/456/127 10/459/127 382/462/127 7/457/127 +f 16/465/126 12/466/126 380/467/126 379/468/126 +f 89/469/125 18/470/125 20/471/125 357/472/125 +f 12/466/124 53/473/124 55/474/124 380/467/124 +f 18/470/123 16/465/123 379/468/123 20/471/123 +f 23/475/122 190/476/122 191/477/122 377/478/122 +f 68/479/121 25/480/121 27/481/121 66/482/121 +f 164/483/120 77/484/120 79/485/120 163/486/120 +f 25/480/119 23/475/119 377/478/119 27/481/119 +f 151/487/118 29/488/118 31/489/118 150/490/118 +f 37/491/117 97/492/117 99/493/117 373/494/117 +f 29/488/116 60/495/116 366/496/116 31/489/116 +f 34/497/115 37/491/115 373/494/115 374/498/115 +f 40/499/114 42/500/114 44/501/114 372/502/114 +f 51/503/113 40/499/113 372/502/113 370/504/113 +f 42/500/112 48/463/112 46/464/112 44/501/112 +f 95/505/111 51/503/111 370/504/111 353/506/111 +f 53/473/110 63/507/110 365/508/110 55/474/110 +f 58/509/109 84/510/109 86/511/109 368/512/109 +f 60/495/108 34/497/108 374/498/108 366/496/108 +f 63/507/107 58/509/107 368/512/107 365/508/107 +f 72/513/106 68/479/106 66/482/106 70/514/106 +f 82/515/105 104/516/105 350/517/105 360/518/105 +f 75/519/104 72/513/104 70/514/104 363/520/104 +f 77/484/103 82/515/103 360/518/103 79/485/103 +f 84/510/102 91/521/102 354/522/102 86/511/102 +f 102/523/101 89/469/101 357/472/101 351/524/101 +f 353/506/100 354/522/100 91/521/100 95/505/100 +f 97/492/99 102/523/99 351/524/99 99/493/99 +f 173/525/98 175/526/98 326/527/98 171/528/98 +f 109/529/97 115/530/97 116/531/97 107/532/97 +f 104/516/96 109/529/96 107/532/96 350/517/96 +f 113/533/95 127/534/95 129/535/95 111/536/95 +f 126/537/94 160/538/94 161/539/94 345/540/94 +f 115/530/93 113/533/93 111/536/93 116/531/93 +f 120/541/92 139/542/92 341/543/92 346/544/92 +f 140/545/91 121/546/91 123/547/91 340/548/91 +f 118/549/90 188/550/90 320/551/90 347/552/90 +f 121/546/89 120/541/89 346/544/89 123/547/89 +f 139/542/88 118/549/88 347/552/88 341/543/88 +f 127/534/87 126/537/87 345/540/87 129/535/87 +f 132/553/86 134/554/86 135/555/86 130/556/86 +f 134/554/85 137/557/85 342/558/85 135/555/85 +f 137/557/84 141/559/84 142/560/84 342/558/84 +f 141/559/83 140/545/83 340/548/83 142/560/83 +f 143/460/82 146/561/82 148/562/82 144/461/82 +f 152/563/81 185/564/81 187/565/81 154/566/81 +f 146/561/80 174/567/80 328/568/80 148/562/80 +f 150/490/79 320/569/79 188/570/79 151/487/79 +f 158/571/78 164/483/78 163/486/78 156/572/78 +f 180/573/77 166/574/77 332/575/77 179/576/77 +f 160/538/76 132/553/76 130/556/76 161/539/76 +f 166/574/75 75/519/75 363/520/75 332/575/75 +f 169/577/74 152/578/74 154/579/74 331/580/74 +f 178/581/73 169/577/73 331/580/73 177/582/73 +f 174/567/72 173/525/72 171/528/72 328/568/72 +f 175/526/71 178/581/71 177/582/71 326/527/71 +f 182/583/70 158/571/70 156/572/70 324/584/70 +f 183/585/69 180/573/69 179/576/69 323/586/69 +f 185/564/68 183/585/68 323/586/68 187/565/68 +f 190/476/67 182/583/67 324/584/67 191/477/67 +f 355/587/66 352/588/66 126/537/66 127/534/66 +f 349/589/65 348/590/65 113/533/65 115/530/65 +f 149/591/64 114/592/64 188/550/64 118/549/64 +f 95/505/63 91/521/63 162/593/63 344/594/63 +f 165/595/62 162/593/62 91/521/62 84/510/62 +f 138/596/61 362/597/61 140/545/61 141/559/61 +f 167/598/60 155/599/60 104/516/60 82/515/60 +f 336/600/59 165/595/59 84/510/59 58/509/59 +f 376/601/58 125/602/58 169/577/58 178/581/58 +f 322/603/57 189/604/57 12/466/57 16/465/57 +f 369/605/56 356/606/56 132/553/56 160/538/56 +f 168/607/55 167/598/55 82/515/55 77/484/55 +f 344/594/54 335/608/54 51/503/54 95/505/54 +f 358/609/53 359/610/53 137/557/53 134/554/53 +f 330/611/52 333/612/52 42/500/52 40/499/52 +f 153/613/51 349/589/51 115/530/51 109/529/51 +f 378/614/50 131/615/50 158/571/50 182/583/50 +f 338/616/49 336/600/49 58/509/49 63/507/49 +f 112/617/48 319/618/48 5/456/48 3/455/48 +f 359/610/47 138/596/47 141/559/47 137/557/47 +f 337/619/46 329/620/46 34/497/46 60/495/46 +f 145/621/45 147/622/45 120/541/45 121/546/45 +f 131/615/44 128/623/44 164/483/44 158/571/44 +f 170/624/43 172/625/43 68/479/43 72/513/43 +f 119/626/42 371/627/42 166/574/42 180/573/42 +f 125/602/41 133/628/41 152/578/41 169/577/41 +f 383/629/40 378/614/40 182/583/40 190/476/40 +f 367/630/39 327/631/39 29/488/39 151/487/39 +f 327/631/38 337/619/38 60/495/38 29/488/38 +f 339/632/37 170/624/37 72/513/37 75/519/37 +f 335/608/36 330/611/36 40/499/36 51/503/36 +f 362/597/35 145/621/35 121/546/35 140/545/35 +f 375/633/34 376/601/34 178/581/34 175/526/34 +f 325/634/33 184/635/33 23/475/33 25/480/33 +f 356/606/131 358/609/131 134/554/131 132/553/131 +f 122/636/31 124/637/31 173/525/31 174/567/31 +f 147/622/30 361/638/30 139/542/30 120/541/30 +f 157/639/29 343/640/29 89/469/29 102/523/29 +f 155/599/28 153/613/28 109/529/28 104/516/28 +f 184/635/27 383/629/27 190/476/27 23/475/27 +f 352/588/26 369/605/26 160/538/26 126/537/26 +f 136/641/25 122/636/25 174/567/25 146/561/25 +f 189/604/24 176/642/24 53/473/24 12/466/24 +f 361/638/23 149/591/23 118/549/23 139/542/23 +f 381/643/22 117/644/22 183/585/22 185/564/22 +f 176/642/21 338/616/21 63/507/21 53/473/21 +f 117/644/20 119/626/20 180/573/20 183/585/20 +f 371/627/19 339/632/19 75/519/19 166/574/19 +f 124/637/18 375/633/18 175/526/18 173/525/18 +f 159/645/17 157/639/17 102/523/17 97/492/17 +f 172/625/16 325/634/16 25/480/16 68/479/16 +f 333/612/15 334/646/15 48/463/15 42/500/15 +f 348/590/14 355/587/14 127/534/14 113/533/14 +f 128/623/13 168/607/13 77/484/13 164/483/13 +f 321/647/12 364/648/12 143/460/12 10/459/12 +f 364/648/11 136/641/11 146/561/11 143/460/11 +f 334/646/10 112/617/10 3/455/10 48/463/10 +f 185/564/9 152/563/9 133/649/9 381/643/9 +f 186/650/8 322/603/8 16/465/8 18/470/8 +f 329/620/7 181/651/7 37/491/7 34/497/7 +f 343/640/6 186/650/6 18/470/6 89/469/6 +f 151/487/5 188/570/5 114/652/5 367/630/5 +f 319/618/4 321/647/4 10/459/4 5/456/4 +f 181/651/3 159/645/3 97/492/3 37/491/3 +g Cube_Cube.001_legs +f 389/653/132 391/654/132 392/655/132 390/656/132 +f 385/657/133 387/658/133 388/659/133 386/660/133 diff --git a/mods/homedecor_tables/models/homedecor_table_small_square.obj b/mods/homedecor_tables/models/homedecor_table_small_square.obj index 5bb07ee3..bec5c536 100644 --- a/mods/homedecor_tables/models/homedecor_table_small_square.obj +++ b/mods/homedecor_tables/models/homedecor_table_small_square.obj @@ -1,43 +1,139 @@ -v 0.499 -0.499 -0.499 -v 0.499 -0.499 0.499 -v -0.499 -0.499 0.499 -v -0.499 -0.499 -0.499 -v 0.499 -0.469 -0.499 -v 0.499 -0.469 0.499 -v -0.499 -0.469 0.499 -v -0.499 -0.469 -0.499 -v 0.469 -0.437 -0.469 -v 0.469 -0.437 0.469 -v -0.469 -0.437 0.469 -v -0.469 -0.437 -0.469 -vt 0.5 0.029 -vt 0.971 0.029 -vt 0.971 0.5 -vt 0.5 0.5 -vt 0.015 0.985 -vt 0.015 0.515 -vt 0.029 0.529 -vt 0.029 0.971 -vt 0.985 0.5 -vt 0.985 0.029 -vt 0.5 0.515 -vt 0.971 0.515 -vt 0.485 0.029 -vt 0.485 0.5 -vt 0.971 0.015 -vt 0.5 0.015 -vt 0.471 0.971 -vt 0.471 0.529 -vt 0.485 0.515 -vt 0.485 0.985 +# Blender v2.83.5 OBJ File: 'homedecor small square table with legs.blend' +# www.blender.org +o Cube_Cube.001 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 0.437500 -0.500000 +v -0.353553 -0.500000 0.353554 +v -0.353553 0.437515 0.353554 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.437515 -0.353553 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 0.437500 -0.500000 +v 0.500000 0.437500 0.500000 +v -0.500000 0.437500 0.500000 +v 0.353553 -0.500000 0.353554 +v 0.353553 0.437515 0.353554 +v -0.353553 -0.500000 -0.353553 +v -0.353553 0.437515 -0.353553 +v 0.468750 0.500000 0.468750 +v 0.500000 0.468750 0.500000 +v 0.500000 0.468750 -0.500000 +v 0.468750 0.500000 -0.468750 +v 0.500000 -0.468750 -0.500000 +v 0.468750 -0.437500 -0.468750 +v 0.500000 -0.468750 0.500000 +v 0.468750 -0.437500 0.468750 +v -0.500000 -0.468750 -0.500000 +v -0.468750 -0.437500 -0.468750 +v -0.468750 -0.437500 0.468750 +v -0.500000 -0.468750 0.500000 +v -0.468750 0.500000 -0.468750 +v -0.500000 0.468750 -0.500000 +v -0.468750 0.500000 0.468750 +v -0.500000 0.468750 0.500000 +vt -0.000000 -0.000000 +vt 1.000000 -0.000000 +vt 1.000000 0.500000 +vt -0.000000 0.500000 +vt 0.968750 0.984375 +vt 0.031250 0.984375 +vt 0.031250 0.515625 +vt 0.968750 0.515625 +vt 0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 -0.000000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +vt 0.000000 -0.000000 +vt 0.031250 0.515625 +vt 0.968750 0.515625 +vt 0.968750 0.984375 +vt 0.031250 0.984375 +vt 0.000000 1.000000 +vt 0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 1.000000 0.937500 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.968750 +vt 0.000000 0.968750 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.7071 0.7071 +vn 0.7071 0.7071 0.0000 +vn 0.0000 0.7071 -0.7071 +vn -0.7071 0.7071 0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.0000 0.0000 -1.0000 +vn -1.0000 0.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +g Cube_Cube.001_top-bottom s off -f 1/1 2/2 3/3 4/4 -f 8/5 7/6 11/7 12/8 -f 1/9 5/3 6/2 2/10 -f 2/11 6/4 7/3 3/12 -f 3/13 7/1 8/4 4/14 -f 5/15 1/2 4/1 8/16 -f 9/17 12/8 11/7 10/18 -f 7/6 6/19 10/18 11/7 -f 5/20 8/5 12/8 9/17 -f 6/19 5/20 9/17 10/18 +f 9/1/1 2/2/1 8/3/1 1/4/1 +f 22/5/2 26/6/2 27/7/2 24/8/2 +f 24/8/3 27/7/3 28/9/3 23/10/3 +f 22/5/4 24/8/4 23/10/4 21/11/4 +f 26/6/5 22/5/5 21/11/5 25/12/5 +f 27/7/6 26/6/6 25/12/6 28/9/6 +g Cube_Cube.001_edges +f 23/13/7 28/14/7 1/15/7 8/16/7 +f 25/17/8 21/18/8 2/19/8 9/20/8 +f 25/21/9 9/22/9 1/23/9 28/24/9 +f 21/25/10 23/26/10 8/27/10 2/28/10 +g Cube_Cube.001_top-bot_with_legs +f 10/29/1 11/30/1 12/31/1 3/32/1 +f 31/33/2 17/34/2 20/35/2 29/36/2 +f 31/33/6 29/36/6 30/37/6 32/38/6 +f 20/35/4 17/34/4 18/39/4 19/40/4 +f 17/34/3 31/33/3 32/38/3 18/39/3 +f 29/36/5 20/35/5 19/40/5 30/37/5 +g Cube_Cube.001_edges_with_legs +f 32/41/7 12/42/7 11/43/7 18/44/7 +f 19/45/8 10/46/8 3/47/8 30/48/8 +f 12/49/9 32/50/9 30/51/9 3/52/9 +f 19/53/10 18/54/10 11/55/10 10/56/10 +g Cube_Cube.001_legs +f 13/57/11 15/58/11 16/59/11 14/60/11 +f 4/61/12 6/62/12 7/63/12 5/64/12 diff --git a/mods/homedecor_tables/textures/homedecor_glass_face_clean.png b/mods/homedecor_tables/textures/homedecor_glass_face_clean.png deleted file mode 100644 index d955612a..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_glass_face_clean.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_large_edges.png b/mods/homedecor_tables/textures/homedecor_glass_table_edges.png similarity index 100% rename from mods/homedecor_tables/textures/homedecor_glass_table_large_edges.png rename to mods/homedecor_tables/textures/homedecor_glass_table_edges.png diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_large_inv.png b/mods/homedecor_tables/textures/homedecor_glass_table_large_inv.png deleted file mode 100644 index c8bc8575..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_large_inv.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_large_square.png b/mods/homedecor_tables/textures/homedecor_glass_table_large_square.png new file mode 100644 index 00000000..3f58b48f Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_glass_table_large_square.png differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_large_square_inv.png b/mods/homedecor_tables/textures/homedecor_glass_table_large_square_inv.png new file mode 100644 index 00000000..24ea176c Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_glass_table_large_square_inv.png differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_large_tb.png b/mods/homedecor_tables/textures/homedecor_glass_table_large_tb.png deleted file mode 100644 index ca9a14ef..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_large_tb.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_small_round.png b/mods/homedecor_tables/textures/homedecor_glass_table_small_round.png index 1932f0fe..1329b1b5 100644 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_small_round.png and b/mods/homedecor_tables/textures/homedecor_glass_table_small_round.png differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_small_round_inv.png b/mods/homedecor_tables/textures/homedecor_glass_table_small_round_inv.png index 0d868375..d6af4772 100644 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_small_round_inv.png and b/mods/homedecor_tables/textures/homedecor_glass_table_small_round_inv.png differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_small_square.png b/mods/homedecor_tables/textures/homedecor_glass_table_small_square.png index 66baf21b..e89ea540 100644 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_small_square.png and b/mods/homedecor_tables/textures/homedecor_glass_table_small_square.png differ diff --git a/mods/homedecor_tables/textures/homedecor_glass_table_small_square_inv.png b/mods/homedecor_tables/textures/homedecor_glass_table_small_square_inv.png index f768314d..aa4079c4 100644 Binary files a/mods/homedecor_tables/textures/homedecor_glass_table_small_square_inv.png and b/mods/homedecor_tables/textures/homedecor_glass_table_small_square_inv.png differ diff --git a/mods/homedecor_tables/textures/homedecor_table_legs_brass.png b/mods/homedecor_tables/textures/homedecor_table_legs_brass.png index f0e8bf95..ab80ee76 100644 Binary files a/mods/homedecor_tables/textures/homedecor_table_legs_brass.png and b/mods/homedecor_tables/textures/homedecor_table_legs_brass.png differ diff --git a/mods/homedecor_tables/textures/homedecor_table_legs_wood.png b/mods/homedecor_tables/textures/homedecor_table_legs_wood.png new file mode 100644 index 00000000..c8c658eb Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_table_legs_wood.png differ diff --git a/mods/homedecor_tables/textures/homedecor_table_legs_wrought_iron.png b/mods/homedecor_tables/textures/homedecor_table_legs_wrought_iron.png index 8d7eec55..94e8bc1a 100644 Binary files a/mods/homedecor_tables/textures/homedecor_table_legs_wrought_iron.png and b/mods/homedecor_tables/textures/homedecor_table_legs_wrought_iron.png differ diff --git a/mods/homedecor_tables/textures/homedecor_utility_table_edges.png b/mods/homedecor_tables/textures/homedecor_utility_table_edges.png deleted file mode 100644 index c2b3d96e..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_utility_table_edges.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_utility_table_legs.png b/mods/homedecor_tables/textures/homedecor_utility_table_legs.png deleted file mode 100644 index 121f2f23..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_utility_table_legs.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_utility_table_legs_inv.png b/mods/homedecor_tables/textures/homedecor_utility_table_legs_inv.png deleted file mode 100644 index 799477a4..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_utility_table_legs_inv.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_utility_table_tb.png b/mods/homedecor_tables/textures/homedecor_utility_table_tb.png deleted file mode 100644 index b3ba2be5..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_utility_table_tb.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_edges.png b/mods/homedecor_tables/textures/homedecor_wood_table_edges.png new file mode 100644 index 00000000..3e3f98e7 Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_wood_table_edges.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_large_edges.png b/mods/homedecor_tables/textures/homedecor_wood_table_large_edges.png deleted file mode 100644 index c2b3d96e..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_large_edges.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_large_inv.png b/mods/homedecor_tables/textures/homedecor_wood_table_large_inv.png deleted file mode 100644 index 2c4b3e8e..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_large_inv.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_large_square.png b/mods/homedecor_tables/textures/homedecor_wood_table_large_square.png new file mode 100644 index 00000000..3c64e3cc Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_wood_table_large_square.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_large_square_inv.png b/mods/homedecor_tables/textures/homedecor_wood_table_large_square_inv.png new file mode 100644 index 00000000..88bb8292 Binary files /dev/null and b/mods/homedecor_tables/textures/homedecor_wood_table_large_square_inv.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_large_tb.png b/mods/homedecor_tables/textures/homedecor_wood_table_large_tb.png deleted file mode 100644 index 559b895e..00000000 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_large_tb.png and /dev/null differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_small_round.png b/mods/homedecor_tables/textures/homedecor_wood_table_small_round.png index 874227c3..1cfeb9b1 100644 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_small_round.png and b/mods/homedecor_tables/textures/homedecor_wood_table_small_round.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_small_round_inv.png b/mods/homedecor_tables/textures/homedecor_wood_table_small_round_inv.png index b1d1a909..44ad6593 100644 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_small_round_inv.png and b/mods/homedecor_tables/textures/homedecor_wood_table_small_round_inv.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_small_square.png b/mods/homedecor_tables/textures/homedecor_wood_table_small_square.png index 0a0d0722..c5af8fc7 100644 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_small_square.png and b/mods/homedecor_tables/textures/homedecor_wood_table_small_square.png differ diff --git a/mods/homedecor_tables/textures/homedecor_wood_table_small_square_inv.png b/mods/homedecor_tables/textures/homedecor_wood_table_small_square_inv.png index a36081d3..9b84a0f0 100644 Binary files a/mods/homedecor_tables/textures/homedecor_wood_table_small_square_inv.png and b/mods/homedecor_tables/textures/homedecor_wood_table_small_square_inv.png differ diff --git a/mods/unifieddyes/airbrush.lua b/mods/unifieddyes/airbrush.lua new file mode 100644 index 00000000..44f155f0 --- /dev/null +++ b/mods/unifieddyes/airbrush.lua @@ -0,0 +1,498 @@ +-- This file supplies all the code related to the airbrush + +local S = minetest.get_translator("unifieddyes") + +function unifieddyes.on_airbrush(itemstack, player, pointed_thing) + local player_name = player:get_player_name() + local painting_with = nil + + if unifieddyes.player_current_dye[player_name] then + painting_with = unifieddyes.player_current_dye[player_name] + end + + if not painting_with then + minetest.chat_send_player(player_name, "*** You need to set a color first.") + minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,") + minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.") + minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.") + return + end + + local pos = minetest.get_pointed_thing_position(pointed_thing) + if not pos then + local look_angle = player:get_look_vertical() + if look_angle > -1.55 then + minetest.chat_send_player(player_name, "*** No node selected") + else + local hexcolor = unifieddyes.get_color_from_dye_name(painting_with) + if hexcolor then + local r = tonumber(string.sub(hexcolor,1,2),16) + local g = tonumber(string.sub(hexcolor,3,4),16) + local b = tonumber(string.sub(hexcolor,5,6),16) + player:set_sky({r=r,g=g,b=b,a=255},"plain") + end + end + return + end + + local node = minetest.get_node(pos) + local def = minetest.registered_items[node.name] + if not def then return end + + if minetest.is_protected(pos, player_name) then + minetest.chat_send_player(player_name, "*** Sorry, someone else owns that node.") + return + end + + if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then + minetest.chat_send_player(player_name, "*** That node can't be colored.") + return + end + + local palette = nil + local fdir = 0 + if not def or not def.palette then + minetest.chat_send_player(player_name, "*** That node can't be colored -- it's either undefined or has no palette.") + return + elseif def.palette == "unifieddyes_palette_extended.png" then + palette = "extended" + elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then + palette = "wallmounted" + fdir = node.param2 % 8 + elseif def.palette ~= "unifieddyes_palette_extended.png" + and def.palette ~= "unifieddyes_palette_colorwallmounted.png" + and string.find(def.palette, "unifieddyes_palette_") then + palette = "split" + fdir = node.param2 % 32 + else + minetest.chat_send_player(player_name, "*** That node can't be colored -- it has an invalid color mode.") + return + end + + local idx, hue = unifieddyes.getpaletteidx(painting_with, palette) + local inv = player:get_inventory() + if (not creative or not creative.is_enabled_for(player_name)) and not inv:contains_item("main", painting_with) then + local suff = "" + if not idx then + suff = " Besides, "..string.sub(painting_with, 5).." can't be applied to that node." + end + minetest.chat_send_player(player_name, "*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff) + return + end + + if not idx then + minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.") + return + end + + local oldidx = node.param2 - fdir + local name = def.airbrush_replacement_node or node.name + + if palette == "split" then + + local modname = string.sub(name, 1, string.find(name, ":")-1) + local nodename2 = string.sub(name, string.find(name, ":")+1) + local oldcolor = "snozzberry" + local newcolor = "razzberry" -- intentionally misspelled ;-) + + if def.ud_color_start and def.ud_color_end then + oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end) + newcolor = string.sub(painting_with, 5) + else + if hue ~= 0 then + newcolor = unifieddyes.HUES_EXTENDED[hue][1] + else + newcolor = "grey" + end + + if def.airbrush_replacement_node then + oldcolor = "grey" + else + local s = string.sub(def.palette, 21) + oldcolor = string.sub(s, 1, string.find(s, "s.png")-1) + end + end + + name = modname..":"..string.gsub(nodename2, oldcolor, newcolor) + + if not minetest.registered_items[name] then + minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.") + return + end + elseif idx == oldidx then + return + end + minetest.swap_node(pos, {name = name, param2 = fdir + idx}) + if not creative or not creative.is_enabled_for(player_name) then + inv:remove_item("main", painting_with) + return + end +end + +local hps = 0.6 -- horizontal position scale +local vps = 1.3 -- vertical position scale +local vs = 0.1 -- vertical shift/offset + +local color_button_size = ";0.75,0.75;" +local color_square_size = ";0.69,0.69;" + +function unifieddyes.make_readable_color(color) + -- is this a low saturation color? + local has_low_saturtation = string.find(color, "s50"); + + -- remove _s50 tag, we care about that later again + local s = string.gsub(color, "_s50", "") + + -- replace underscores with spaces to make it look nicer + local s = string.gsub(s, "_", " ") + + -- capitalize words, you know, looks nicer ;) + s = string.gsub(s, "(%l)(%w*)", function(a,b) return string.upper(a)..b end) + + -- add the word dye, this is what the translations expect + s = s.." Dye" + + -- if it is a low sat color, append an appropriate string + if has_low_saturtation then + s = s.." (low saturation)" + end + + return s +end + +function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) + + local dye = "dye:"..colorname + + local overlay = "" + local colorize = minetest.formspec_escape("^[colorize:#"..hexcolor..":255") + + if not creative and inv:contains_item("main", dye) then + overlay = "^unifieddyes_onhand_overlay.png" + end + + local unavail_overlay = "" + if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname] + or (explist and not explist[colorname]) then + if overlay == "" then + unavail_overlay = "^unifieddyes_unavailable_overlay.png" + else + unavail_overlay = "^unifieddyes_onhand_unavailable_overlay.png" + end + end + + local tooltip = "tooltip["..colorname..";".. + S(unifieddyes.make_readable_color(colorname)).. + "\n(dye:"..colorname..")]" + + if dye == painting_with then + overlay = "^unifieddyes_select_overlay.png" + selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..tooltip + end + + local form + if unavail_overlay == "" then + form = "image_button[".. + (hp*hps)..","..(v2*vps+vs).. + color_button_size.. + "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";".. + colorname..";]".. + tooltip + else + form = "image[".. + (hp*hps)..","..(v2*vps+vs).. + color_square_size.. + "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]".. + tooltip + end + + return form, selindic +end + +function unifieddyes.show_airbrush_form(player) + if not player then return end + + local t = {} + + local player_name = player:get_player_name() + local painting_with = unifieddyes.player_selected_dye[player_name] or unifieddyes.player_current_dye[player_name] + local creative = creative and creative.is_enabled_for(player_name) + local inv = player:get_inventory() + local nodepalette = "extended" + local showall = unifieddyes.player_showall[player_name] + + t[1] = "size[14.5,8.5]label[7,-0.3;"..S("Select a color:").."]" + local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]" + + local last_right_click = unifieddyes.player_last_right_clicked[player_name] + if last_right_click then + if last_right_click.def and last_right_click.def.palette then + if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then + nodepalette = "wallmounted" + elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then + t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node that supports all 256 colors, showing them all)").."]" + showall = true + elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" + and last_right_click.def.palette ~= "unifieddyes_palette_colorwallmounted.png" + and string.find(last_right_click.def.palette, "unifieddyes_palette_") then + nodepalette = "split" + end + end + end + + if not last_right_click.def.groups + or not last_right_click.def.groups.ud_param2_colorable + or not last_right_click.def.palette + or not string.find(last_right_click.def.palette, "unifieddyes_palette_") then + t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node not supported by the Airbrush, showing all colors)").."]" + end + + local explist = last_right_click.def.explist + + for v = 0, 6 do + local val = unifieddyes.VALS_EXTENDED[v+1] + + local sat = "" + local v2=(v/2) + + for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do + local hue = h[1] + local hp=hi-1 + + local r = h[2] + local g = h[3] + local b = h[4] + + local factor = 40 + if v > 3 then + factor = 75 + v2 = (v-2) + end + + 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) + + local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2) + local f + f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) + t[#t+1] = f + end + + if v > 3 then + sat = "_s50" + v2 = (v-1.5) + + for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do + local hue = h[1] + local hp=hi-1 + + local r = h[2] + local g = h[3] + local b = h[4] + + local factor = 75 + + local pr = 0.299 + local pg = 0.587 + local pb = 0.114 + + 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) + + 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) + + local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) + local f + f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) + t[#t+1] = f + end + end + end + + local v2=5 + for y = 0, 15 do + + local hp=15-y + + local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17) + local grey = "grey_"..y + + if y == 0 then grey = "black" + elseif y == 4 then grey = "dark_grey" + elseif y == 8 then grey = "grey" + elseif y == 11 then grey = "light_grey" + elseif y == 15 then grey = "white" + end + + local f + f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) + t[#t+1] = f + + end + + if not creative then + t[#t+1] = "image[10," + t[#t+1] = (vps*5.55+vs) + t[#t+1] = color_button_size + t[#t+1] = "unifieddyes_onhand_overlay.png]label[10.7," + t[#t+1] = (vps*5.51+vs) + t[#t+1] = ";"..S("Dyes").."]" + t[#t+1] = "label[10.7," + t[#t+1] = (vps*5.67+vs) + t[#t+1] = ";on hand]" + + end + + t[#t+1] = "image[10," + t[#t+1] = (vps*5+vs) + t[#t+1] = color_button_size + t[#t+1] = selindic + + if painting_with then + t[#t+1] = "label[10.7," + t[#t+1] = (vps*4.90+vs) + t[#t+1] = ";"..S("Your selection:").."]" + t[#t+1] = "label[10.7," + t[#t+1] = (vps*5.07+vs) + t[#t+1] = ";" + t[#t+1] = S(unifieddyes.make_readable_color(string.sub(painting_with, 5))) + t[#t+1] = "]label[10.7," + t[#t+1] = (vps*5.24+vs) + t[#t+1] = ";(" + t[#t+1] = painting_with + t[#t+1] = ")]" + else + t[#t+1] = "label[10.7," + t[#t+1] = (vps*5.07+vs) + t[#t+1] = ";"..S("Your selection").."]" + end + + t[#t+1] = "button_exit[10.5,8;2,1;cancel;"..S("Cancel").."]button_exit[12.5,8;2,1;accept;"..S("Accept").."]" + + + if last_right_click and last_right_click.def and nodepalette ~= "extended" then + if showall then + t[#t+1] = "button[0,8;2,1;show_avail;"..S("Show Available").."]" + t[#t+1] = "label[2,8.25;"..S("(Currently showing all 256 colors)").."]" + else + t[#t+1] = "button[0,8;2,1;show_all;"..S("Show All Colors").."]" + t[#t+1] = "label[2,8.25;"..S("(Currently only showing what the right-clicked node can use)").."]" + end + end + + minetest.show_formspec(player_name, "unifieddyes:dye_select_form", table.concat(t)) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + + if formname == "unifieddyes:dye_select_form" then + + local player_name = player:get_player_name() + local nodepalette = "extended" + local showall = unifieddyes.player_showall[player_name] + + local last_right_click = unifieddyes.player_last_right_clicked[player_name] + if last_right_click and last_right_click.def then + if last_right_click.def.palette then + if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then + nodepalette = "wallmounted" + elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" then + nodepalette = "split" + end + end + end + + if fields.show_all then + unifieddyes.player_showall[player_name] = true + unifieddyes.show_airbrush_form(player) + return + elseif fields.show_avail then + unifieddyes.player_showall[player_name] = false + unifieddyes.show_airbrush_form(player) + return + elseif fields.quit then + if fields.accept then + local dye = unifieddyes.player_selected_dye[player_name] + if not dye then + minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but no color was selected!") + return + elseif not showall + and not unifieddyes.palette_has_color[nodepalette.."_"..string.sub(dye, 5)] then + minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but the selected color can't be used on the") + minetest.chat_send_player(player_name, "*** node that was right-clicked (and \"Show All\" wasn't in effect).") + if unifieddyes.player_current_dye[player_name] then + minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "..string.sub(unifieddyes.player_current_dye[player_name], 5)..".") + else + minetest.chat_send_player(player_name, "*** Ignoring it.") + end + return + else + unifieddyes.player_current_dye[player_name] = dye + unifieddyes.player_selected_dye[player_name] = nil + minetest.chat_send_player(player_name, "*** Selected "..string.sub(dye, 5).." for the airbrush.") + return + end + else -- assume "Cancel" or Esc. + unifieddyes.player_selected_dye[player_name] = nil + return + end + else + local s1 = string.sub(minetest.serialize(fields), 11) + local s3 = string.sub(s1,1, string.find(s1, '"')-1) + + local inv = player:get_inventory() + local creative = creative and creative.is_enabled_for(player_name) + local dye = "dye:"..s3 + + if (showall or unifieddyes.palette_has_color[nodepalette.."_"..s3]) and + (minetest.registered_items[dye] and (creative or inv:contains_item("main", dye))) then + unifieddyes.player_selected_dye[player_name] = dye + unifieddyes.show_airbrush_form(player) + end + end + end +end) + +minetest.register_tool("unifieddyes:airbrush", { + description = S("Dye Airbrush"), + inventory_image = "unifieddyes_airbrush.png", + use_texture_alpha = true, + tool_capabilities = { + full_punch_interval=0.1, + }, + range = 12, + on_use = unifieddyes.on_airbrush, + on_place = function(itemstack, placer, pointed_thing) + local keys = placer:get_player_control() + local player_name = placer:get_player_name() + local pos = minetest.get_pointed_thing_position(pointed_thing) + local node + local def + + if pos then node = minetest.get_node(pos) end + if node then def = minetest.registered_items[node.name] end + + unifieddyes.player_last_right_clicked[player_name] = {pos = pos, node = node, def = def} + + if not keys.aux1 then + unifieddyes.show_airbrush_form(placer) + elseif keys.aux1 then + if not pos or not def then return end + local newcolor = unifieddyes.color_to_name(node.param2, def) + + if newcolor and string.find(def.paramtype2, "color") then + minetest.chat_send_player(player_name, "*** Switching to "..newcolor.." for the airbrush, to match that node.") + unifieddyes.player_current_dye[player_name] = "dye:"..newcolor + else + minetest.chat_send_player(player_name, "*** That node is uncolored.") + end + elseif def.on_rightclick then + return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) + end + end +}) diff --git a/mods/unifieddyes/aliases.lua b/mods/unifieddyes/aliases.lua new file mode 100644 index 00000000..785eb588 --- /dev/null +++ b/mods/unifieddyes/aliases.lua @@ -0,0 +1,23 @@ +minetest.register_alias("dye:light_red", "dye:pink") +minetest.register_alias("dye:medium_orange", "dye:brown") + +minetest.register_alias("unifieddyes:black", "dye:black") +minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey") +minetest.register_alias("unifieddyes:grey", "dye: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") +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") + +minetest.register_alias("unifieddyes:brown", "dye:brown") diff --git a/mods/unifieddyes/api.lua b/mods/unifieddyes/api.lua new file mode 100644 index 00000000..8b4eb14f --- /dev/null +++ b/mods/unifieddyes/api.lua @@ -0,0 +1,494 @@ +-- This file supplies the majority of Unified Dyes' API + +local S = minetest.get_translator("unifieddyes") + +unifieddyes.player_current_dye = {} +unifieddyes.player_selected_dye = {} +unifieddyes.player_last_right_clicked = {} +unifieddyes.palette_has_color = {} +unifieddyes.player_showall = {} + +-- if a node with a palette is placed in the world, +-- but the itemstack used to place it has no palette_index (color byte), +-- create something appropriate to make it officially white. + +minetest.register_on_placenode( + function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + local def = minetest.registered_items[newnode.name] + + if not def + or not def.palette + or def.after_place_node + or not placer then + return false + end + + local param2 + if not string.find(itemstack:to_string(), "palette_index") then + if def.palette == "unifieddyes_palette_extended.png" + and def.paramtype2 == "color" then + param2 = 240 + elseif def.palette == "unifieddyes_palette_colorwallmounted.png" + and def.paramtype2 == "colorwallmounted" then + param2 = newnode.param2 % 8 + elseif string.find(def.palette, "unifieddyes_palette_") + and def.paramtype2 == "colorfacedir" then -- it's a split palette + param2 = newnode.param2 % 32 + end + + if param2 then + minetest.swap_node(pos, {name = newnode.name, param2 = param2}) + end + end + + if def.palette ~= "" then + minetest.get_meta(pos):set_int("palette_index", param2 or 240) + end + end +) + +-- The complementary function: strip-off the color if the node being dug is still white/neutral + +local function move_item(item, pos, inv, digger, fix_color) + if not (digger and digger:is_player()) then return end + local creative = creative_mode or minetest.check_player_privs(digger, "creative") + item = unifieddyes.fix_bad_color_info(item, fix_color) + if inv:room_for_item("main", item) + and (not creative or not inv:contains_item("main", item, true)) then + inv:add_item("main", item) + elseif not creative then + minetest.item_drop(ItemStack(item), digger, pos) + end + minetest.remove_node(pos) +end + +function unifieddyes.on_dig(pos, node, digger) + if not digger then return end + local playername = digger:get_player_name() + if minetest.is_protected(pos, playername) then + minetest.record_protection_violation(pos, playername) + return + end + + local oldparam2 = minetest.get_node(pos).param2 + local def = minetest.registered_items[node.name] + local fix_color + + if def.paramtype2 == "color" and oldparam2 == 240 and def.palette == "unifieddyes_palette_extended.png" then + fix_color = 240 + elseif def.paramtype2 == "color" and oldparam2 == 0 and def.palette == "unifieddyes_palette_extended.png" then + fix_color = 0 + elseif def.paramtype2 == "colorwallmounted" and math.floor(oldparam2 / 8) == 0 and def.palette == "unifieddyes_palette_colorwallmounted.png" then + fix_color = 0 + elseif def.paramtype2 == "colorfacedir" and math.floor(oldparam2 / 32) == 0 and string.find(def.palette, "unifieddyes_palette_") then + fix_color = 0 + end + + local inv = digger:get_inventory() + if fix_color then + move_item(node.name, pos, inv, digger, fix_color) + else + return minetest.node_dig(pos, node, digger) + end +end + +-- just stubs to keep old mods from crashing when expecting auto-coloring +-- or getting back the dye on dig. + +function unifieddyes.recolor_on_place(foo) +end + +function unifieddyes.after_dig_node(foo) +end + +-- This helper function creates multiple copies of the passed node, +-- for the split palette - one per hue, plus grey - and assigns +-- proper palettes and other attributes + +function unifieddyes.generate_split_palette_nodes(name, def, drop) + for _, color in ipairs(unifieddyes.HUES_WITH_GREY) do + local def2 = table.copy(def) + local desc_color = string.gsub(string.upper(string.sub(color, 1, 1))..string.sub(color, 2), "_", " ") + if string.sub(def2.description, -1) == ")" then + def2.description = string.sub(def2.description, 1, -2)..", "..desc_color.." shades)" + else + def2.description = def2.description.."("..desc_color.." shades)" + end + def2.palette = "unifieddyes_palette_"..color.."s.png" + def2.paramtype2 = "colorfacedir" + def2.groups.ud_param2_colorable = 1 + + if drop then + def2.drop = { + items = { + {items = {drop.."_"..color}, inherit_color = true }, + } + } + end + + minetest.register_node(":"..name.."_"..color, def2) + end +end + +-- This helper function creates a colored itemstack + +function unifieddyes.fix_bad_color_info(item, paletteidx) + local stack=minetest.itemstring_with_color(item, paletteidx) + return string.gsub(stack, "u0001color", "u0001palette_index") +end + +function unifieddyes.make_colored_itemstack(item, palette, color) + local paletteidx = unifieddyes.getpaletteidx(color, palette) + return unifieddyes.fix_bad_color_info(item, paletteidx), paletteidx +end + +-- these helper functions register all of the recipes needed to create colored +-- nodes with any of the dyes supported by that node's palette. + +local function register_c(craft, h, sat, val) + local hue = (type(h) == "table") and h[1] or h + local color = "" + if val then + if craft.palette == "wallmounted" then + color = val..hue..sat + else + color = val..hue..sat + end + else + color = hue -- if val is nil, then it's grey. + end + + local dye = "dye:"..color + local recipe = minetest.serialize(craft.recipe) + recipe = string.gsub(recipe, "MAIN_DYE", dye) + recipe = string.gsub(recipe, "NEUTRAL_NODE", craft.neutral_node) + local newrecipe = minetest.deserialize(recipe) + + local coutput = craft.output or "" + local output = coutput + if craft.output_prefix then + if craft.palette ~= "split" then + output = craft.output_prefix..color..craft.output_suffix..coutput + else + if hue == "white" or hue == "black" or string.find(hue, "grey") then + output = craft.output_prefix.."grey"..craft.output_suffix..coutput + elseif hue == "pink" then + dye = "dye:light_red" + output = craft.output_prefix.."red"..craft.output_suffix..coutput + else + output = craft.output_prefix..hue..craft.output_suffix..coutput + end + end + end + + local colored_itemstack = + unifieddyes.make_colored_itemstack(output, craft.palette, dye) + + minetest.register_craft({ + output = colored_itemstack, + type = craft.type, + recipe = newrecipe + }) + +end + +function unifieddyes.register_color_craft(craft) + local hues_table = unifieddyes.HUES_EXTENDED + local sats_table = unifieddyes.SATS + local vals_table = unifieddyes.VALS_SPLIT + local greys_table = unifieddyes.GREYS + + if craft.palette == "wallmounted" then + register_c(craft, "green", "", "light_") + register_c(craft, "blue", "", "light_") + hues_table = unifieddyes.HUES_WALLMOUNTED + sats_table = {""} + vals_table = unifieddyes.VALS + elseif craft.palette == "extended" then + vals_table = unifieddyes.VALS_EXTENDED + greys_table = unifieddyes.GREYS_EXTENDED + end + + for _, hue in ipairs(hues_table) do + for _, val in ipairs(vals_table) do + for _, sat in ipairs(sats_table) do + + if sat == "_s50" and val ~= "" and val ~= "medium_" and val ~= "dark_" then break end + register_c(craft, hue, sat, val) + + end + end + end + + for _, grey in ipairs(greys_table) do + register_c(craft, grey) + end + + register_c(craft, "pink") + +end + +-- code borrowed from homedecor +-- call this function to reset the rotation of a "wallmounted" object on place + +function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local colorbits = node.param2 - (node.param2 % 8) + + local yaw = placer:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw) -- -1.5) + local pitch = placer:get_look_vertical() + + local fdir = minetest.dir_to_wallmounted(dir) + + if pitch < -(math.pi/8) then + fdir = 0 + elseif pitch > math.pi/8 then + fdir = 1 + end + minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits }) +end + +-- use this when you have a "wallmounted" node that should never be oriented +-- to floor or ceiling... + +function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local colorbits = node.param2 - (node.param2 % 8) + local yaw = placer:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw+1.5) + local fdir = minetest.dir_to_wallmounted(dir) + + minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits }) +end + +-- ... and use this one to force that kind of node off of floor/ceiling +-- orientation after the screwdriver rotates it. + +function unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2) + local new_fdir = new_param2 % 8 + local color = new_param2 - new_fdir + if new_fdir < 2 then + new_fdir = 2 + minetest.swap_node(pos, { name = node.name, param2 = new_fdir + color }) + return true + end +end + +function unifieddyes.is_buildable_to(placer_name, ...) + for _, pos in ipairs({...}) do + local node = minetest.get_node_or_nil(pos) + local def = node and minetest.registered_nodes[node.name] + if not (def and def.buildable_to) or minetest.is_protected(pos, placer_name) then + return false + end + end + return true +end + +function unifieddyes.get_hsv(name) -- expects a node/item name + local hue = "" + local a,b + for _, i in ipairs(unifieddyes.HUES_EXTENDED) do + a,b = string.find(name, "_"..i[1]) + if a then + hue = i[1] + break + end + end + + if string.find(name, "_light_grey") then hue = "light_grey" + elseif string.find(name, "_lightgrey") then hue = "light_grey" + elseif string.find(name, "_dark_grey") then hue = "dark_grey" + elseif string.find(name, "_darkgrey") then hue = "dark_grey" + elseif string.find(name, "_grey") then hue = "grey" + elseif string.find(name, "_white") then hue = "white" + elseif string.find(name, "_black") then hue = "black" + end + + local sat = "" + if string.find(name, "_s50") then sat = "_s50" end + + local val = "" + if string.find(name, "dark_") then val = "dark_" end + if string.find(name, "medium_") then val = "medium_" end + if string.find(name, "light_") then val = "light_" end + + return hue, sat, val +end + +-- code partially borrowed from cheapie's plasticbox mod + +-- in the function below, color is just a color string, while +-- palette_type can be: +-- +-- "extended" = 256 color palette +-- "split" = 200 color palette split into pieces for colorfacedir +-- "wallmounted" = 32-color abridged palette + +function unifieddyes.getpaletteidx(color, palette_type) + + local origcolor = color + + if string.sub(color,1,4) == "dye:" then + color = string.sub(color,5,-1) + elseif string.sub(color,1,12) == "unifieddyes:" then + color = string.sub(color,13,-1) + else + return + end + + if palette_type == "wallmounted" then + if unifieddyes.gpidx_grayscale_wallmounted[color] then + return (unifieddyes.gpidx_grayscale_wallmounted[color] * 8), 0 + end + elseif palette_type == "split" then + if unifieddyes.gpidx_grayscale[color] then + return (unifieddyes.gpidx_grayscale[color] * 32), 0 + end + elseif palette_type == "extended" then + if unifieddyes.gpidx_grayscale_extended[color] then + return unifieddyes.gpidx_grayscale_extended[color]+240, 0 + end + end + + 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) + elseif string.sub(color,1,5) == "dark_" then + shade = "dark" + color = string.sub(color,6,-1) + end + if string.sub(color,-4,-1) == "_s50" then + shade = shade.."s50" + color = string.sub(color,1,-5) + end + + if palette_type == "wallmounted" then + if color == "green" and shade == "light" then return 48,3 + elseif color == "brown" then return 17,1 + elseif color == "pink" then return 56,7 + elseif color == "blue" and shade == "light" then return 40,5 + elseif unifieddyes.gpidx_hues_wallmounted[color] and unifieddyes.gpidx_shades_wallmounted[shade] then + return (unifieddyes.gpidx_shades_wallmounted[shade] * 64 + unifieddyes.gpidx_hues_wallmounted[color] * 8), unifieddyes.gpidx_hues_wallmounted[color] + end + else + if color == "brown" then + color = "orange" + shade = "medium" + elseif color == "pink" then + color = "red" + shade = "light" + end + if palette_type == "split" then -- it's colorfacedir + if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_split[shade] then + return (unifieddyes.gpidx_shades_split[shade] * 32), unifieddyes.gpidx_hues_extended[color]+1 + end + elseif palette_type == "extended" then + if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_extended[shade] then + return (unifieddyes.gpidx_hues_extended[color] + unifieddyes.gpidx_shades_extended[shade]*24), unifieddyes.gpidx_hues_extended[color] + end + end + end +end + +function unifieddyes.get_color_from_dye_name(name) + if name == "dye:black" then + return "000000" + elseif name == "dye:white" then + return "ffffff" + end + local item = minetest.registered_items[name] + if not item then return end + local inv_image = item.inventory_image + if not inv_image then return end + return string.match(inv_image,"colorize:#(......):200") +end + +-- get a node's dye color based on its palette and param2 + +function unifieddyes.color_to_name(param2, def) + if not param2 or not def or not def.palette then return end + + if def.palette == "unifieddyes_palette_extended.png" then + local color = param2 + + local v = 0 + local s = 1 + if color < 24 then v = 1 + elseif color > 23 and color < 48 then v = 2 + elseif color > 47 and color < 72 then v = 3 + elseif color > 71 and color < 96 then v = 4 + elseif color > 95 and color < 120 then v = 5 + elseif color > 119 and color < 144 then v = 5 s = 2 + elseif color > 143 and color < 168 then v = 6 + elseif color > 167 and color < 192 then v = 6 s = 2 + elseif color > 191 and color < 216 then v = 7 + elseif color > 215 and color < 240 then v = 7 s = 2 + end + + if color > 239 then + if color == 240 then return "white" + elseif color == 244 then return "light_grey" + elseif color == 247 then return "grey" + elseif color == 251 then return "dark_grey" + elseif color == 255 then return "black" + else return "grey_"..15-(color-240) + end + else + local h = color - math.floor(color/24)*24 + return unifieddyes.VALS_EXTENDED[v]..unifieddyes.HUES_EXTENDED[h+1][1]..unifieddyes.SATS[s] + end + + elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then + local color = math.floor(param2 / 8) + if color == 0 then return "white" + elseif color == 1 then return "light_grey" + elseif color == 2 then return "grey" + elseif color == 3 then return "dark_grey" + elseif color == 4 then return "black" + elseif color == 5 then return "light_blue" + elseif color == 6 then return "light_green" + elseif color == 7 then return "pink" + end + local v = math.floor(color/8) + local h = color - v * 8 + return unifieddyes.VALS[v]..unifieddyes.HUES_WALLMOUNTED[h+1] + + elseif string.find(def.palette, "unifieddyes_palette") then -- it's the split palette + -- palette names in this mode are always "unifieddyes_palette_COLORs.png" + + local s = string.sub(def.palette, 21) + local color = string.sub(s, 1, string.find(s, "s.png")-1) + + local v = math.floor(param2/32) + if color ~= "grey" then + if v == 0 then return "faint_"..color + elseif v == 1 then return color + elseif v == 2 then return color.."_s50" + elseif v == 3 then return "light_"..color + elseif v == 4 then return "medium_"..color + elseif v == 5 then return "medium_"..color.."_s50" + elseif v == 6 then return "dark_"..color + elseif v == 7 then return "dark_"..color.."_s50" + end + else + if v > 0 and v < 6 then return unifieddyes.GREYS[v] + else return "white" + end + end + end +end diff --git a/mods/unifieddyes/color-tables.lua b/mods/unifieddyes/color-tables.lua new file mode 100644 index 00000000..12eaa325 --- /dev/null +++ b/mods/unifieddyes/color-tables.lua @@ -0,0 +1,237 @@ + +-- 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.HUES_WITH_GREY = {} + +for _,i in ipairs(unifieddyes.HUES_EXTENDED) do + table.insert(unifieddyes.HUES_WITH_GREY, i[1]) +end +table.insert(unifieddyes.HUES_WITH_GREY, "grey") + +unifieddyes.HUES_WALLMOUNTED = { + "red", + "orange", + "yellow", + "green", + "cyan", + "blue", + "violet", + "magenta" +} + +unifieddyes.SATS = { + "", + "_s50" +} + +unifieddyes.VALS = { + "", + "medium_", + "dark_" +} + +unifieddyes.VALS_SPLIT = { + "faint_", + "light_", + "", + "medium_", + "dark_" +} + +unifieddyes.VALS_EXTENDED = { + "faint_", + "pastel_", + "light_", + "bright_", + "", + "medium_", + "dark_" +} + +unifieddyes.GREYS = { + "white", + "light_grey", + "grey", + "dark_grey", + "black" +} + +unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS) + +for i = 1, 14 do + if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then + table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i) + end +end + +local default_dyes = { + "black", + "blue", + "brown", + "cyan", + "dark_green", + "dark_grey", + "green", + "grey", + "magenta", + "orange", + "pink", + "red", + "violet", + "white", + "yellow" +} + +-- reverse lookups for getpaletteidx() + +unifieddyes.gpidx_aliases = { + ["pink"] = "light_red", + ["brown"] = "medium_orange", + ["azure"] = "light_blue" +} + +unifieddyes.gpidx_grayscale = { + ["white"] = 1, + ["light_grey"] = 2, + ["grey"] = 3, + ["dark_grey"] = 4, + ["black"] = 5, +} + +unifieddyes.gpidx_grayscale_extended = { + ["white"] = 0, + ["grey_14"] = 1, + ["grey_13"] = 2, + ["grey_12"] = 3, + ["light_grey"] = 4, + ["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, +} + +unifieddyes.gpidx_grayscale_wallmounted = { + ["white"] = 0, + ["light_grey"] = 1, + ["grey"] = 2, + ["dark_grey"] = 3, + ["black"] = 4, +} + +unifieddyes.gpidx_hues_extended = { + ["red"] = 0, + ["vermilion"] = 1, + ["orange"] = 2, + ["amber"] = 3, + ["yellow"] = 4, + ["lime"] = 5, + ["chartreuse"] = 6, + ["harlequin"] = 7, + ["green"] = 8, + ["malachite"] = 9, + ["spring"] = 10, + ["aqua"] = 10, + ["turquoise"] = 11, + ["cyan"] = 12, + ["cerulean"] = 13, + ["azure"] = 14, + ["skyblue"] = 14, + ["sapphire"] = 15, + ["blue"] = 16, + ["indigo"] = 17, + ["violet"] = 18, + ["mulberry"] = 19, + ["magenta"] = 20, + ["fuchsia"] = 21, + ["rose"] = 22, + ["redviolet"] = 22, + ["crimson"] = 23, +} + +unifieddyes.gpidx_hues_wallmounted = { + ["red"] = 0, + ["orange"] = 1, + ["yellow"] = 2, + ["green"] = 3, + ["cyan"] = 4, + ["blue"] = 5, + ["violet"] = 6, + ["magenta"] = 7 +} + +unifieddyes.gpidx_shades = { + [""] = 1, + ["s50"] = 2, + ["light"] = 3, + ["medium"] = 4, + ["mediums50"] = 5, + ["dark"] = 6, + ["darks50"] = 7, +} + +unifieddyes.gpidx_shades_split = { + ["faint"] = 0, + [""] = 1, + ["s50"] = 2, + ["light"] = 3, + ["medium"] = 4, + ["mediums50"] = 5, + ["dark"] = 6, + ["darks50"] = 7, +} + +unifieddyes.gpidx_shades_extended = { + ["faint"] = 0, + ["pastel"] = 1, + ["light"] = 2, + ["bright"] = 3, + [""] = 4, + ["s50"] = 5, + ["medium"] = 6, + ["mediums50"] = 7, + ["dark"] = 8, + ["darks50"] = 9 +} + +unifieddyes.gpidx_shades_wallmounted = { + [""] = 1, + ["medium"] = 2, + ["dark"] = 3 +} diff --git a/mods/unifieddyes/dyes-crafting.lua b/mods/unifieddyes/dyes-crafting.lua new file mode 100644 index 00000000..2c11c41b --- /dev/null +++ b/mods/unifieddyes/dyes-crafting.lua @@ -0,0 +1,309 @@ +-- crafting! + +-- Generate all dyes that are not part of the default minetest_game dyes mod + +local S = minetest.get_translator("unifieddyes") + +for _, h in ipairs(unifieddyes.HUES_EXTENDED) do + local hue = h[1] + local r = h[2] + local g = h[3] + local b = h[4] + + for v = 0, 6 do + local val = unifieddyes.VALS_EXTENDED[v+1] + + local factor = 40 + if v > 3 then factor = 75 end + + 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) + + -- full-sat color + + local desc = hue:gsub("%a", string.upper, 1).." Dye" + + if val ~= "" then + desc = val:sub(1, -2):gsub("%a", string.upper, 1) .." "..desc + end + + 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", + }) + else + if (val..hue) ~= "medium_orange" + and (val..hue) ~= "light_red" then + 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 }, + }) + end + end + minetest.register_alias("unifieddyes:"..val..hue, "dye:"..val..hue) + + if v > 3 then -- also register the low-sat version + + local pr = 0.299 + local pg = 0.587 + local pb = 0.114 + + 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) + + local color = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) + + minetest.register_craftitem(":dye:"..val..hue.."_s50", { + description = S(desc.." (low saturation)"), + inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200", + groups = { dye=1, not_in_creative_inventory=1 }, + }) + minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50") + end + end +end + +-- register the greyscales too :P + +for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes + + if y ~= 4 and y ~= 8 and y~= 11 then -- don't register the three greys, they're done separately. + + 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 + + minetest.register_craftitem(":dye:"..name, { + description = S(desc), + inventory_image = "unifieddyes_dye.png^[colorize:#"..rgb..":200", + groups = { dye=1, not_in_creative_inventory=1 }, + }) + minetest.register_alias("unifieddyes:"..name, "dye:"..name) + end +end + +minetest.override_item("dye:grey", { + inventory_image = "unifieddyes_dye.png^[colorize:#888888:200", +}) + +minetest.override_item("dye:dark_grey", { + inventory_image = "unifieddyes_dye.png^[colorize:#444444:200", +}) + +minetest.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 }, +}) + +-- build a table of color <-> palette associations to reduce the need for +-- realtime lookups with getpaletteidx() + +for _, palette in ipairs({"extended", "split", "wallmounted"}) do + local palette2 = palette + + for i in ipairs(unifieddyes.SATS) do + local sat = (palette == "wallmounted") and "" or unifieddyes.SATS[i] + for _, hue in ipairs(unifieddyes.HUES_EXTENDED) do + for _, val in ipairs(unifieddyes.VALS_EXTENDED) do + local color = val..hue[1]..sat + if unifieddyes.getpaletteidx("dye:"..color, palette2) then + unifieddyes.palette_has_color[palette.."_"..color] = true + end + end + end + end + + for y = 0, 15 do + local grey = "grey_"..y + + if y == 0 then grey = "black" + elseif y == 4 then grey = "dark_grey" + elseif y == 8 then grey = "grey" + elseif y == 11 then grey = "light_grey" + elseif y == 15 then grey = "white" + end + if unifieddyes.getpaletteidx("dye:"..grey, palette2) then + unifieddyes.palette_has_color[palette.."_"..grey] = true + end + end +end + +unifieddyes.palette_has_color["wallmounted_light_red"] = true + +unifieddyes.base_color_crafts = { + { "red", "flowers:rose", nil, nil, nil, nil, 4 }, + { "vermilion", "dye:red", "dye:orange", nil, nil, nil, 3 }, + { "orange", "flowers:tulip", nil, nil, nil, nil, 4 }, + { "orange", "dye:red", "dye:yellow", nil, nil, nil, 2 }, + { "amber", "dye:orange", "dye:yellow", nil, nil, nil, 2 }, + { "yellow", "flowers:dandelion_yellow", nil, nil, nil, nil, 4 }, + { "lime", "dye:yellow", "dye:chartreuse", nil, nil, nil, 2 }, + { "lime", "dye:yellow", "dye:yellow", "dye:green", nil, nil, 3 }, + { "chartreuse", "dye:yellow", "dye:green", nil, nil, nil, 2 }, + { "harlequin", "dye:chartreuse", "dye:green", nil, nil, nil, 2 }, + { "harlequin", "dye:yellow", "dye:green", "dye:green", nil, nil, 3 }, + { "green", "default:cactus", nil, nil, nil, nil, 4 }, + { "green", "dye:yellow", "dye:blue", nil, nil, nil, 2 }, + { "malachite", "dye:green", "dye:spring", nil, nil, nil, 2 }, + { "malachite", "dye:green", "dye:green", "dye:cyan", nil, nil, 3 }, + { "malachite", "dye:green", "dye:green", "dye:green", "dye:blue", nil, 4 }, + { "spring", "dye:green", "dye:cyan", nil, nil, nil, 2 }, + { "spring", "dye:green", "dye:green", "dye:blue", nil, nil, 3 }, + { "turquoise", "dye:spring", "dye:cyan", nil, nil, nil, 2 }, + { "turquoise", "dye:green", "dye:cyan", "dye:cyan", nil, nil, 3 }, + { "turquoise", "dye:green", "dye:green", "dye:green", "dye:blue", "dye:blue", 5 }, + { "cyan", "dye:green", "dye:blue", nil, nil, nil, 2 }, + { "cerulean", "dye:cyan", "dye:azure", nil, nil, nil, 2 }, + { "cerulean", "dye:cyan", "dye:cyan", "dye:blue", nil, nil, 3 }, + { "cerulean", "dye:green", "dye:green", "dye:blue", "dye:blue", "dye:blue", 5 }, + { "azure", "dye:cyan", "dye:blue", nil, nil, nil, 2 }, + { "azure", "dye:green", "dye:blue", "dye:blue", nil, nil, 3 }, + { "sapphire", "dye:azure", "dye:blue", nil, nil, nil, 2 }, + { "sapphire", "dye:cyan", "dye:blue", "dye:blue", nil, nil, 3 }, + { "sapphire", "dye:green", "dye:blue", "dye:blue", "dye:blue", nil, 4 }, + { "blue", "flowers:geranium", nil, nil, nil, nil, 4 }, + { "indigo", "dye:blue", "dye:violet", nil, nil, nil, 2 }, + { "violet", "flowers:viola", nil, nil, nil, nil, 4 }, + { "violet", "dye:blue", "dye:magenta", nil, nil, nil, 2 }, + { "mulberry", "dye:violet", "dye:magenta", nil, nil, nil, 2 }, + { "mulberry", "dye:violet", "dye:blue", "dye:red", nil, nil, 3 }, + { "magenta", "dye:blue", "dye:red", nil, nil, nil, 2 }, + { "fuchsia", "dye:magenta", "dye:rose", nil, nil, nil, 2 }, + { "fuchsia", "dye:blue", "dye:red", "dye:rose", nil, nil, 3 }, + { "fuchsia", "dye:red", "dye:violet", nil, nil, nil, 2 }, + { "rose", "dye:magenta", "dye:red", nil, nil, nil, 2 }, + { "rose", "dye:red", "dye:red", "dye:blue", nil, nil, 3 }, + { "crimson", "dye:rose", "dye:red", nil, nil, nil, 2 }, + { "crimson", "dye:magenta", "dye:red", "dye:red", nil, nil, 3 }, + { "crimson", "dye:red", "dye:red", "dye:red", "dye:blue", nil, 4 }, + + { "black", "default:coal_lump", nil, nil, nil, nil, 4 }, + { "white", "flowers:dandelion_white", nil, nil, nil, nil, 4 }, +} + +unifieddyes.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 }, +} + +for _,i in ipairs(unifieddyes.base_color_crafts) do + local color = i[1] + local yield = i[7] + + minetest.register_craft( { + type = "shapeless", + output = "dye:"..color.." "..yield, + recipe = { + i[2], + i[3], + i[4], + i[5], + i[6], + }, + }) + + for _,j in ipairs(unifieddyes.shade_crafts) do + local firstdye = j[3] + if firstdye == "color" then firstdye = "dye:"..color end + + -- ignore black, white, anything containing the word "grey" + + if color ~= "black" and color ~= "white" and not string.find(color, "grey") then + + minetest.register_craft( { + type = "shapeless", + output = "dye:"..j[1]..color..j[2].." "..j[6], + recipe = { + "dye:"..color, + firstdye, + j[4], + j[5] + }, + }) + end + end +end + +-- greys + +unifieddyes.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 }, +} + +for _, i in ipairs(unifieddyes.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 = "dye:"..color.." "..yield, + recipe = { + dye1, + dye2, + dye3, + dye4, + }, + }) +end + +-- other crafts +-- we can't make dark orange anymore because brown/medium orange conflicts + +minetest.register_craft( { + type = "shapeless", + output = "dye:dark_orange", + recipe = { + "dye:brown", + "dye:brown" + }, +}) + +minetest.register_craft( { + output = "unifieddyes:airbrush", + recipe = { + { "basic_materials:brass_ingot", "", "basic_materials:plastic_sheet" }, + { "", "default:steel_ingot", "" }, + { "", "", "default:steel_ingot" } + }, +}) diff --git a/mods/unifieddyes/init.lua b/mods/unifieddyes/init.lua index dcebc786..a8e5092b 100644 --- a/mods/unifieddyes/init.lua +++ b/mods/unifieddyes/init.lua @@ -2,12 +2,12 @@ Unified Dyes -This mod provides an extension to the Minetest 0.4.x dye system +This mod provides an extension to the Minetest dye system ============================================================================== -Copyright (C) 2012-2013, Vanessa Ezekowitz -Email: vanessaezekowitz@gmail.com +Copyright (C) 2012-2013, Vanessa Dannenberg +Email: vanessa.e.dannenberg@gmail.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,1562 +34,12 @@ unifieddyes = {} local creative_mode = minetest.settings:get_bool("creative_mode") local S = minetest.get_translator("unifieddyes") +local modpath=minetest.get_modpath(minetest.get_current_modname()) --- 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.HUES_WITH_GREY = {} - -for _,i in ipairs(unifieddyes.HUES_EXTENDED) do - table.insert(unifieddyes.HUES_WITH_GREY, i[1]) -end -table.insert(unifieddyes.HUES_WITH_GREY, "grey") - -unifieddyes.HUES_WALLMOUNTED = { - "red", - "orange", - "yellow", - "green", - "cyan", - "blue", - "violet", - "magenta" -} - -unifieddyes.SATS = { - "", - "_s50" -} - -unifieddyes.VALS = { - "", - "medium_", - "dark_" -} - -unifieddyes.VALS_SPLIT = { - "faint_", - "light_", - "", - "medium_", - "dark_" -} - -unifieddyes.VALS_EXTENDED = { - "faint_", - "pastel_", - "light_", - "bright_", - "", - "medium_", - "dark_" -} - -unifieddyes.GREYS = { - "white", - "light_grey", - "grey", - "dark_grey", - "black" -} - -unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS) - -for i = 1, 14 do - if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then - table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i) - end -end - -local default_dyes = { - "black", - "blue", - "brown", - "cyan", - "dark_green", - "dark_grey", - "green", - "grey", - "magenta", - "orange", - "pink", - "red", - "violet", - "white", - "yellow" -} - -unifieddyes.player_current_dye = {} -unifieddyes.player_selected_dye = {} -unifieddyes.player_last_right_clicked = {} -unifieddyes.palette_has_color = {} -unifieddyes.player_showall = {} - --- if a node with a palette is placed in the world, --- but the itemstack used to place it has no palette_index (color byte), --- create something appropriate to make it officially white. - -minetest.register_on_placenode( - function(pos, newnode, placer, oldnode, itemstack, pointed_thing) - local def = minetest.registered_items[newnode.name] - - if not def - or not def.palette - or def.after_place_node - or not placer then - return false - end - - local param2 - if not string.find(itemstack:to_string(), "palette_index") then - if def.palette == "unifieddyes_palette_extended.png" - and def.paramtype2 == "color" then - param2 = 240 - elseif def.palette == "unifieddyes_palette_colorwallmounted.png" - and def.paramtype2 == "colorwallmounted" then - param2 = newnode.param2 % 8 - elseif string.find(def.palette, "unifieddyes_palette_") - and def.paramtype2 == "colorfacedir" then -- it's a split palette - param2 = newnode.param2 % 32 - end - - if param2 then - minetest.swap_node(pos, {name = newnode.name, param2 = param2}) - end - end - - if def.palette ~= "" then - minetest.get_meta(pos):set_int("palette_index", param2 or 240) - end - end -) - --- The complementary function: strip-off the color if the node being dug is still white/neutral - -local function move_item(item, pos, inv, digger, fix_color) - if not (digger and digger:is_player()) then return end - local creative = creative_mode or minetest.check_player_privs(digger, "creative") - item = unifieddyes.fix_bad_color_info(item, fix_color) - if inv:room_for_item("main", item) - and (not creative or not inv:contains_item("main", item, true)) then - inv:add_item("main", item) - elseif not creative then - minetest.item_drop(ItemStack(item), digger, pos) - end - minetest.remove_node(pos) -end - -function unifieddyes.on_dig(pos, node, digger) - if not digger then return end - local playername = digger:get_player_name() - if minetest.is_protected(pos, playername) then - minetest.record_protection_violation(pos, playername) - return - end - - local oldparam2 = minetest.get_node(pos).param2 - local def = minetest.registered_items[node.name] - local fix_color - - if def.paramtype2 == "color" and oldparam2 == 240 and def.palette == "unifieddyes_palette_extended.png" then - fix_color = 240 - elseif def.paramtype2 == "color" and oldparam2 == 0 and def.palette == "unifieddyes_palette_extended.png" then - fix_color = 0 - elseif def.paramtype2 == "colorwallmounted" and math.floor(oldparam2 / 8) == 0 and def.palette == "unifieddyes_palette_colorwallmounted.png" then - fix_color = 0 - elseif def.paramtype2 == "colorfacedir" and math.floor(oldparam2 / 32) == 0 and string.find(def.palette, "unifieddyes_palette_") then - fix_color = 0 - end - - local inv = digger:get_inventory() - if fix_color then - move_item(node.name, pos, inv, digger, fix_color) - else - return minetest.node_dig(pos, node, digger) - end -end - --- just stubs to keep old mods from crashing when expecting auto-coloring --- or getting back the dye on dig. - -function unifieddyes.recolor_on_place(foo) -end - -function unifieddyes.after_dig_node(foo) -end - --- This helper function creates multiple copies of the passed node, --- for the split palette - one per hue, plus grey - and assigns --- proper palettes and other attributes - -function unifieddyes.generate_split_palette_nodes(name, def, drop) - for _, color in ipairs(unifieddyes.HUES_WITH_GREY) do - local def2 = table.copy(def) - local desc_color = string.gsub(string.upper(string.sub(color, 1, 1))..string.sub(color, 2), "_", " ") - if string.sub(def2.description, -1) == ")" then - def2.description = string.sub(def2.description, 1, -2)..", "..desc_color.." shades)" - else - def2.description = def2.description.."("..desc_color.." shades)" - end - def2.palette = "unifieddyes_palette_"..color.."s.png" - def2.paramtype2 = "colorfacedir" - def2.groups.ud_param2_colorable = 1 - - if drop then - def2.drop = { - items = { - {items = {drop.."_"..color}, inherit_color = true }, - } - } - end - - minetest.register_node(":"..name.."_"..color, def2) - end -end - --- This helper function creates a colored itemstack - -function unifieddyes.fix_bad_color_info(item, paletteidx) - local stack=minetest.itemstring_with_color(item, paletteidx) - return string.gsub(stack, "u0001color", "u0001palette_index") -end - -function unifieddyes.make_colored_itemstack(item, palette, color) - local paletteidx = unifieddyes.getpaletteidx(color, palette) - return unifieddyes.fix_bad_color_info(item, paletteidx), paletteidx -end - --- these helper functions register all of the recipes needed to create colored --- nodes with any of the dyes supported by that node's palette. - -local function register_c(craft, h, sat, val) - local hue = (type(h) == "table") and h[1] or h - local color = "" - if val then - if craft.palette == "wallmounted" then - color = val..hue..sat - else - color = val..hue..sat - end - else - color = hue -- if val is nil, then it's grey. - end - - local dye = "dye:"..color - local recipe = minetest.serialize(craft.recipe) - recipe = string.gsub(recipe, "MAIN_DYE", dye) - recipe = string.gsub(recipe, "NEUTRAL_NODE", craft.neutral_node) - local newrecipe = minetest.deserialize(recipe) - - local coutput = craft.output or "" - local output = coutput - if craft.output_prefix then - if craft.palette ~= "split" then - output = craft.output_prefix..color..craft.output_suffix..coutput - else - if hue == "white" or hue == "black" or string.find(hue, "grey") then - output = craft.output_prefix.."grey"..craft.output_suffix..coutput - elseif hue == "pink" then - dye = "dye:light_red" - output = craft.output_prefix.."red"..craft.output_suffix..coutput - else - output = craft.output_prefix..hue..craft.output_suffix..coutput - end - end - end - - local colored_itemstack = - unifieddyes.make_colored_itemstack(output, craft.palette, dye) - - minetest.register_craft({ - output = colored_itemstack, - type = craft.type, - recipe = newrecipe - }) - -end - -function unifieddyes.register_color_craft(craft) - local hues_table = unifieddyes.HUES_EXTENDED - local sats_table = unifieddyes.SATS - local vals_table = unifieddyes.VALS_SPLIT - local greys_table = unifieddyes.GREYS - - if craft.palette == "wallmounted" then - register_c(craft, "green", "", "light_") - register_c(craft, "blue", "", "light_") - hues_table = unifieddyes.HUES_WALLMOUNTED - sats_table = {""} - vals_table = unifieddyes.VALS - elseif craft.palette == "extended" then - vals_table = unifieddyes.VALS_EXTENDED - greys_table = unifieddyes.GREYS_EXTENDED - end - - for _, hue in ipairs(hues_table) do - for _, val in ipairs(vals_table) do - for _, sat in ipairs(sats_table) do - - if sat == "_s50" and val ~= "" and val ~= "medium_" and val ~= "dark_" then break end - register_c(craft, hue, sat, val) - - end - end - end - - for _, grey in ipairs(greys_table) do - register_c(craft, grey) - end - - register_c(craft, "pink") - -end - --- code borrowed from homedecor --- call this function to reset the rotation of a "wallmounted" object on place - -function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local colorbits = node.param2 - (node.param2 % 8) - - local yaw = placer:get_look_horizontal() - local dir = minetest.yaw_to_dir(yaw) -- -1.5) - local pitch = placer:get_look_vertical() - - local fdir = minetest.dir_to_wallmounted(dir) - - if pitch < -(math.pi/8) then - fdir = 0 - elseif pitch > math.pi/8 then - fdir = 1 - end - minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits }) -end - --- use this when you have a "wallmounted" node that should never be oriented --- to floor or ceiling... - -function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local colorbits = node.param2 - (node.param2 % 8) - local yaw = placer:get_look_horizontal() - local dir = minetest.yaw_to_dir(yaw+1.5) - local fdir = minetest.dir_to_wallmounted(dir) - - minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits }) -end - --- ... and use this one to force that kind of node off of floor/ceiling --- orientation after the screwdriver rotates it. - -function unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2) - local new_fdir = new_param2 % 8 - local color = new_param2 - new_fdir - if new_fdir < 2 then - new_fdir = 2 - minetest.swap_node(pos, { name = node.name, param2 = new_fdir + color }) - return true - end -end - -function unifieddyes.is_buildable_to(placer_name, ...) - for _, pos in ipairs({...}) do - local node = minetest.get_node_or_nil(pos) - local def = node and minetest.registered_nodes[node.name] - if not (def and def.buildable_to) or minetest.is_protected(pos, placer_name) then - return false - end - end - return true -end - -function unifieddyes.get_hsv(name) -- expects a node/item name - local hue = "" - local a,b - for _, i in ipairs(unifieddyes.HUES_EXTENDED) do - a,b = string.find(name, "_"..i[1]) - if a then - hue = i[1] - break - end - end - - if string.find(name, "_light_grey") then hue = "light_grey" - elseif string.find(name, "_lightgrey") then hue = "light_grey" - elseif string.find(name, "_dark_grey") then hue = "dark_grey" - elseif string.find(name, "_darkgrey") then hue = "dark_grey" - elseif string.find(name, "_grey") then hue = "grey" - elseif string.find(name, "_white") then hue = "white" - elseif string.find(name, "_black") then hue = "black" - end - - local sat = "" - if string.find(name, "_s50") then sat = "_s50" end - - local val = "" - if string.find(name, "dark_") then val = "dark_" end - if string.find(name, "medium_") then val = "medium_" end - if string.find(name, "light_") then val = "light_" end - - return hue, sat, val -end - --- code partially borrowed from cheapie's plasticbox mod - --- in the function below, color is just a color string, while --- palette_type can be: --- --- "extended" = 256 color palette --- "split" = 200 color palette split into pieces for colorfacedir --- "wallmounted" = 32-color abridged palette - - -function unifieddyes.getpaletteidx(color, palette_type) - - local origcolor = color - local aliases = { - ["pink"] = "light_red", - ["brown"] = "medium_orange", - ["azure"] = "light_blue" - } - - local grayscale = { - ["white"] = 1, - ["light_grey"] = 2, - ["grey"] = 3, - ["dark_grey"] = 4, - ["black"] = 5, - } - - local grayscale_extended = { - ["white"] = 0, - ["grey_14"] = 1, - ["grey_13"] = 2, - ["grey_12"] = 3, - ["light_grey"] = 4, - ["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, - ["grey"] = 2, - ["dark_grey"] = 3, - ["black"] = 4, - } - - 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, - ["aqua"] = 10, - ["turquoise"] = 11, - ["cyan"] = 12, - ["cerulean"] = 13, - ["azure"] = 14, - ["skyblue"] = 14, - ["sapphire"] = 15, - ["blue"] = 16, - ["indigo"] = 17, - ["violet"] = 18, - ["mulberry"] = 19, - ["magenta"] = 20, - ["fuchsia"] = 21, - ["rose"] = 22, - ["redviolet"] = 22, - ["crimson"] = 23, - } - - local hues_wallmounted = { - ["red"] = 0, - ["orange"] = 1, - ["yellow"] = 2, - ["green"] = 3, - ["cyan"] = 4, - ["blue"] = 5, - ["violet"] = 6, - ["magenta"] = 7 - } - - local shades = { - [""] = 1, - ["s50"] = 2, - ["light"] = 3, - ["medium"] = 4, - ["mediums50"] = 5, - ["dark"] = 6, - ["darks50"] = 7, - } - - local shades_split = { - ["faint"] = 0, - [""] = 1, - ["s50"] = 2, - ["light"] = 3, - ["medium"] = 4, - ["mediums50"] = 5, - ["dark"] = 6, - ["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, - ["dark"] = 3 - } - - if string.sub(color,1,4) == "dye:" then - color = string.sub(color,5,-1) - elseif string.sub(color,1,12) == "unifieddyes:" then - color = string.sub(color,13,-1) - else - return - end - - if palette_type == "wallmounted" then - if grayscale_wallmounted[color] then - return (grayscale_wallmounted[color] * 8), 0 - end - elseif palette_type == "split" 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 - end - - 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) - elseif string.sub(color,1,5) == "dark_" then - shade = "dark" - color = string.sub(color,6,-1) - end - if string.sub(color,-4,-1) == "_s50" then - shade = shade.."s50" - color = string.sub(color,1,-5) - end - - if palette_type == "wallmounted" then - if color == "green" and shade == "light" then return 48,3 - elseif color == "brown" then return 17,1 - elseif color == "pink" then return 56,7 - elseif color == "blue" and shade == "light" then return 40,5 - elseif hues_wallmounted[color] and shades_wallmounted[shade] then - return (shades_wallmounted[shade] * 64 + hues_wallmounted[color] * 8), hues_wallmounted[color] - end - else - if color == "brown" then - color = "orange" - shade = "medium" - elseif color == "pink" then - color = "red" - shade = "light" - end - if palette_type == "split" then -- it's colorfacedir - if hues_extended[color] and shades_split[shade] then - return (shades_split[shade] * 32), hues_extended[color]+1 - 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 - end - end -end - -function unifieddyes.get_color_from_dye_name(name) - if name == "dye:black" then - return "000000" - elseif name == "dye:white" then - return "ffffff" - end - local item = minetest.registered_items[name] - if not item then return end - local inv_image = item.inventory_image - if not inv_image then return end - return string.match(inv_image,"colorize:#(......):200") -end - --- punch-to-recolor using the airbrush - -function unifieddyes.on_airbrush(itemstack, player, pointed_thing) - local player_name = player:get_player_name() - local painting_with = nil - - if unifieddyes.player_current_dye[player_name] then - painting_with = unifieddyes.player_current_dye[player_name] - end - - if not painting_with then - minetest.chat_send_player(player_name, "*** You need to set a color first.") - minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,") - minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.") - minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.") - return - end - - local pos = minetest.get_pointed_thing_position(pointed_thing) - if not pos then - local look_angle = player:get_look_vertical() - if look_angle > -1.55 then - minetest.chat_send_player(player_name, "*** No node selected") - else - local hexcolor = unifieddyes.get_color_from_dye_name(painting_with) - if hexcolor then - local r = tonumber(string.sub(hexcolor,1,2),16) - local g = tonumber(string.sub(hexcolor,3,4),16) - local b = tonumber(string.sub(hexcolor,5,6),16) - player:set_sky({r=r,g=g,b=b,a=255},"plain") - end - end - return - end - - local node = minetest.get_node(pos) - local def = minetest.registered_items[node.name] - if not def then return end - - if minetest.is_protected(pos, player_name) then - minetest.chat_send_player(player_name, "*** Sorry, someone else owns that node.") - return - end - - if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then - minetest.chat_send_player(player_name, "*** That node can't be colored.") - return - end - - local palette = nil - local fdir = 0 - if not def or not def.palette then - minetest.chat_send_player(player_name, "*** That node can't be colored -- it's either undefined or has no palette.") - return - elseif def.palette == "unifieddyes_palette_extended.png" then - palette = "extended" - elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then - palette = "wallmounted" - fdir = node.param2 % 8 - elseif def.palette ~= "unifieddyes_palette_extended.png" - and def.palette ~= "unifieddyes_palette_colorwallmounted.png" - and string.find(def.palette, "unifieddyes_palette_") then - palette = "split" - fdir = node.param2 % 32 - else - minetest.chat_send_player(player_name, "*** That node can't be colored -- it has an invalid color mode.") - return - end - - local idx, hue = unifieddyes.getpaletteidx(painting_with, palette) - local inv = player:get_inventory() - if (not creative or not creative.is_enabled_for(player_name)) and not inv:contains_item("main", painting_with) then - local suff = "" - if not idx then - suff = " Besides, "..string.sub(painting_with, 5).." can't be applied to that node." - end - minetest.chat_send_player(player_name, "*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff) - return - end - - if not idx then - minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.") - return - end - - local oldidx = node.param2 - fdir - local name = def.airbrush_replacement_node or node.name - - if palette == "split" then - - local modname = string.sub(name, 1, string.find(name, ":")-1) - local nodename2 = string.sub(name, string.find(name, ":")+1) - local oldcolor = "snozzberry" - local newcolor = "razzberry" -- intentionally misspelled ;-) - - if def.ud_color_start and def.ud_color_end then - oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end) - newcolor = string.sub(painting_with, 5) - else - if hue ~= 0 then - newcolor = unifieddyes.HUES_EXTENDED[hue][1] - else - newcolor = "grey" - end - - if def.airbrush_replacement_node then - oldcolor = "grey" - else - local s = string.sub(def.palette, 21) - oldcolor = string.sub(s, 1, string.find(s, "s.png")-1) - end - end - - name = modname..":"..string.gsub(nodename2, oldcolor, newcolor) - - if not minetest.registered_items[name] then - minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.") - return - end - elseif idx == oldidx then - return - end - minetest.swap_node(pos, {name = name, param2 = fdir + idx}) - if not creative or not creative.is_enabled_for(player_name) then - inv:remove_item("main", painting_with) - return - end -end - --- get a node's dye color based on its palette and param2 - -function unifieddyes.color_to_name(param2, def) - if not param2 or not def or not def.palette then return end - - if def.palette == "unifieddyes_palette_extended.png" then - local color = param2 - - local v = 0 - local s = 1 - if color < 24 then v = 1 - elseif color > 23 and color < 48 then v = 2 - elseif color > 47 and color < 72 then v = 3 - elseif color > 71 and color < 96 then v = 4 - elseif color > 95 and color < 120 then v = 5 - elseif color > 119 and color < 144 then v = 5 s = 2 - elseif color > 143 and color < 168 then v = 6 - elseif color > 167 and color < 192 then v = 6 s = 2 - elseif color > 191 and color < 216 then v = 7 - elseif color > 215 and color < 240 then v = 7 s = 2 - end - - if color > 239 then - if color == 240 then return "white" - elseif color == 244 then return "light_grey" - elseif color == 247 then return "grey" - elseif color == 251 then return "dark_grey" - elseif color == 255 then return "black" - else return "grey_"..15-(color-240) - end - else - local h = color - math.floor(color/24)*24 - return unifieddyes.VALS_EXTENDED[v]..unifieddyes.HUES_EXTENDED[h+1][1]..unifieddyes.SATS[s] - end - - elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then - local color = math.floor(param2 / 8) - if color == 0 then return "white" - elseif color == 1 then return "light_grey" - elseif color == 2 then return "grey" - elseif color == 3 then return "dark_grey" - elseif color == 4 then return "black" - elseif color == 5 then return "light_blue" - elseif color == 6 then return "light_green" - elseif color == 7 then return "pink" - end - local v = math.floor(color/8) - local h = color - v * 8 - return unifieddyes.VALS[v]..unifieddyes.HUES_WALLMOUNTED[h+1] - - elseif string.find(def.palette, "unifieddyes_palette") then -- it's the split palette - -- palette names in this mode are always "unifieddyes_palette_COLORs.png" - - local s = string.sub(def.palette, 21) - local color = string.sub(s, 1, string.find(s, "s.png")-1) - - local v = math.floor(param2/32) - if color ~= "grey" then - if v == 0 then return "faint_"..color - elseif v == 1 then return color - elseif v == 2 then return color.."_s50" - elseif v == 3 then return "light_"..color - elseif v == 4 then return "medium_"..color - elseif v == 5 then return "medium_"..color.."_s50" - elseif v == 6 then return "dark_"..color - elseif v == 7 then return "dark_"..color.."_s50" - end - else - if v > 0 and v < 6 then return unifieddyes.GREYS[v] - else return "white" - end - end - end -end - -local hps = 0.6 -- horizontal position scale -local vps = 1.3 -- vertical position scale -local vs = 0.1 -- vertical shift/offset - -local color_button_size = ";0.75,0.75;" -local color_square_size = ";0.69,0.69;" - -function unifieddyes.make_readable_color(color) - -- is this a low saturation color? - local has_low_saturtation = string.find(color, "s50"); - - -- remove _s50 tag, we care about that later again - local s = string.gsub(color, "_s50", "") - - -- replace underscores with spaces to make it look nicer - local s = string.gsub(s, "_", " ") - - -- capitalize words, you know, looks nicer ;) - s = string.gsub(s, "(%l)(%w*)", function(a,b) return string.upper(a)..b end) - - -- add the word dye, this is what the translations expect - s = s.." Dye" - - -- if it is a low sat color, append an appropriate string - if has_low_saturtation then - s = s.." (low saturation)" - end - - return s -end - -function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) - - local dye = "dye:"..colorname - - local overlay = "" - local colorize = minetest.formspec_escape("^[colorize:#"..hexcolor..":255") - - if not creative and inv:contains_item("main", dye) then - overlay = "^unifieddyes_onhand_overlay.png" - end - - local unavail_overlay = "" - if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname] - or (explist and not explist[colorname]) then - if overlay == "" then - unavail_overlay = "^unifieddyes_unavailable_overlay.png" - else - unavail_overlay = "^unifieddyes_onhand_unavailable_overlay.png" - end - end - - local tooltip = "tooltip["..colorname..";".. - S(unifieddyes.make_readable_color(colorname)).. - "\n(dye:"..colorname..")]" - - if dye == painting_with then - overlay = "^unifieddyes_select_overlay.png" - selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..tooltip - end - - local form - if unavail_overlay == "" then - form = "image_button[".. - (hp*hps)..","..(v2*vps+vs).. - color_button_size.. - "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";".. - colorname..";]".. - tooltip - else - form = "image[".. - (hp*hps)..","..(v2*vps+vs).. - color_square_size.. - "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]".. - tooltip - end - - return form, selindic -end - -function unifieddyes.show_airbrush_form(player) - if not player then return end - - local t = {} - - local player_name = player:get_player_name() - local painting_with = unifieddyes.player_selected_dye[player_name] or unifieddyes.player_current_dye[player_name] - local creative = creative and creative.is_enabled_for(player_name) - local inv = player:get_inventory() - local nodepalette = "extended" - local showall = unifieddyes.player_showall[player_name] - - t[1] = "size[14.5,8.5]label[7,-0.3;"..S("Select a color:").."]" - local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]" - - local last_right_click = unifieddyes.player_last_right_clicked[player_name] - if last_right_click then - if last_right_click.def and last_right_click.def.palette then - if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then - nodepalette = "wallmounted" - elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then - t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node that supports all 256 colors, showing them all)").."]" - showall = true - elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" - and last_right_click.def.palette ~= "unifieddyes_palette_colorwallmounted.png" - and string.find(last_right_click.def.palette, "unifieddyes_palette_") then - nodepalette = "split" - end - end - end - - if not last_right_click.def.groups - or not last_right_click.def.groups.ud_param2_colorable - or not last_right_click.def.palette - or not string.find(last_right_click.def.palette, "unifieddyes_palette_") then - t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node not supported by the Airbrush, showing all colors)").."]" - end - - local explist = last_right_click.def.explist - - for v = 0, 6 do - local val = unifieddyes.VALS_EXTENDED[v+1] - - local sat = "" - local v2=(v/2) - - for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do - local hue = h[1] - local hp=hi-1 - - local r = h[2] - local g = h[3] - local b = h[4] - - local factor = 40 - if v > 3 then - factor = 75 - v2 = (v-2) - end - - 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) - - local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2) - local f - f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) - t[#t+1] = f - end - - if v > 3 then - sat = "_s50" - v2 = (v-1.5) - - for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do - local hue = h[1] - local hp=hi-1 - - local r = h[2] - local g = h[3] - local b = h[4] - - local factor = 75 - - local pr = 0.299 - local pg = 0.587 - local pb = 0.114 - - 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) - - 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) - - local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) - local f - f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) - t[#t+1] = f - end - end - end - - local v2=5 - for y = 0, 15 do - - local hp=15-y - - local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17) - local grey = "grey_"..y - - if y == 0 then grey = "black" - elseif y == 4 then grey = "dark_grey" - elseif y == 8 then grey = "grey" - elseif y == 11 then grey = "light_grey" - elseif y == 15 then grey = "white" - end - - local f - f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist) - t[#t+1] = f - - end - - if not creative then - t[#t+1] = "image[10," - t[#t+1] = (vps*5.55+vs) - t[#t+1] = color_button_size - t[#t+1] = "unifieddyes_onhand_overlay.png]label[10.7," - t[#t+1] = (vps*5.51+vs) - t[#t+1] = ";"..S("Dyes").."]" - t[#t+1] = "label[10.7," - t[#t+1] = (vps*5.67+vs) - t[#t+1] = ";on hand]" - - end - - t[#t+1] = "image[10," - t[#t+1] = (vps*5+vs) - t[#t+1] = color_button_size - t[#t+1] = selindic - - if painting_with then - t[#t+1] = "label[10.7," - t[#t+1] = (vps*4.90+vs) - t[#t+1] = ";"..S("Your selection:").."]" - t[#t+1] = "label[10.7," - t[#t+1] = (vps*5.07+vs) - t[#t+1] = ";" - t[#t+1] = S(unifieddyes.make_readable_color(string.sub(painting_with, 5))) - t[#t+1] = "]label[10.7," - t[#t+1] = (vps*5.24+vs) - t[#t+1] = ";(" - t[#t+1] = painting_with - t[#t+1] = ")]" - else - t[#t+1] = "label[10.7," - t[#t+1] = (vps*5.07+vs) - t[#t+1] = ";"..S("Your selection").."]" - end - - t[#t+1] = "button_exit[10.5,8;2,1;cancel;"..S("Cancel").."]button_exit[12.5,8;2,1;accept;"..S("Accept").."]" - - - if last_right_click and last_right_click.def and nodepalette ~= "extended" then - if showall then - t[#t+1] = "button[0,8;2,1;show_avail;"..S("Show Available").."]" - t[#t+1] = "label[2,8.25;"..S("(Currently showing all 256 colors)").."]" - else - t[#t+1] = "button[0,8;2,1;show_all;"..S("Show All Colors").."]" - t[#t+1] = "label[2,8.25;"..S("(Currently only showing what the right-clicked node can use)").."]" - end - end - - minetest.show_formspec(player_name, "unifieddyes:dye_select_form", table.concat(t)) -end - -minetest.register_tool("unifieddyes:airbrush", { - description = S("Dye Airbrush"), - inventory_image = "unifieddyes_airbrush.png", - use_texture_alpha = true, - tool_capabilities = { - full_punch_interval=0.1, - }, - range = 12, - on_use = unifieddyes.on_airbrush, - on_place = function(itemstack, placer, pointed_thing) - local keys = placer:get_player_control() - local player_name = placer:get_player_name() - local pos = minetest.get_pointed_thing_position(pointed_thing) - local node - local def - - if pos then node = minetest.get_node(pos) end - if node then def = minetest.registered_items[node.name] end - - unifieddyes.player_last_right_clicked[player_name] = {pos = pos, node = node, def = def} - - if (not keys.sneak) and def.on_rightclick then - return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) - elseif not keys.sneak then - unifieddyes.show_airbrush_form(placer) - elseif keys.sneak then - if not pos or not def then return end - local newcolor = unifieddyes.color_to_name(node.param2, def) - - if not newcolor then - minetest.chat_send_player(player_name, "*** That node is uncolored.") - return - end - minetest.chat_send_player(player_name, "*** Switching to "..newcolor.." for the airbrush, to match that node.") - unifieddyes.player_current_dye[player_name] = "dye:"..newcolor - end - end -}) - -minetest.register_craft( { - output = "unifieddyes:airbrush", - recipe = { - { "basic_materials:brass_ingot", "", "basic_materials:plastic_sheet" }, - { "", "default:steel_ingot", "" }, - { "", "", "default:steel_ingot" } - }, -}) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - - if formname == "unifieddyes:dye_select_form" then - - local player_name = player:get_player_name() - local nodepalette = "extended" - local showall = unifieddyes.player_showall[player_name] - - local last_right_click = unifieddyes.player_last_right_clicked[player_name] - if last_right_click and last_right_click.def then - if last_right_click.def.palette then - if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then - nodepalette = "wallmounted" - elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" then - nodepalette = "split" - end - end - end - - if fields.show_all then - unifieddyes.player_showall[player_name] = true - unifieddyes.show_airbrush_form(player) - return - elseif fields.show_avail then - unifieddyes.player_showall[player_name] = false - unifieddyes.show_airbrush_form(player) - return - elseif fields.quit then - if fields.accept then - local dye = unifieddyes.player_selected_dye[player_name] - if not dye then - minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but no color was selected!") - return - elseif not showall - and not unifieddyes.palette_has_color[nodepalette.."_"..string.sub(dye, 5)] then - minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but the selected color can't be used on the") - minetest.chat_send_player(player_name, "*** node that was right-clicked (and \"Show All\" wasn't in effect).") - if unifieddyes.player_current_dye[player_name] then - minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "..string.sub(unifieddyes.player_current_dye[player_name], 5)..".") - else - minetest.chat_send_player(player_name, "*** Ignoring it.") - end - return - else - unifieddyes.player_current_dye[player_name] = dye - unifieddyes.player_selected_dye[player_name] = nil - minetest.chat_send_player(player_name, "*** Selected "..string.sub(dye, 5).." for the airbrush.") - return - end - else -- assume "Cancel" or Esc. - unifieddyes.player_selected_dye[player_name] = nil - return - end - else - local s1 = string.sub(minetest.serialize(fields), 11) - local s3 = string.sub(s1,1, string.find(s1, '"')-1) - - local inv = player:get_inventory() - local creative = creative and creative.is_enabled_for(player_name) - local dye = "dye:"..s3 - - if (showall or unifieddyes.palette_has_color[nodepalette.."_"..s3]) and - (minetest.registered_items[dye] and (creative or inv:contains_item("main", dye))) then - unifieddyes.player_selected_dye[player_name] = dye - unifieddyes.show_airbrush_form(player) - end - end - end -end) - --- Generate all dyes that are not part of the default minetest_game dyes mod - -for _, h in ipairs(unifieddyes.HUES_EXTENDED) do - local hue = h[1] - local r = h[2] - local g = h[3] - local b = h[4] - - for v = 0, 6 do - local val = unifieddyes.VALS_EXTENDED[v+1] - - local factor = 40 - if v > 3 then factor = 75 end - - 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) - - -- full-sat color - - local desc = hue:gsub("%a", string.upper, 1).." Dye" - - if val ~= "" then - desc = val:sub(1, -2):gsub("%a", string.upper, 1) .." "..desc - end - - 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", - }) - else - if (val..hue) ~= "medium_orange" - and (val..hue) ~= "light_red" then - 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 }, - }) - end - end - minetest.register_alias("unifieddyes:"..val..hue, "dye:"..val..hue) - - if v > 3 then -- also register the low-sat version - - local pr = 0.299 - local pg = 0.587 - local pb = 0.114 - - 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) - - local color = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3) - - minetest.register_craftitem(":dye:"..val..hue.."_s50", { - description = S(desc.." (low saturation)"), - inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200", - groups = { dye=1, not_in_creative_inventory=1 }, - }) - minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50") - end - end -end - --- register the greyscales too :P - -for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes - - if y ~= 4 and y ~= 8 and y~= 11 then -- don't register the three greys, they're done separately. - - 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 - - minetest.register_craftitem(":dye:"..name, { - description = S(desc), - inventory_image = "unifieddyes_dye.png^[colorize:#"..rgb..":200", - groups = { dye=1, not_in_creative_inventory=1 }, - }) - minetest.register_alias("unifieddyes:"..name, "dye:"..name) - end -end - -minetest.override_item("dye:grey", { - inventory_image = "unifieddyes_dye.png^[colorize:#888888:200", -}) - -minetest.override_item("dye:dark_grey", { - inventory_image = "unifieddyes_dye.png^[colorize:#444444:200", -}) - -minetest.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 }, -}) - --- build a table of color <-> palette associations to reduce the need for --- realtime lookups with getpaletteidx() - -for _, palette in ipairs({"extended", "split", "wallmounted"}) do - local palette2 = palette - - for i in ipairs(unifieddyes.SATS) do - local sat = (palette == "wallmounted") and "" or unifieddyes.SATS[i] - for _, hue in ipairs(unifieddyes.HUES_EXTENDED) do - for _, val in ipairs(unifieddyes.VALS_EXTENDED) do - local color = val..hue[1]..sat - if unifieddyes.getpaletteidx("dye:"..color, palette2) then - unifieddyes.palette_has_color[palette.."_"..color] = true - end - end - end - end - - for y = 0, 15 do - local grey = "grey_"..y - - if y == 0 then grey = "black" - elseif y == 4 then grey = "dark_grey" - elseif y == 8 then grey = "grey" - elseif y == 11 then grey = "light_grey" - elseif y == 15 then grey = "white" - end - if unifieddyes.getpaletteidx("dye:"..grey, palette2) then - unifieddyes.palette_has_color[palette.."_"..grey] = true - end - end -end - -unifieddyes.palette_has_color["wallmounted_light_red"] = true - --- crafting! - -unifieddyes.base_color_crafts = { - { "red", "flowers:rose", nil, nil, nil, nil, 4 }, - { "vermilion", "dye:red", "dye:orange", nil, nil, nil, 3 }, - { "orange", "flowers:tulip", nil, nil, nil, nil, 4 }, - { "orange", "dye:red", "dye:yellow", nil, nil, nil, 2 }, - { "amber", "dye:orange", "dye:yellow", nil, nil, nil, 2 }, - { "yellow", "flowers:dandelion_yellow", nil, nil, nil, nil, 4 }, - { "lime", "dye:yellow", "dye:chartreuse", nil, nil, nil, 2 }, - { "lime", "dye:yellow", "dye:yellow", "dye:green", nil, nil, 3 }, - { "chartreuse", "dye:yellow", "dye:green", nil, nil, nil, 2 }, - { "harlequin", "dye:chartreuse", "dye:green", nil, nil, nil, 2 }, - { "harlequin", "dye:yellow", "dye:green", "dye:green", nil, nil, 3 }, - { "green", "default:cactus", nil, nil, nil, nil, 4 }, - { "green", "dye:yellow", "dye:blue", nil, nil, nil, 2 }, - { "malachite", "dye:green", "dye:spring", nil, nil, nil, 2 }, - { "malachite", "dye:green", "dye:green", "dye:cyan", nil, nil, 3 }, - { "malachite", "dye:green", "dye:green", "dye:green", "dye:blue", nil, 4 }, - { "spring", "dye:green", "dye:cyan", nil, nil, nil, 2 }, - { "spring", "dye:green", "dye:green", "dye:blue", nil, nil, 3 }, - { "turquoise", "dye:spring", "dye:cyan", nil, nil, nil, 2 }, - { "turquoise", "dye:green", "dye:cyan", "dye:cyan", nil, nil, 3 }, - { "turquoise", "dye:green", "dye:green", "dye:green", "dye:blue", "dye:blue", 5 }, - { "cyan", "dye:green", "dye:blue", nil, nil, nil, 2 }, - { "cerulean", "dye:cyan", "dye:azure", nil, nil, nil, 2 }, - { "cerulean", "dye:cyan", "dye:cyan", "dye:blue", nil, nil, 3 }, - { "cerulean", "dye:green", "dye:green", "dye:blue", "dye:blue", "dye:blue", 5 }, - { "azure", "dye:cyan", "dye:blue", nil, nil, nil, 2 }, - { "azure", "dye:green", "dye:blue", "dye:blue", nil, nil, 3 }, - { "sapphire", "dye:azure", "dye:blue", nil, nil, nil, 2 }, - { "sapphire", "dye:cyan", "dye:blue", "dye:blue", nil, nil, 3 }, - { "sapphire", "dye:green", "dye:blue", "dye:blue", "dye:blue", nil, 4 }, - { "blue", "flowers:geranium", nil, nil, nil, nil, 4 }, - { "indigo", "dye:blue", "dye:violet", nil, nil, nil, 2 }, - { "violet", "flowers:viola", nil, nil, nil, nil, 4 }, - { "violet", "dye:blue", "dye:magenta", nil, nil, nil, 2 }, - { "mulberry", "dye:violet", "dye:magenta", nil, nil, nil, 2 }, - { "mulberry", "dye:violet", "dye:blue", "dye:red", nil, nil, 3 }, - { "magenta", "dye:blue", "dye:red", nil, nil, nil, 2 }, - { "fuchsia", "dye:magenta", "dye:rose", nil, nil, nil, 2 }, - { "fuchsia", "dye:blue", "dye:red", "dye:rose", nil, nil, 3 }, - { "fuchsia", "dye:red", "dye:violet", nil, nil, nil, 2 }, - { "rose", "dye:magenta", "dye:red", nil, nil, nil, 2 }, - { "rose", "dye:red", "dye:red", "dye:blue", nil, nil, 3 }, - { "crimson", "dye:rose", "dye:red", nil, nil, nil, 2 }, - { "crimson", "dye:magenta", "dye:red", "dye:red", nil, nil, 3 }, - { "crimson", "dye:red", "dye:red", "dye:red", "dye:blue", nil, 4 }, - - { "black", "default:coal_lump", nil, nil, nil, nil, 4 }, - { "white", "flowers:dandelion_white", nil, nil, nil, nil, 4 }, -} - -unifieddyes.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 }, -} - -for _,i in ipairs(unifieddyes.base_color_crafts) do - local color = i[1] - local yield = i[7] - - minetest.register_craft( { - type = "shapeless", - output = "dye:"..color.." "..yield, - recipe = { - i[2], - i[3], - i[4], - i[5], - i[6], - }, - }) - - for _,j in ipairs(unifieddyes.shade_crafts) do - local firstdye = j[3] - if firstdye == "color" then firstdye = "dye:"..color end - - -- ignore black, white, anything containing the word "grey" - - if color ~= "black" and color ~= "white" and not string.find(color, "grey") then - - minetest.register_craft( { - type = "shapeless", - output = "dye:"..j[1]..color..j[2].." "..j[6], - recipe = { - "dye:"..color, - firstdye, - j[4], - j[5] - }, - }) - end - end -end - --- greys - -unifieddyes.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 }, -} - -for _, i in ipairs(unifieddyes.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 = "dye:"..color.." "..yield, - recipe = { - dye1, - dye2, - dye3, - dye4, - }, - }) -end - --- we can't make dark orange anymore because brown/medium orange conflicts - -minetest.register_craft( { - type = "shapeless", - output = "dye:dark_orange", - recipe = { - "dye:brown", - "dye:brown" - }, -}) - --- aliases - -minetest.register_alias("dye:light_red", "dye:pink") -minetest.register_alias("dye:medium_orange", "dye:brown") - -minetest.register_alias("unifieddyes:black", "dye:black") -minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey") -minetest.register_alias("unifieddyes:grey", "dye: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") -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") - -minetest.register_alias("unifieddyes:brown", "dye:brown") +dofile(modpath.."/color-tables.lua") +dofile(modpath.."/api.lua") +dofile(modpath.."/airbrush.lua") +dofile(modpath.."/dyes-crafting.lua") +dofile(modpath.."/aliases.lua") print(S("[UnifiedDyes] Loaded!")) -