diff options
Diffstat (limited to 'homedecor')
-rw-r--r-- | homedecor/bathroom_furniture.lua | 9 | ||||
-rw-r--r-- | homedecor/bedroom.lua | 8 | ||||
-rw-r--r-- | homedecor/crafts.lua | 174 | ||||
-rw-r--r-- | homedecor/furniture.lua | 4 | ||||
-rw-r--r-- | homedecor/furniture_recipes.lua | 47 | ||||
-rw-r--r-- | homedecor/handlers/expansion.lua | 26 | ||||
-rw-r--r-- | homedecor/lighting.lua | 28 | ||||
-rw-r--r-- | homedecor/shutters.lua | 5 | ||||
-rw-r--r-- | homedecor/window_treatments.lua | 4 |
9 files changed, 221 insertions, 84 deletions
diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 2f57ddb..4840b26 100644 --- a/homedecor/bathroom_furniture.lua +++ b/homedecor/bathroom_furniture.lua @@ -12,12 +12,9 @@ minetest.register_node("homedecor:bathroom_tiles_dark", { paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", - place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), on_construct = unifieddyes.on_construct, - after_place_node = unifieddyes.recolor_on_place, - after_dig_node = unifieddyes.after_dig_node }) minetest.register_node("homedecor:bathroom_tiles_medium", { @@ -31,12 +28,9 @@ minetest.register_node("homedecor:bathroom_tiles_medium", { paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", - place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), on_construct = unifieddyes.on_construct, - after_place_node = unifieddyes.recolor_on_place, - after_dig_node = unifieddyes.after_dig_node }) minetest.register_node("homedecor:bathroom_tiles_light", { @@ -50,12 +44,9 @@ minetest.register_node("homedecor:bathroom_tiles_light", { paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", - place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), on_construct = unifieddyes.on_construct, - after_place_node = unifieddyes.recolor_on_place, - after_dig_node = unifieddyes.after_dig_node }) local tr_cbox = { diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua index 71dcdc0..ddb7f99 100644 --- a/homedecor/bedroom.lua +++ b/homedecor/bedroom.lua @@ -52,13 +52,11 @@ homedecor.register("bed_regular", { on_rotate = screwdriver.disallow, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) if not placer:get_player_control().sneak then return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing) end end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger) homedecor.unextend_bed(pos) end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) @@ -91,9 +89,7 @@ homedecor.register("bed_extended", { sounds = default.node_sound_wood_defaults(), expand = { forward = "air" }, on_rotate = screwdriver.disallow, - after_place_node = unifieddyes.recolor_on_place, after_dig_node = function(pos, oldnode, oldmetadata, digger) - unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger) homedecor.unextend_bed(pos) end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) @@ -124,10 +120,8 @@ homedecor.register("bed_kingsize", { on_rotate = screwdriver.disallow, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger) local inv = digger:get_inventory() if digger:get_player_control().sneak and inv:room_for_item("main", "homedecor:bed_regular 2") then inv:remove_item("main", "homedecor:bed_kingsize 1") @@ -137,7 +131,7 @@ homedecor.register("bed_kingsize", { on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) homedecor.beds_on_rightclick(pos, node, clicker) return itemstack - end + end, }) for _, w in pairs({ N_("mahogany"), N_("oak") }) do diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 69616de..a139063 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -546,6 +546,17 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:shutter_colored", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:shutter", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft({ type = "fuel", recipe = "homedecor:shutter_oak", @@ -867,6 +878,28 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:curtain_closed", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:curtain_closed", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + +unifieddyes.register_color_craft({ + output = "homedecor:curtain_open", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:curtain_open", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + local mats = { { "brass", "homedecor:pole_brass" }, { "wrought_iron", "homedecor:pole_wrought_iron" }, @@ -1195,7 +1228,6 @@ minetest.register_craft( { minetest.register_craft({ output = "homedecor:glowlight_half 6", recipe = { - { "dye:white", "dye:white", "dye:white" }, { "default:glass", "homedecor:power_crystal", "default:glass", }, } }) @@ -1203,18 +1235,56 @@ minetest.register_craft({ minetest.register_craft({ output = "homedecor:glowlight_half 6", recipe = { - { "dye:white", "dye:white", "dye:white" }, {"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", }, } }) minetest.register_craft({ + output = "homedecor:glowlight_half", + recipe = { + {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}, + {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"} + } +}) + +minetest.register_craft({ + output = "homedecor:glowlight_half", + type = "shapeless", + recipe = { + "homedecor:glowlight_quarter", + "homedecor:glowlight_quarter" + } +}) + +unifieddyes.register_color_craft({ + output = "homedecor:glowlight_half", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:glowlight_half", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + +minetest.register_craft({ output = "homedecor:glowlight_quarter 6", recipe = { {"homedecor:glowlight_half", "homedecor:glowlight_half", "homedecor:glowlight_half", }, } }) +unifieddyes.register_color_craft({ + output = "homedecor:glowlight_quarter", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:glowlight_quarter", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft({ output = "homedecor:glowlight_small_cube 8", recipe = { @@ -1239,20 +1309,14 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = "homedecor:glowlight_half", - recipe = { - {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}, - {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"} - } -}) - -minetest.register_craft({ - output = "homedecor:glowlight_half", - type = "shapeless", - recipe = { - "homedecor:glowlight_quarter", - "homedecor:glowlight_quarter" +unifieddyes.register_color_craft({ + output = "homedecor:glowlight_small_cube", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:glowlight_small_cube", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" } }) @@ -2227,6 +2291,17 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:bathroom_tiles_light", + palette = "extended", + type = "shapeless", + neutral_node = "homedecor:bathroom_tiles_light", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft( { output = "homedecor:bathroom_tiles_medium 4", recipe = { @@ -2235,6 +2310,17 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:bathroom_tiles_medium", + palette = "extended", + type = "shapeless", + neutral_node = "homedecor:bathroom_tiles_medium", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft( { output = "homedecor:bathroom_tiles_dark 4", recipe = { @@ -2243,6 +2329,17 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:bathroom_tiles_dark", + palette = "extended", + type = "shapeless", + neutral_node = "homedecor:bathroom_tiles_dark", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + -- misc electrical minetest.register_craft( { @@ -2476,6 +2573,17 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:bed_regular", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:bed_regular", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft( { output = "homedecor:bed_kingsize", recipe = { @@ -2483,6 +2591,29 @@ minetest.register_craft( { }, }) +unifieddyes.register_color_craft({ + output = "homedecor:bed_kingsize", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:bed_kingsize", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + +unifieddyes.register_color_craft({ + output = "homedecor:bed_kingsize", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:bed_regular", + recipe = { + "NEUTRAL_NODE", + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft( { output = "homedecor:bottle_green", recipe = { @@ -2843,6 +2974,17 @@ minetest.register_craft({ }, }) +unifieddyes.register_color_craft({ + output = "homedecor:desk_lamp", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:desk_lamp", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft({ output = "homedecor:hanging_lantern 2", recipe = { diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 6c4526c..4acfa58 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -83,9 +83,7 @@ homedecor.register("kitchen_chair_padded", { sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node, on_rotate = unifieddyes.fix_after_screwdriver_nsew, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) pos.y = pos.y+0 -- where do I put my ass ? @@ -110,9 +108,7 @@ homedecor.register("armchair", { node_box = ac_cbox, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node, on_rotate = unifieddyes.fix_after_screwdriver_nsew, }) diff --git a/homedecor/furniture_recipes.lua b/homedecor/furniture_recipes.lua index fea13cf..a995242 100644 --- a/homedecor/furniture_recipes.lua +++ b/homedecor/furniture_recipes.lua @@ -70,6 +70,17 @@ minetest.register_craft({ }, }) +unifieddyes.register_color_craft({ + output = "homedecor:armchair", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:armchair", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft({ type = "shapeless", output = "homedecor:kitchen_chair_padded", @@ -79,6 +90,17 @@ minetest.register_craft({ }, }) +unifieddyes.register_color_craft({ + output = "homedecor:kitchen_chair_padded", + palette = "wallmounted", + type = "shapeless", + neutral_node = "homedecor:kitchen_chair_padded", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } +}) + minetest.register_craft({ type = "fuel", recipe = "homedecor:kitchen_chair_wood", @@ -106,6 +128,17 @@ minetest.register_craft({ }, }) +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", @@ -148,13 +181,15 @@ minetest.register_craft({ }, }) -minetest.register_craft({ - output = "homedecor:standing_lamp_off", +unifieddyes.register_color_craft({ + output = "homedecor:table_lamp_off", + palette = "extended", + type = "shapeless", + neutral_node = "homedecor:table_lamp_off", recipe = { - { "homedecor:table_lamp_off"}, - { "group:stick"}, - { "group:stick"}, - }, + "NEUTRAL_NODE", + "MAIN_DYE" + } }) minetest.register_craft({ diff --git a/homedecor/handlers/expansion.lua b/homedecor/handlers/expansion.lua index e9d2ec5..779e077 100644 --- a/homedecor/handlers/expansion.lua +++ b/homedecor/handlers/expansion.lua @@ -211,22 +211,21 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks local rightnode = minetest.get_node(rightpos) local inv = placer:get_inventory() - local lastdye = unifieddyes.last_used_dye[placer_name] if leftnode.name == "homedecor:bed_regular" then local newname = string.gsub(thisnode.name, "_regular", "_kingsize") - local meta = minetest.get_meta(leftpos) + local meta = minetest.get_meta(pos) + local leftmeta = minetest.get_meta(leftpos) + minetest.set_node(pos, {name = "air"}) - minetest.set_node(leftpos, { name = newname, param2 = param2}) - meta:set_string("dye", lastdye) - inv:add_item("main", lastdye) + minetest.swap_node(leftpos, { name = newname, param2 = param2}) elseif rightnode.name == "homedecor:bed_regular" then local newname = string.gsub(thisnode.name, "_regular", "_kingsize") - local meta = minetest.get_meta(rightpos) + local meta = minetest.get_meta(pos) + local rightmeta = minetest.get_meta(rightpos) + minetest.set_node(rightpos, {name = "air"}) - minetest.set_node(pos, { name = newname, param2 = param2}) - meta:set_string("dye", lastdye) - inv:add_item("main", lastdye) + minetest.swap_node(pos, { name = newname, param2 = param2}) end local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} @@ -235,14 +234,7 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then local newname = string.gsub(thisnode.name, "_regular", "_extended") local newparam2 = param2 % 8 - if inv:contains_item("main", lastdye) then - minetest.set_node(toppos, { name = thisnode.name, param2 = param2}) - if lastdye then inv:remove_item("main", lastdye.." 1") end - else - minetest.set_node(toppos, { name = thisnode.name, param2 = newparam2}) - minetest.chat_send_player(placer_name, "Ran out of "..lastdye..", using neutral color.") - unifieddyes.last_used_dye[placer_name] = nil - end + minetest.swap_node(toppos, { name = thisnode.name, param2 = param2}) minetest.swap_node(pos, { name = newname, param2 = param2}) itemstack:take_item() end diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index cca06b7..a33c761 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -46,9 +46,7 @@ minetest.register_node("homedecor:glowlight_half", { sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node }) minetest.register_node("homedecor:glowlight_quarter", { @@ -86,9 +84,7 @@ minetest.register_node("homedecor:glowlight_quarter", { sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node }) minetest.register_node("homedecor:glowlight_small_cube", { @@ -126,9 +122,7 @@ minetest.register_node("homedecor:glowlight_small_cube", { sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node }) homedecor.register("plasma_lamp", { @@ -449,7 +443,6 @@ local function reg_lamp(suffix, nxt, light, brightness) paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", - place_param2 = 240, walkable = false, light_source = light, selection_box = tlamp_cbox, @@ -457,14 +450,17 @@ local function reg_lamp(suffix, nxt, light, brightness) groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=((light ~= nil) and 1) or nil, }, - drop = "homedecor:table_lamp_off", on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) node.name = "homedecor:table_lamp_"..repl[suffix] minetest.set_node(pos, node) end, on_construct = unifieddyes.on_construct, - after_place_node = unifieddyes.recolor_on_place, - after_dig_node = unifieddyes.after_dig_node + drop = { + items = { + {items = {"homedecor:table_lamp_off"}, inherit_color = true }, + } + } + }) homedecor.register("standing_lamp_"..suffix, { @@ -480,7 +476,6 @@ local function reg_lamp(suffix, nxt, light, brightness) paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", - place_param2 = 240, walkable = false, light_source = light, groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, @@ -494,9 +489,12 @@ local function reg_lamp(suffix, nxt, light, brightness) minetest.set_node(pos, node) end, on_construct = unifieddyes.on_construct, - after_place_node = unifieddyes.recolor_on_place, - after_dig_node = unifieddyes.after_dig_node, - expand = { top="air" }, + --expand = { top="air" }, + drop = { + items = { + {items = {"homedecor:standing_lamp_off"}, inherit_color = true }, + } + } }) -- for old maps that had the original 3dforniture mod @@ -535,9 +533,7 @@ homedecor.register("desk_lamp", { groups = {snappy=3, ud_param2_colorable = 1}, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node, on_rotate = unifieddyes.fix_after_screwdriver_nsew }) diff --git a/homedecor/shutters.lua b/homedecor/shutters.lua index 44aa4ab..52c03cd 100644 --- a/homedecor/shutters.lua +++ b/homedecor/shutters.lua @@ -41,9 +41,7 @@ homedecor.register("shutter", { node_box = shutter_cbox, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node }) homedecor.register("shutter_colored", { @@ -60,10 +58,7 @@ homedecor.register("shutter_colored", { node_box = shutter_cbox, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, - after_dig_node = unifieddyes.after_dig_node, - drop = "homedecor:shutter" }) minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet") diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua index 71935b0..c7eff50 100644 --- a/homedecor/window_treatments.lua +++ b/homedecor/window_treatments.lua @@ -112,10 +112,8 @@ minetest.register_node("homedecor:curtain_closed", { paramtype2 = "colorwallmounted", palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted" }, - after_dig_node = unifieddyes.after_dig_node, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) @@ -141,10 +139,8 @@ minetest.register_node("homedecor:curtain_open", { paramtype2 = "colorwallmounted", palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted" }, - after_dig_node = unifieddyes.after_dig_node, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) |