forked from VoxeLibre/VoxeLibre
parent
6262bda3f2
commit
f4ac6335eb
|
@ -79,6 +79,13 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
awards.unlock(player:get_player_name(), "mcl:sweetDreams")
|
||||
end
|
||||
|
||||
-- Check day of time and weather
|
||||
local tod = minetest.get_timeofday() * 24000
|
||||
-- Values taken from Minecraft Wiki with offset of +6000
|
||||
if tod < 18541 and tod > 5458 and (not weather_mod or (mcl_weather.get_weather() ~= "thunder")) then
|
||||
return false, S("You can only sleep at night or during a thunderstorm.")
|
||||
end
|
||||
|
||||
-- No sleeping if too far away
|
||||
if vector.distance(bed_pos, pos) > 2 and vector.distance(bed_pos2, pos) > 2 then
|
||||
return false, S("You can't sleep, the bed's too far away!")
|
||||
|
@ -158,13 +165,6 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
return false, S("It's too dangerous to sleep here!")
|
||||
end
|
||||
|
||||
-- Check day of time and weather
|
||||
local tod = minetest.get_timeofday() * 24000
|
||||
-- Values taken from Minecraft Wiki with offset of +6000
|
||||
if tod < 18541 and tod > 5458 and (not weather_mod or (mcl_weather.get_weather() ~= "thunder")) then
|
||||
return false, S("You can only sleep at night or during a thunderstorm.")
|
||||
end
|
||||
|
||||
mcl_beds.player[name] = 1
|
||||
mcl_beds.pos[name] = pos
|
||||
mcl_beds.bed_pos[name] = bed_pos2
|
||||
|
|
Loading…
Reference in New Issue