Prevent bed errors in /sleep.
This commit is contained in:
parent
ae0886a397
commit
b2c104d53a
2 changed files with 15 additions and 13 deletions
26
chat.lua
26
chat.lua
|
@ -258,20 +258,22 @@ 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)
|
||||||
|
|
||||||
minetest.after(5, function()
|
if status then
|
||||||
local time = minetest.get_timeofday()
|
minetest.after(5, function()
|
||||||
if not time or time < 0.23 or time > 0.3 then
|
local time = minetest.get_timeofday()
|
||||||
return
|
if not time or time < 0.23 or time > 0.3 then
|
||||||
end
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local hp = player:get_hp()
|
local hp = player:get_hp()
|
||||||
if hp and type(hp) == 'number' then
|
if hp and type(hp) == 'number' then
|
||||||
player:set_hp(hp - 1)
|
player:set_hp(hp - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
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,
|
||||||
})
|
})
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue