1 local function sit(pos, node, clicker)
2 local meta = minetest.get_meta(pos)
3 local player = clicker:get_player_name()
5 if meta:get_string("is_sit") == "yes" then
6 meta:set_string("is_sit", "")
9 clicker:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
10 clicker:set_physics_override(1, 1, 1)
11 default.player_attached[player] = false
12 default.player_set_animation(clicker, "stand", 30)
13 elseif meta:get_string("is_sit") == "" and
14 clicker:get_player_velocity().x == 0 and
15 clicker:get_player_velocity().y == 0 and
16 clicker:get_player_velocity().z == 0 then
18 meta:set_string("is_sit", "yes")
19 clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
20 clicker:set_physics_override(0, 0, 0)
22 default.player_attached[player] = true
23 default.player_set_animation(clicker, "sit", 30)
25 if node.param2 == 0 then
26 clicker:set_look_yaw(3.15)
27 elseif node.param2 == 1 then
28 clicker:set_look_yaw(7.9)
29 elseif node.param2 == 2 then
30 clicker:set_look_yaw(6.28)
31 elseif node.param2 == 3 then
32 clicker:set_look_yaw(4.75)
37 xpanes.register_pane("bamboo_frame", {
38 description = "Bamboo Frame",
39 tiles = {"xdecor_bamboo_frame.png"},
42 textures = {"xdecor_bamboo_frame.png", "xdecor_bamboo_frame.png", "xpanes_space.png"},
43 inventory_image = "xdecor_bamboo_frame.png",
44 wield_image = "xdecor_bamboo_frame.png",
45 groups = {snappy=3, pane=1, flammable=2},
47 {"default:papyrus", "default:papyrus", "default:papyrus"},
48 {"default:papyrus", "farming:cotton", "default:papyrus"},
49 {"default:papyrus", "default:papyrus", "default:papyrus"}
53 xdecor.register("baricade", {
54 description = "Baricade",
55 drawtype = "plantlike",
57 inventory_image = "xdecor_baricade.png",
58 tiles = {"xdecor_baricade.png"},
59 groups = {snappy=3, flammable=3},
60 damage_per_second = 4,
61 selection_box = xdecor.nodebox.slab_y(0.3)
64 xdecor.register("barrel", {
65 description = "Barrel",
66 inventory = {size=24},
68 tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"},
69 groups = {choppy=3, flammable=3},
70 sounds = default.node_sound_wood_defaults()
73 xdecor.register("cabinet", {
74 description = "Wood Cabinet",
75 inventory = {size=24},
76 infotext = "Wood Cabinet",
77 groups = {choppy=3, flammable=3},
78 sounds = default.node_sound_wood_defaults(),
80 "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png",
81 "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png",
82 "xdecor_cabinet_sides.png", "xdecor_cabinet_front.png"
86 xdecor.register("cabinet_half", {
87 description = "Half Wood Cabinet",
89 infotext = "Half Wood Cabinet",
90 groups = {choppy=3, flammable=3},
91 sounds = default.node_sound_wood_defaults(),
92 node_box = xdecor.nodebox.slab_y(0.5, 0.5),
94 "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png",
95 "xdecor_half_cabinet_sides.png", "xdecor_half_cabinet_sides.png",
96 "xdecor_half_cabinet_sides.png", "xdecor_half_cabinet_front.png"
100 xdecor.register("candle", {
101 description = "Candle",
103 drawtype = "torchlike",
104 inventory_image = "xdecor_candle_inv.png",
105 wield_image = "xdecor_candle_wield.png",
106 paramtype2 = "wallmounted",
107 legacy_wallmounted = true,
109 groups = {dig_immediate=3, attached_node=1},
111 { name = "xdecor_candle_floor.png",
112 animation = {type="vertical_frames", length=1.5} },
113 { name = "xdecor_candle_ceiling.png",
114 animation = {type="vertical_frames", length=1.5} },
115 { name = "xdecor_candle_wall.png",
116 animation = {type="vertical_frames", length=1.5} }
119 type = "wallmounted",
120 wall_top = {-0.3, -0.4, -0.3, 0.3, 0.5, 0.3},
121 wall_bottom = {-0.25, -0.5, -0.25, 0.25, 0.1, 0.25},
122 wall_side = {-0.5, -0.35, -0.15, -0.15, 0.4, 0.15}
126 xdecor.register("cauldron", {
127 description = "Cauldron",
130 { name = "xdecor_cauldron_top_anim.png",
131 animation = {type="vertical_frames", length=3.0} },
132 "xdecor_cauldron_sides.png"
136 if minetest.get_modpath("bucket") then
137 local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
138 minetest.override_item("bucket:bucket_empty", {
139 on_use = function(itemstack, user, pointed_thing)
140 local inv = user:get_inventory()
141 if pointed_thing.type == "node" and minetest.get_node(pointed_thing.under).name == "xdecor:cauldron" then
142 if inv:room_for_item("main", "bucket:bucket_water 1") then
143 itemstack:take_item()
144 inv:add_item("main", "bucket:bucket_water 1")
146 minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
149 else if original_bucket_on_use then
150 return original_bucket_on_use(itemstack, user, pointed_thing)
157 xpanes.register_pane("chainlink", {
158 description = "Chain Link",
159 tiles = {"xdecor_chainlink.png"},
160 drawtype = "airlike",
162 textures = {"xdecor_chainlink.png", "xdecor_chainlink.png", "xpanes_space.png"},
163 inventory_image = "xdecor_chainlink.png",
164 wield_image = "xdecor_chainlink.png",
165 groups = {snappy=3, pane=1},
167 {"default:steel_ingot", "", "default:steel_ingot"},
168 {"", "default:steel_ingot", ""},
169 {"default:steel_ingot", "", "default:steel_ingot"}
173 xdecor.register("chair", {
174 description = "Chair",
175 tiles = {"xdecor_wood.png"},
176 sounds = default.node_sound_wood_defaults(),
177 groups = {choppy=3, flammable=3},
180 fixed = {{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125},
181 {0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
182 {-0.1875, 0.025, 0.22, 0.1875, 0.45, 0.28},
183 {-0.3125, -0.5, -0.3125, -0.1875, -0.125, -0.1875},
184 {0.1875, -0.5, -0.3125, 0.3125, -0.125, -0.1875},
185 {-0.3125, -0.125, -0.3125, 0.3125, 0, 0.1875}}
187 on_rightclick = function(pos, node, clicker)
188 local objs = minetest.get_objects_inside_radius(pos, 0.5)
189 for _, p in pairs(objs) do
190 if p:get_player_name() ~= nil or node.param2 > 3 or not
191 clicker or not clicker:is_player() then return end
194 sit(pos, node, clicker)
196 can_dig = function(pos, player)
197 local meta = minetest.get_meta(pos)
198 local pname = player:get_player_name()
199 local objs = minetest.get_objects_inside_radius(pos, 0.5)
201 for _, p in pairs(objs) do
202 if p:get_player_name() ~= nil or
203 default.player_attached[pname] == true or not
204 player:is_player() then
212 xdecor.register("cobweb", {
213 description = "Cobweb",
214 drawtype = "plantlike",
215 tiles = {"xdecor_cobweb.png"},
216 inventory_image = "xdecor_cobweb.png",
217 liquid_viscosity = 8,
218 liquidtype = "source",
219 liquid_alternative_flowing = "xdecor:cobweb",
220 liquid_alternative_source = "xdecor:cobweb",
221 liquid_renewable = false,
224 selection_box = {type = "regular"},
225 groups = {dig_immediate=3, liquid=3, flammable=3},
226 sounds = default.node_sound_leaves_defaults()
229 local colors = {"red"} -- Add more curtains colors simply here.
231 for _, c in pairs(colors) do
232 xdecor.register("curtain_"..c, {
233 description = c:gsub("^%l", string.upper).." Curtain",
235 tiles = {"wool_white.png^[colorize:"..c..":170"},
236 inventory_image = "wool_white.png^[colorize:"..c..":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126",
237 wield_image = "wool_white.png^[colorize:"..c..":170",
238 drawtype = "signlike",
239 paramtype2 = "wallmounted",
240 groups = {dig_immediate=3, flammable=3},
241 selection_box = {type="wallmounted"},
242 on_rightclick = function(pos, node, _, _)
243 minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=node.param2})
247 xdecor.register("curtain_open_"..c, {
248 tiles = {"wool_white.png^[colorize:"..c..":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"},
249 drawtype = "signlike",
250 paramtype2 = "wallmounted",
252 groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
253 selection_box = {type="wallmounted"},
254 drop = "xdecor:curtain_"..c,
255 on_rightclick = function(pos, node, _, _)
256 minetest.set_node(pos, {name="xdecor:curtain_"..c, param2=node.param2})
260 minetest.register_craft({
261 output = "xdecor:curtain_"..c.." 4",
263 {"", "wool:"..c, ""},
269 xdecor.register("cushion", {
270 description = "Cushion",
271 tiles = {"xdecor_cushion.png"},
272 groups = {snappy=3, flammable=3, fall_damage_add_percent=-50},
273 on_place = minetest.rotate_node,
274 node_box = xdecor.nodebox.slab_y(-0.5, 0.5),
275 on_rightclick = function(pos, node, clicker)
276 local objs = minetest.get_objects_inside_radius(pos, 0.5)
277 for _, p in pairs(objs) do
278 if p:get_player_name() ~= nil or node.param2 > 3 or not
279 clicker:is_player() then return end
282 sit(pos, node, clicker)
284 can_dig = function(pos, player)
285 local meta = minetest.get_meta(pos)
286 local pname = player:get_player_name()
287 local objs = minetest.get_objects_inside_radius(pos, 0.5)
289 for _, p in pairs(objs) do
290 if p:get_player_name() ~= nil or
291 default.player_attached[pname] == true or not
292 player or not player:is_player() then
300 local function door_access(door)
301 if door:find("prison") then return true end
306 {"japanese", "brown"}, {"prison", "grey"}, {"prison_rust", "rust"},
307 {"screen", "brownb"}, {"slide", "brownc"}, {"woodglass", "brown"}
310 for _, d in pairs(door_types) do
311 doors.register_door("xdecor:"..d[1].."_door", {
312 description = string.gsub(d[1]:gsub("^%l", string.upper), "_r", " R").." Door",
313 inventory_image = "xdecor_"..d[1].."_door_inv.png",
314 groups = {choppy=3, flammable=2, door=1},
315 tiles_bottom = {"xdecor_"..d[1].."_door_b.png", "xdecor_"..d[2]..".png"},
316 tiles_top = {"xdecor_"..d[1].."_door_a.png", "xdecor_"..d[2]..".png"},
317 only_placer_can_open = door_access(d[1]),
318 sounds = default.node_sound_wood_defaults(),
323 xdecor.register("empty_shelf", {
324 description = "Empty Shelf",
325 inventory = {size=24},
326 infotext = "Empty Shelf",
327 tiles = {"default_wood.png", "default_wood.png^xdecor_empty_shelf.png"},
328 groups = {choppy=3, flammable=3},
329 sounds = default.node_sound_wood_defaults()
332 xdecor.register("enderchest", {
333 description = "Ender Chest",
335 "xdecor_enderchest_top.png", "xdecor_enderchest_top.png",
336 "xdecor_enderchest_side.png", "xdecor_enderchest_side.png",
337 "xdecor_enderchest_side.png", "xdecor_enderchest_front.png"
340 sounds = default.node_sound_stone_defaults(),
341 on_construct = function(pos)
342 local meta = minetest.get_meta(pos)
343 local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
344 meta:set_string("formspec", "size[8,9]"..xbg..
345 "list[current_player;enderchest;0,0;8,4;]"..
346 "list[current_player;main;0,5;8,4;]")
347 meta:set_string("infotext", "Ender Chest")
351 minetest.register_on_joinplayer(function(player)
352 local inv = player:get_inventory()
353 inv:set_size("enderchest", 8*4)
356 xdecor.register("fire", {
357 description = "Fancy Fire",
358 drawtype = "plantlike",
362 { name = "xdecor_fire_anim.png",
363 animation = {type="vertical_frames", length=1.5} }
365 damage_per_second = 2,
368 type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, -0.3, 0.3}
370 groups = {dig_immediate=3, hot=3, not_in_creative_inventory=1}
373 minetest.register_tool("xdecor:flint_steel", {
374 description = "Flint & Steel",
375 inventory_image = "xdecor_flint_steel.png",
376 tool_capabilities = {
377 groupcaps = { igniter = {uses=10, maxlevel=1} }
379 on_use = function(itemstack, user, pointed_thing)
380 local player = user:get_player_name()
381 if pointed_thing.type == "node" and
382 minetest.get_node(pointed_thing.above).name == "air" then
383 if not minetest.is_protected(pointed_thing.above, player) then
384 minetest.set_node(pointed_thing.above, {name="xdecor:fire"})
386 minetest.chat_send_player(player, "This area is protected.")
390 itemstack:add_wear(1000)
395 minetest.register_tool("xdecor:hammer", {
396 description = "Hammer",
397 inventory_image = "xdecor_hammer.png",
398 wield_image = "xdecor_hammer.png",
399 on_use = function(...) do return end end
402 xdecor.register("ivy", {
404 drawtype = "signlike",
407 groups = {dig_immediate=3, flammable=3, plant=1},
408 paramtype2 = "wallmounted",
409 selection_box = {type="wallmounted"},
410 legacy_wallmounted = true,
411 tiles = {"xdecor_ivy.png"},
412 inventory_image = "xdecor_ivy.png",
413 wield_image = "xdecor_ivy.png",
414 sounds = default.node_sound_leaves_defaults()
417 xdecor.register("lantern", {
418 description = "Lantern",
420 drawtype = "torchlike",
421 inventory_image = "xdecor_lantern_floor.png",
422 wield_image = "xdecor_lantern_floor.png",
423 paramtype2 = "wallmounted",
424 legacy_wallmounted = true,
426 groups = {dig_immediate=3, attached_node=1},
427 tiles = {"xdecor_lantern_floor.png", "xdecor_lantern_ceiling.png",
428 "xdecor_lantern.png"},
430 type = "wallmounted",
431 wall_top = {-0.25, -0.4, -0.25, 0.25, 0.5, 0.25},
432 wall_bottom = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25},
433 wall_side = {-0.5, -0.5, -0.15, 0.5, 0.5, 0.15}
437 xdecor.register("lightbox", {
438 description = "Light Box",
439 tiles = {"xdecor_lightbox.png"},
442 sounds = default.node_sound_glass_defaults()
445 xdecor.register("packed_ice", {
447 description = "Packed Ice",
448 tiles = {"xdecor_packed_ice.png"},
450 sounds = default.node_sound_glass_defaults()
453 local flowers = {"dandelion_white", "dandelion_yellow", "geranium",
454 "rose", "tulip", "viola"}
456 for _, f in pairs(flowers) do
457 xdecor.register("potted_"..f, {
458 description = string.gsub("Potted Flowers ("..f..")", "_", " "),
460 groups = {dig_immediate=3, flammable=3, plant=1, flower=1},
461 tiles = {"xdecor_"..f.."_pot.png"},
462 inventory_image = "xdecor_"..f.."_pot.png",
463 drawtype = "plantlike",
464 sounds = default.node_sound_leaves_defaults(),
465 selection_box = xdecor.nodebox.slab_y(0.3)
468 minetest.register_craft({
469 output = "xdecor:potted_"..f,
471 {"default:clay_brick", "flowers:"..f, "default:clay_brick"},
472 {"", "default:clay_brick", ""}
477 xdecor.register("painting", {
478 description = "Painting",
479 drawtype = "signlike",
480 tiles = {"xdecor_painting.png"},
481 inventory_image = "xdecor_painting.png",
482 paramtype2 = "wallmounted",
483 legacy_wallmounted = true,
485 wield_image = "xdecor_painting.png",
486 selection_box = {type="wallmounted"},
487 groups = {dig_immediate=3, flammable=3, attached_node=1}
490 for _, b in pairs({{"cactus", "cactus"}, {"moon", "stone"}}) do
491 xdecor.register(b[1].."brick", {
493 description = b[1]:gsub("^%l", string.upper).." Brick",
494 tiles = {"xdecor_"..b[1].."brick.png"},
496 sounds = default.node_sound_stone_defaults(),
499 minetest.register_craft({
500 output = "xdecor:"..b[1].."brick",
502 {"default:brick", "default:"..b[2]}
507 xdecor.register("multishelf", {
508 description = "Multi Shelf",
509 inventory = {size=24},
510 infotext = "Multi Shelf",
511 tiles = {"default_wood.png", "default_wood.png^xdecor_multishelf.png"},
512 groups = {choppy=3, flammable=3},
513 sounds = default.node_sound_wood_defaults()
516 xpanes.register_pane("rust_bar", {
517 description = "Rust Bars",
518 tiles = {"xdecor_rust_bars.png"},
519 drawtype = "airlike",
521 textures = {"xdecor_rust_bars.png", "xdecor_rust_bars.png", "xpanes_space.png"},
522 inventory_image = "xdecor_rust_bars.png",
523 wield_image = "xdecor_rust_bars.png",
524 groups = {snappy=3, pane=1},
526 {"", "default:dirt", ""},
527 {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
528 {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
532 xdecor.register("stonepath", {
533 description = "Garden Stone Path",
534 tiles = {"default_stone.png"},
536 sounds = default.node_sound_stone_defaults(),
537 sunlight_propagates = true,
540 fixed = {{0, -0.5, 0, 0.375, -0.47, 0.375},
541 {-0.4375, -0.5, -0.4375, -0.0625, -0.47, -0.0625},
542 {-0.4375, -0.5, 0.125, -0.125, -0.47, 0.4375},
543 {0.125, -0.5, -0.375, 0.375, -0.47, -0.125}}
545 selection_box = xdecor.nodebox.slab_y(0.05)
548 local stonish = {"desertstone_tile", "stone_tile", "stone_rune",
549 "coalstone_tile", "hard_clay"}
551 for _, t in pairs(stonish) do
554 description = string.sub(t:gsub("^%l", string.upper), 1, -6)
555 .." "..t:sub(-4):gsub("^%l", string.upper),
556 tiles = {"xdecor_"..t..".png"},
558 sounds = default.node_sound_stone_defaults()
562 xdecor.register("table", {
563 description = "Table",
564 tiles = {"xdecor_wood.png"},
565 groups = {choppy=3, flammable=3},
566 sounds = default.node_sound_wood_defaults(),
569 fixed = {{-0.5, 0.4, -0.5, 0.5, 0.5, 0.5},
570 {-0.15, -0.5, -0.15, 0.15, 0.4, 0.15}}
574 xdecor.register("tatami", {
575 description = "Tatami",
576 tiles = {"xdecor_tatami.png"},
577 wield_image = "xdecor_tatami.png",
578 groups = {snappy=3, flammable=3},
580 type = "fixed", fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
584 xdecor.register("tv", {
585 description = "Television",
589 "xdecor_television_left.png^[transformR270",
590 "xdecor_television_left.png^[transformR90",
591 "xdecor_television_left.png^[transformFX",
592 "xdecor_television_left.png", "xdecor_television_back.png",
593 { name = "xdecor_television_front_animated.png",
594 animation = {type="vertical_frames", length=80.0} }
598 xpanes.register_pane("wood_frame", {
599 description = "Wood Frame",
600 tiles = {"xdecor_wood_frame.png"},
601 drawtype = "airlike",
603 textures = {"xdecor_wood_frame.png", "xdecor_wood_frame.png", "xpanes_space.png"},
604 inventory_image = "xdecor_wood_frame.png",
605 wield_image = "xdecor_wood_frame.png",
606 groups = {choppy=3, pane=1, flammable=3},
607 sounds = default.node_sound_wood_defaults(),
609 {"group:wood", "group:stick", "group:wood"},
610 {"group:stick", "group:stick", "group:stick"},
611 {"group:wood", "group:stick", "group:wood"}
615 xdecor.register("woodframed_glass", {
616 description = "Wood Framed Glass",
617 drawtype = "glasslike_framed",
618 tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"},
620 sounds = default.node_sound_glass_defaults()
623 xdecor.register("wood_tile", {
624 description = "Wood Tile",
625 tiles = {"xdecor_wood_tile.png"},
627 groups = {choppy=2, wood=1, flammable=2},
628 sounds = default.node_sound_wood_defaults()