From df5879ef7204340b1b4a5d97e3dd211f36d76293 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 17 Feb 2017 23:14:21 -0500 Subject: update castle, homedecor, ilights, and unified dyes --- homedecor/bedroom.lua | 4 ++-- homedecor/books.lua | 4 ++-- homedecor/furniture.lua | 6 +++--- homedecor/init.lua | 29 ----------------------------- homedecor/lighting.lua | 8 ++++---- homedecor/shutters.lua | 4 ++-- homedecor/window_treatments.lua | 4 ++-- 7 files changed, 15 insertions(+), 44 deletions(-) (limited to 'homedecor') diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua index 1a7e42f..9dd42ea 100644 --- a/homedecor/bedroom.lua +++ b/homedecor/bedroom.lua @@ -51,7 +51,7 @@ homedecor.register("bed_regular", { sounds = default.node_sound_wood_defaults(), on_rotate = screwdriver.disallow, after_place_node = function(pos, placer, itemstack, pointed_thing) - homedecor.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) if not placer:get_player_control().sneak then return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing) end @@ -123,7 +123,7 @@ homedecor.register("bed_kingsize", { node_box = kbed_cbox, sounds = default.node_sound_wood_defaults(), on_rotate = screwdriver.disallow, - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, after_dig_node = function(pos, oldnode, oldmetadata, digger) local inv = digger:get_inventory() if digger:get_player_control().sneak and inv:room_for_item("main", "bed_regular 1") then diff --git a/homedecor/books.lua b/homedecor/books.lua index a2213ac..891a6ef 100644 --- a/homedecor/books.lua +++ b/homedecor/books.lua @@ -83,7 +83,7 @@ homedecor.register("book", { if not homedecor.expect_infinite_stacks then itemstack:take_item() end - homedecor.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) return itemstack end, on_dig = book_dig, @@ -105,7 +105,7 @@ homedecor.register("book_open", { walkable = false, paramtype2 = "colorwallmounted", palette = "unifieddyes_palette_colorwallmounted.png", - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node, on_dig = book_dig, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 30e8e06..20c76fb 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -58,7 +58,7 @@ homedecor.register("kitchen_chair_wood", { collision_box = kc_cbox, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) pos.y = pos.y+0 -- where do I put my ass ? homedecor.sit(pos, node, clicker) @@ -80,7 +80,7 @@ homedecor.register("kitchen_chair_padded", { collision_box = kc_cbox, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) pos.y = pos.y+0 -- where do I put my ass ? @@ -103,7 +103,7 @@ homedecor.register("armchair", { groups = {snappy=3, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), node_box = ac_cbox, - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node, }) diff --git a/homedecor/init.lua b/homedecor/init.lua index f4c6ed6..666724c 100644 --- a/homedecor/init.lua +++ b/homedecor/init.lua @@ -61,35 +61,6 @@ function homedecor.find_ceiling(itemstack, placer, pointed_thing) return isceiling, pos end --- call this function to reset the rotation of a "wallmounted" object on place - -function homedecor.fix_rotation(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local yaw = placer:get_look_yaw() - 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/4) then - fdir = 0 - elseif pitch > math.pi/4 then - fdir = 1 - end - minetest.swap_node(pos, { name = node.name, param2 = fdir }) -end - --- use this when you have a "wallmounted" node that should never be oriented --- to floor or ceiling (e.g. a desk lamp) - -function homedecor.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local yaw = placer:get_look_yaw() - local dir = minetest.yaw_to_dir(yaw) - local fdir = minetest.dir_to_wallmounted(dir) - minetest.swap_node(pos, { name = node.name, param2 = fdir }) -end - screwdriver = screwdriver or {} homedecor.plain_wood = { name = "homedecor_generic_wood_plain.png", color = 0xffa76820 } diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index 62a88a9..8fbc68b 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -35,7 +35,7 @@ minetest.register_node("homedecor:glowlight_half", { groups = { snappy = 3, ud_param2_colorable = 1 }, light_source = default.LIGHT_MAX, sounds = default.node_sound_glass_defaults(), - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, after_dig_node = unifieddyes.after_dig_node }) @@ -63,7 +63,7 @@ minetest.register_node("homedecor:glowlight_quarter", { groups = { snappy = 3, ud_param2_colorable = 1 }, light_source = default.LIGHT_MAX-1, sounds = default.node_sound_glass_defaults(), - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, after_dig_node = unifieddyes.after_dig_node }) @@ -91,7 +91,7 @@ minetest.register_node("homedecor:glowlight_small_cube", { groups = { snappy = 3, ud_param2_colorable = 1 }, light_source = default.LIGHT_MAX-1, sounds = default.node_sound_glass_defaults(), - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, after_dig_node = unifieddyes.after_dig_node }) @@ -493,7 +493,7 @@ homedecor.register("desk_lamp", { node_box = dlamp_cbox, walkable = false, groups = {snappy=3, ud_param2_colorable = 1}, - after_place_node = homedecor.fix_rotation_nsew, + after_place_node = unifieddyes.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node }) diff --git a/homedecor/shutters.lua b/homedecor/shutters.lua index ab1321d..b463021 100644 --- a/homedecor/shutters.lua +++ b/homedecor/shutters.lua @@ -38,7 +38,7 @@ homedecor.register("shutter", { sounds = default.node_sound_wood_defaults(), selection_box = shutter_cbox, node_box = shutter_cbox, - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, after_dig_node = unifieddyes.after_dig_node }) @@ -54,7 +54,7 @@ homedecor.register("shutter_colored", { sounds = default.node_sound_wood_defaults(), selection_box = shutter_cbox, node_box = shutter_cbox, - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, after_dig_node = unifieddyes.after_dig_node, drop = "homedecor:shutter" }) diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua index 06328d3..df9dadf 100644 --- a/homedecor/window_treatments.lua +++ b/homedecor/window_treatments.lua @@ -113,7 +113,7 @@ minetest.register_node("homedecor:curtain_closed", { palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted" }, after_dig_node = unifieddyes.after_dig_node, - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, 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}) if string.find(topnode.name, "homedecor:curtainrod") then @@ -139,7 +139,7 @@ minetest.register_node("homedecor:curtain_open", { palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted" }, after_dig_node = unifieddyes.after_dig_node, - after_place_node = homedecor.fix_rotation, + after_place_node = unifieddyes.fix_rotation, 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}) if string.find(topnode.name, "homedecor:curtainrod") then -- cgit v1.2.3