mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Beds: First check distance
This commit is contained in:
parent
84c099b234
commit
c9dc405531
1 changed files with 6 additions and 6 deletions
|
@ -65,6 +65,12 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
end
|
end
|
||||||
|
|
||||||
if bed_pos then
|
if bed_pos then
|
||||||
|
-- No sleeping if too far away
|
||||||
|
if vector.distance(bed_pos, pos) > 2 then
|
||||||
|
minetest.chat_send_player(name, "You can't sleep, the bed's too far away!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- No sleeping if monsters nearby.
|
-- No sleeping if monsters nearby.
|
||||||
-- The exceptions above apply.
|
-- The exceptions above apply.
|
||||||
-- Zombie pigmen only prevent sleep while they are hostle.
|
-- Zombie pigmen only prevent sleep while they are hostle.
|
||||||
|
@ -83,12 +89,6 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- No sleeping if too far away
|
|
||||||
if vector.distance(bed_pos, pos) > 2 then
|
|
||||||
minetest.chat_send_player(name, "You can't sleep, the bed's too far away!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- stand up
|
-- stand up
|
||||||
|
|
Loading…
Reference in a new issue