Add files via upload
parent
18cbff3084
commit
5ff1c9b4c2
|
@ -0,0 +1,35 @@
|
|||
nodecore.register_craft({
|
||||
label = "assemble wood chair",
|
||||
nodes = {
|
||||
{match = modname .. ":plank", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = 1, match = modname .. ":stick", replace = "air"},
|
||||
{x = 1, z = 1, match = modname .. ":stick", replace = "air"},
|
||||
{x = 1, z = 1, match = modname .. ":stick", replace = "air"},
|
||||
{x = 1, z = 1, match = modname .. ":stick", replace = "air"},
|
||||
},
|
||||
items = {
|
||||
modname .. ":chair_wood"
|
||||
}
|
||||
})
|
||||
|
||||
nodecore.register_craft({
|
||||
label = "assemble wood table",
|
||||
nodes = {
|
||||
{match = modname .. ":plank", replace = "air"},
|
||||
{x = -1, z = -1, match = modname .. ":wood", replace = "air"},
|
||||
{x = -1, z = 1, match = modname .. ":stick", replace = "air"},
|
||||
},
|
||||
items = {
|
||||
modname .. ":chair_wood"
|
||||
}
|
||||
})
|
|
@ -0,0 +1,113 @@
|
|||
local chair_table = { --name, material, invimg
|
||||
{"Stone Chair", "cobble"},
|
||||
{"Wood Chair", "wood"},
|
||||
{"Acacia Wood Chair", "acacia_wood"},
|
||||
{"Aspen Wood Chair", "aspen_wood"},
|
||||
{"Pine Wood Chair", "pine_wood"},
|
||||
{"Jungle Wood Chair", "junglewood"}
|
||||
}
|
||||
|
||||
for i in ipairs (chair_table) do
|
||||
local name = chair_table[i][1]
|
||||
local material = chair_table[i][2]
|
||||
local invimg = chair_table[i][3]
|
||||
|
||||
minetest.register_node("nc_furniture:chair_"..material, {
|
||||
description = name,
|
||||
drawtype = "nodebox",
|
||||
tiles = {"default_"..material..".png"},
|
||||
groups = {choppy=2, oddly_breakably_by_hand=2, furniture=1, flammable=1},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
nc_furniture.sit(pos, node, clicker)
|
||||
end,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.5, -0.4375, -0.1875, 0, -0.25}, -- NodeBox1
|
||||
{-0.375, -0.5, 0.25, -0.1875, 0, 0.4375}, -- NodeBox2
|
||||
{0.1875, -0.5, 0.25, 0.375, 0, 0.4375}, -- NodeBox3
|
||||
{0.1875, -0.5, -0.4375, 0.375, 0, -0.25}, -- NodeBox4
|
||||
{-0.375, 0, -0.4375, 0.375, 0.1875, 0.4375}, -- NodeBox5
|
||||
{-0.375, 0.1875, 0.3125, 0.375, 0.875, 0.4375}, -- NodeBox6
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local table_table = { --name, material, invimg
|
||||
{"Stone Table", "stonework_stone"},
|
||||
{"Wood Table", "woodwork_wood"}
|
||||
}
|
||||
|
||||
for i in ipairs (table_table) do
|
||||
local name = table_table[i][1]
|
||||
local material = table_table[i][2]
|
||||
local invimg = table_table[i][3]
|
||||
|
||||
minetest.register_node("nc_furniture:table_"..material, {
|
||||
description = name,
|
||||
drawtype = "nodebox",
|
||||
tiles = {"nc_"..material..".png"},
|
||||
groups = {snappy = 2, oddly_breakable_by_hand = 2, furniture = 1, flammable = 1, table = 1},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.125, -0.5, -0.125, 0.125, 0.3125, 0.125}, -- NodeBox2
|
||||
{-0.5, 0.3125, -0.5, 0.5, 0.5, 0.5}, -- NodeBox3
|
||||
}
|
||||
},
|
||||
|
||||
after_dig_node = function(pos) nc_furniture.check_table(pos, material, false, true) end,
|
||||
after_place_node = function(pos) nc_furniture.check_table(pos, material, true, true) end,
|
||||
on_punch = function(pos) nc_furniture.check_table(pos, material, true, true) end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("nc_furniture:furn_frame", {
|
||||
tiles = {
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
||||
{-0.5, 0.5, 0.375, 0.5, 1.375, 0.5},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("nc_furniture:furn_legs", {
|
||||
tiles = {
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png",
|
||||
"nc_woodwork_plank.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, -0.375, 0.375, -0.375}, -- NodeBox1
|
||||
{-0.5, -0.5, 0.375, -0.375, 0.375, 0.5}, -- NodeBox2
|
||||
{0.375, -0.5, 0.375, 0.5, 0.375, 0.5}, -- NodeBox3
|
||||
{0.375, -0.5, -0.5, 0.5, 0.375, -0.375}, -- NodeBox4
|
||||
}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,48 @@
|
|||
function nc_furniture.sit(pos, node, clicker)
|
||||
do return end -- delete it when the engine is stabler for the player's physics
|
||||
local meta = minetest.get_meta(pos)
|
||||
local param2 = node.param2
|
||||
local sitting = meta:get_string("is_sit")
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
if sitting == name then
|
||||
meta:set_string("is_sit", "")
|
||||
pos.y = pos.y-0.5
|
||||
clicker:setpos(pos)
|
||||
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(1, 1, 1)
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand", 30)
|
||||
|
||||
elseif sitting == "" and not default.player_attached[name] then
|
||||
meta:set_string("is_sit", clicker:get_player_name())
|
||||
clicker:setpos(pos)
|
||||
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(0, 0, 0)
|
||||
clicker:setpos(pos)
|
||||
default.player_attached[name] = true
|
||||
default.player_set_animation(clicker, "sit", 30)
|
||||
if param2 == 0 then
|
||||
clicker:set_look_yaw(3.15)
|
||||
elseif param2 == 1 then
|
||||
clicker:set_look_yaw(7.9)
|
||||
elseif param2 == 2 then
|
||||
clicker:set_look_yaw(6.28)
|
||||
elseif param2 == 3 then
|
||||
clicker:set_look_yaw(4.75)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function nc_furniture.dig_chair(pos, node, meta, digger)
|
||||
local sitting = meta.fields.is_sit or nil
|
||||
|
||||
if sitting and sitting ~= "" then
|
||||
local player = minetest.get_player_by_name(sitting)
|
||||
pos.y = pos.y-0.5
|
||||
player:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
||||
player:set_physics_override(1, 1, 1)
|
||||
default.player_attached[sitting] = false
|
||||
default.player_set_animation(player, "stand", 30)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue