summaryrefslogtreecommitdiff
path: root/lrfurn
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-02-22 17:40:52 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-02-22 17:40:52 -0500
commit7ec609f647139aa44bd0ef8c7d908476379cc24f (patch)
tree34aa6fcf193e51260d7cbba2457ea604f1748925 /lrfurn
parent0aefae28c513b8ab2357d9f92dbf7f79bd7517e6 (diff)
downloaddreambuilder_modpack-7ec609f647139aa44bd0ef8c7d908476379cc24f.tar
dreambuilder_modpack-7ec609f647139aa44bd0ef8c7d908476379cc24f.tar.gz
dreambuilder_modpack-7ec609f647139aa44bd0ef8c7d908476379cc24f.tar.bz2
dreambuilder_modpack-7ec609f647139aa44bd0ef8c7d908476379cc24f.tar.xz
dreambuilder_modpack-7ec609f647139aa44bd0ef8c7d908476379cc24f.zip
updated homedecor (duh :D )
Diffstat (limited to 'lrfurn')
-rw-r--r--lrfurn/coffeetable.lua112
-rw-r--r--lrfurn/init.lua18
-rw-r--r--lrfurn/longsofas.lua10
-rw-r--r--lrfurn/sofas.lua10
4 files changed, 66 insertions, 84 deletions
diff --git a/lrfurn/coffeetable.lua b/lrfurn/coffeetable.lua
index 506a5bf..399d940 100644
--- a/lrfurn/coffeetable.lua
+++ b/lrfurn/coffeetable.lua
@@ -1,7 +1,36 @@
local S = homedecor_i18n.gettext
-minetest.register_node("lrfurn:coffeetable_back", {
+--[[
+ local node = minetest.get_node(pos)
+ local yaw = placer:get_look_yaw()
+ local dir = minetest.yaw_to_dir(yaw-1.5)
+ local fdir = minetest.dir_to_facedir(dir)
+
+ print(placer:get_look_yaw(), yaw)
+ print(node.param2, fdir)
+
+ if lrfurn.check_right(pos, fdir, false, placer) then
+ local pos2 = find_coffee_table_second_node(pos, fdir)
+]]--
+
+local function find_second_node(pos, param2)
+ if param2 == 0 then
+ pos.z = pos.z+1
+ elseif param2 == 1 then
+ pos.x = pos.x+1
+ elseif param2 == 2 then
+ pos.z = pos.z-1
+ elseif param2 == 3 then
+ pos.x = pos.x-1
+ end
+ return pos
+end
+
+minetest.register_alias("lrfurn:coffeetable_back", "lrfurn:coffeetable")
+minetest.register_alias("lrfurn:coffeetable_front", "air")
+
+minetest.register_node("lrfurn:coffeetable", {
description = S("Coffee Table"),
drawtype = "nodebox",
tiles = {"lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png"},
@@ -13,11 +42,12 @@ minetest.register_node("lrfurn:coffeetable_back", {
type = "fixed",
fixed = {
--legs
- {-0.375, -0.5, -0.375, -0.3125, -0.0625, -0.3125},
- {0.3125, -0.5, -0.375, 0.375, -0.0625, -0.3125},
-
+ { -0.375, -0.5, -0.375, -0.3125, -0.0625, -0.3125 },
+ { 0.3125, -0.5, -0.375, 0.375, -0.0625, -0.3125 },
+ { -0.375, -0.5, 1.3125, -0.3125, -0.0625, 1.375 },
+ { 0.3125, -0.5, 1.3125, 0.375, -0.0625, 1.375 },
--tabletop
- {-0.4375, -0.0625, -0.4375, 0.4375, 0, 0.5},
+ {-0.4375, -0.0625, -0.4375, 0.4375, 0, 1.4375},
}
},
selection_box = {
@@ -30,83 +60,19 @@ minetest.register_node("lrfurn:coffeetable_back", {
after_place_node = function(pos, placer, itemstack, pointed_thing)
if minetest.is_protected(pos, placer:get_player_name()) then return true end
local node = minetest.get_node(pos)
- local param2 = node.param2
+ local fdir = node.param2
- local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
-
- if lrfurn.check_forward(pos, fdir, false, placer) then
-
- node.name = "lrfurn:coffeetable_front"
- if param2 == 0 then
- pos.z = pos.z+1
- elseif param2 == 1 then
- pos.x = pos.x+1
- elseif param2 == 2 then
- pos.z = pos.z-1
- elseif param2 == 3 then
- pos.x = pos.x-1
- end
- minetest.set_node(pos, node)
+ if lrfurn.check_right(pos, fdir, false, placer) then
+ minetest.set_node(pos, { name = node.name, param2 = (fdir + 1) % 4 })
else
minetest.chat_send_player(placer:get_player_name(),
- S("No room to place the coffee table!"))
+ S("No room to place the coffee table!"))
minetest.set_node(pos, {name = "air"})
return true
end
-
- end,
-
- after_dig_node = function(pos, oldnode, oldmetadata, digger)
- if minetest.is_protected(pos, digger:get_player_name()) then return true end
-
- local param2 = oldnode.param2
- if param2 == 0 then
- pos.z = pos.z+1
- elseif param2 == 1 then
- pos.x = pos.x+1
- elseif param2 == 2 then
- pos.z = pos.z-1
- elseif param2 == 3 then
- pos.x = pos.x-1
- end
-
- if minetest.is_protected(pos, digger:get_player_name()) then return true end
-
- if (minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:coffeetable_front")
- and (minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2) then
- minetest.remove_node(pos)
- end
end,
})
-minetest.register_node("lrfurn:coffeetable_front", {
- drawtype = "nodebox",
- tiles = {"lrfurn_coffeetable_front.png", "lrfurn_coffeetable_front.png", "lrfurn_coffeetable_front.png", "lrfurn_coffeetable_front.png", "lrfurn_coffeetable_front.png", "lrfurn_coffeetable_front.png"},
- paramtype = "light",
- paramtype2 = "facedir",
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
- sounds = default.node_sound_wood_defaults(),
- node_box = {
- type = "fixed",
- fixed = {
- --legs
- {-0.375, -0.5, 0.3125, -0.3125, -0.0625, 0.375},
- {0.3125, -0.5, 0.3125, 0.375, -0.0625, 0.375},
-
- --tabletop
- {-0.4375, -0.0625, -0.5, 0.4375, 0, 0.4375},
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {0, 0, 0, 0, 0, 0},
- }
- },
-})
-
-minetest.register_alias("lrfurn:coffeetable", "lrfurn:coffeetable_back")
-
minetest.register_craft({
output = "lrfurn:coffeetable",
recipe = {
diff --git a/lrfurn/init.lua b/lrfurn/init.lua
index b529b63..e8b234a 100644
--- a/lrfurn/init.lua
+++ b/lrfurn/init.lua
@@ -2,11 +2,11 @@
lrfurn = {}
screwdriver = screwdriver or {}
-lrfurn.fdir_to_fwd = {
- { 0, 1 },
+lrfurn.fdir_to_right = {
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
+ { 0, 1 },
}
lrfurn.colors = {
@@ -27,11 +27,11 @@ lrfurn.colors = {
"yellow",
}
-function lrfurn.check_forward(pos, fdir, long, placer)
+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_fwd[fdir+1][1], y=pos.y, z = pos.z + lrfurn.fdir_to_fwd[fdir+1][2] }
- local pos3 = { x = pos.x + lrfurn.fdir_to_fwd[fdir+1][1] * 2, y=pos.y, z = pos.z + lrfurn.fdir_to_fwd[fdir+1][2] * 2 }
+ 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
@@ -58,6 +58,14 @@ function lrfurn.check_forward(pos, fdir, long, placer)
return true
end
+function lrfurn.fix_sofa_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-1.5)
+ local fdir = minetest.dir_to_wallmounted(dir)
+ minetest.swap_node(pos, { name = node.name, param2 = fdir })
+end
+
dofile(minetest.get_modpath("lrfurn").."/longsofas.lua")
dofile(minetest.get_modpath("lrfurn").."/sofas.lua")
dofile(minetest.get_modpath("lrfurn").."/armchairs.lua")
diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua
index a152ebb..b5c09d5 100644
--- a/lrfurn/longsofas.lua
+++ b/lrfurn/longsofas.lua
@@ -18,19 +18,23 @@ minetest.register_node("lrfurn:longsofa", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "lrfurn_longsofa_inv.png",
+ wield_scale = { x = 0.6, y = 0.6, z = 0.6 },
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = longsofa_cbox,
node_box = longsofa_cbox,
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
- unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
+ lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
+ local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
- if lrfurn.check_forward(pos, fdir, true, placer) then
- itemstack:take_item()
+ if lrfurn.check_right(pos, fdir, true, placer) then
+ if not creative.is_enabled_for(playername) then
+ itemstack:take_item()
+ end
else
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
minetest.set_node(pos, { name = "air" })
diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua
index 2882bbe..38b557d 100644
--- a/lrfurn/sofas.lua
+++ b/lrfurn/sofas.lua
@@ -18,19 +18,23 @@ minetest.register_node("lrfurn:sofa", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "lrfurn_sofa_inv.png",
+ wield_scale = { x = 0.6, y = 0.6, z = 0.6 },
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = sofa_cbox,
node_box = sofa_cbox,
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
- unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
+ lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
+ local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
- if lrfurn.check_forward(pos, fdir, false, placer) then
- itemstack:take_item()
+ if lrfurn.check_right(pos, fdir, false, placer) then
+ if not creative.is_enabled_for(playername) then
+ itemstack:take_item()
+ end
else
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
minetest.set_node(pos, { name = "air" })