Explode bed when used in End or Nether

This commit is contained in:
Wuzzy 2017-08-17 20:22:30 +02:00
parent 3fefbf5fc4
commit c97a14e969
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,5 @@
mcl_sounds?
mcl_util?
mcl_wool?
mcl_dye?
mcl_tnt?

View file

@ -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