1 local function sit(pos, node, clicker)
2 local player = clicker:get_player_name()
3 local objs = minetest.get_objects_inside_radius(pos, 0.1)
5 for _, p in pairs(objs) do
6 if p:get_player_name() ~= clicker:get_player_name() then
11 if default.player_attached[player] == true then
14 clicker:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
15 clicker:set_physics_override(1, 1, 1)
16 default.player_attached[player] = false
17 default.player_set_animation(clicker, "stand", 30)
19 elseif default.player_attached[player] ~= true and node.param2 <= 3 and
20 clicker:get_player_velocity().x == 0 and
21 clicker:get_player_velocity().y == 0 and
22 clicker:get_player_velocity().z == 0 then
24 clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
25 clicker:set_physics_override(0, 0, 0)
27 default.player_attached[player] = true
28 default.player_set_animation(clicker, "sit", 30)
30 if node.param2 == 0 then
31 clicker:set_look_yaw(3.15)
32 elseif node.param2 == 1 then
33 clicker:set_look_yaw(7.9)
34 elseif node.param2 == 2 then
35 clicker:set_look_yaw(6.28)
36 elseif node.param2 == 3 then
37 clicker:set_look_yaw(4.75)
42 local function dig(pos, player)
43 local pname = player:get_player_name()
44 local objs = minetest.get_objects_inside_radius(pos, 0.1)
46 for _, p in pairs(objs) do
47 if not player or not player:is_player() or p:get_player_name() ~= nil or
48 default.player_attached[pname] == true then
56 xdecor.register("chair", {
57 description = "Chair",
58 tiles = {"xdecor_wood.png"},
59 sounds = default.node_sound_wood_defaults(),
60 groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3},
61 on_rotate = screwdriver.rotate_simple,
64 fixed = {{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125},
65 {0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
66 {-0.1875, 0.025, 0.22, 0.1875, 0.45, 0.28},
67 {-0.3125, -0.5, -0.3125, -0.1875, -0.125, -0.1875},
68 {0.1875, -0.5, -0.3125, 0.3125, -0.125, -0.1875},
69 {-0.3125, -0.125, -0.3125, 0.3125, 0, 0.1875}}
72 on_rightclick = function(pos, node, clicker)
73 pos.y = pos.y + 0 -- Sitting position.
74 sit(pos, node, clicker)
78 xdecor.register("cushion", {
79 description = "Cushion",
80 tiles = {"xdecor_cushion.png"},
81 groups = {snappy=3, flammable=3, fall_damage_add_percent=-50},
82 on_place = minetest.rotate_node,
83 node_box = xdecor.nodebox.slab_y(-0.5, 0.5),
85 on_rightclick = function(pos, node, clicker)
87 sit(pos, node, clicker)