Prevent player from walking while sleeping

This commit is contained in:
Wuzzy 2017-06-11 14:44:37 +02:00
parent 3121ab7c2d
commit fd73c81d23
4 changed files with 10 additions and 6 deletions

View file

@ -73,6 +73,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
player:set_look_horizontal(math.random(1, 180) / 100)
mcl_player.player_attached[name] = false
player:set_physics_override(1, 1, 1)
player:set_attribute("mcl_beds:sleeping", "false")
hud_flags.wielditem = true
mcl_player.player_set_animation(player, "stand" , 30)
@ -88,6 +89,8 @@ local function lay_down(player, pos, bed_pos, state, skip)
player:set_look_horizontal(yaw)
local dir = minetest.facedir_to_dir(param2)
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
-- Set player attribute so other mods know they should not touch set_physics_override
player:set_attribute("mcl_beds:sleeping", "true")
player:set_physics_override(0, 0, 0)
player:setpos(p)
mcl_player.player_attached[name] = true