Prevent going to bed while moving

This commit is contained in:
Wuzzy 2019-08-29 18:15:38 +02:00
parent 2339c52ead
commit 0aae257932
3 changed files with 9 additions and 1 deletions

View File

@ -350,7 +350,7 @@ minetest.register_node(
local put_pos = vector.add(pos, vector.divide(
minetest.facedir_to_dir(node.param2), 2))
if clicker:get_player_name() == meta:get_string("player") then
if name == meta:get_string("player") then
put_pos.y = put_pos.y - 0.5
bed.userdata[name].in_bed = false
@ -364,6 +364,12 @@ minetest.register_node(
return
end
-- No sleeping while moving
if vector.length(clicker:get_player_velocity()) > 0.001 then
minetest.chat_send_player(name, S("You have to stop moving before going to bed!"))
return false
end
put_pos.y = put_pos.y + 0.6
local yaw = 0

View File

@ -5,3 +5,4 @@ Craft a bed=Fertigen Sie ein Bett
Players have slept, rise and shine!=Spieler haben geschlafen, Raus aus den Federn!
In bed=Im Bett
You're in a bed=Sie sind in einem Bett
You have to stop moving before going to bed!=Sie müssen stehen bleiben, bevor Sie zu Bett gehen!

View File

@ -5,3 +5,4 @@ Craft a bed=
Players have slept, rise and shine!=
In bed=
You're in a bed=
You have to stop moving before going to bed!=