From 65fce91b5c5cd26c945bec2b4073df8664b9a8e4 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Mon, 27 May 2019 15:07:25 -0400 Subject: update digistuff, farming, homedecor, signs_lib, simple streetlights --- homedecor_seating/init.lua | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 homedecor_seating/init.lua (limited to 'homedecor_seating/init.lua') diff --git a/homedecor_seating/init.lua b/homedecor_seating/init.lua new file mode 100644 index 0000000..fe10327 --- /dev/null +++ b/homedecor_seating/init.lua @@ -0,0 +1,78 @@ +-- Home decor seating +-- forked from the previous lrfurn mod + +local S = homedecor.gettext +local modpath = minetest.get_modpath("homedecor_seating") + +lrfurn = {} +screwdriver = screwdriver or {} + +lrfurn.fdir_to_right = { + { 1, 0 }, + { 0, -1 }, + { -1, 0 }, + { 0, 1 }, +} + +lrfurn.colors = { + "black", + "brown", + "blue", + "cyan", + "dark_grey", + "dark_green", + "green", + "grey", + "magenta", + "orange", + "pink", + "red", + "violet", + "white", + "yellow", +} + +function lrfurn.check_right(pos, fdir, long, placer) + if not fdir or fdir > 3 then fdir = 0 end + + local pos2 = { x = pos.x + lrfurn.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + lrfurn.fdir_to_right[fdir+1][2] } + local pos3 = { x = pos.x + lrfurn.fdir_to_right[fdir+1][1] * 2, y=pos.y, z = pos.z + lrfurn.fdir_to_right[fdir+1][2] * 2 } + + local node2 = minetest.get_node(pos2) + if node2 and node2.name ~= "air" then + return false + elseif minetest.is_protected(pos2, placer:get_player_name()) then + if not long then + minetest.chat_send_player(placer:get_player_name(), S("Someone else owns the spot where other end goes!")) + else + minetest.chat_send_player(placer:get_player_name(), S("Someone else owns the spot where the middle or far end goes!")) + end + return false + end + + if long then + local node3 = minetest.get_node(pos3) + if node3 and node3.name ~= "air" then + return false + elseif minetest.is_protected(pos3, placer:get_player_name()) then + minetest.chat_send_player(placer:get_player_name(), S("Someone else owns the spot where the other end goes!")) + return false + end + end + + return true +end + +function lrfurn.fix_sofa_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_yaw() + 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 + +dofile(modpath.."/longsofas.lua") +dofile(modpath.."/sofas.lua") +dofile(modpath.."/armchairs.lua") +dofile(modpath.."/misc.lua") -- cgit v1.2.3