From c97a14e96900d4d1fba5fec1a50a20ac6e7d367a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 17 Aug 2017 20:22:30 +0200 Subject: [PATCH] Explode bed when used in End or Nether --- mods/ITEMS/mcl_beds/depends.txt | 2 ++ mods/ITEMS/mcl_beds/functions.lua | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/mods/ITEMS/mcl_beds/depends.txt b/mods/ITEMS/mcl_beds/depends.txt index 53f5b7c50..93b5fc03e 100644 --- a/mods/ITEMS/mcl_beds/depends.txt +++ b/mods/ITEMS/mcl_beds/depends.txt @@ -1,3 +1,5 @@ mcl_sounds? +mcl_util? mcl_wool? mcl_dye? +mcl_tnt? diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index cbb2c3c09..5f8e4daf0 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -136,6 +136,17 @@ function mcl_beds.skip_night() end function mcl_beds.on_rightclick(pos, player) + if minetest.get_modpath("mcl_init") then + local _, dim = mcl_util.y_to_layer(pos.y) + if dim == "nether" or dim == "end" then + -- Bed goes BOOM in the Nether or End. + minetest.remove_node(pos) + if minetest.get_modpath("mcl_tnt") then + tnt.boom(pos, {radius = 4, damage_radius = 4}) + end + return + end + end local name = player:get_player_name() local ppos = player:getpos() local tod = minetest.get_timeofday() * 24000