Prevent bed errors in /sleep.

This commit is contained in:
Duane 2016-07-18 17:46:07 -05:00
parent ae0886a397
commit b2c104d53a
2 changed files with 15 additions and 13 deletions

View file

@ -258,8 +258,9 @@ minetest.register_chatcommand("sleep", {
end end
pos = vector.round(pos) pos = vector.round(pos)
beds.on_rightclick(pos, player) local status, err = pcall(beds.on_rightclick, pos, player)
if status then
minetest.after(5, function() minetest.after(5, function()
local time = minetest.get_timeofday() local time = minetest.get_timeofday()
if not time or time < 0.23 or time > 0.3 then if not time or time < 0.23 or time > 0.3 then
@ -273,5 +274,6 @@ minetest.register_chatcommand("sleep", {
minetest.chat_send_player(player_name, 'You\'d sleep better in a bed.') minetest.chat_send_player(player_name, 'You\'d sleep better in a bed.')
end) end)
end
end, end,
}) })

View file

@ -2,7 +2,7 @@
-- GOBLINS -- GOBLINS
--------------------------------------------------------------- ---------------------------------------------------------------
local spawn_frequency = 500 -- 500 local spawn_frequency = 350 -- 350
local dig_freq = 5 -- 5 local dig_freq = 5 -- 5
local trap_freq = 25 -- 25 local trap_freq = 25 -- 25
local torch_freq = 2 -- 2 local torch_freq = 2 -- 2