Prevent player from walking while sleeping
This commit is contained in:
parent
3121ab7c2d
commit
fd73c81d23
4 changed files with 10 additions and 6 deletions
|
@ -139,9 +139,10 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end
|
||||
|
||||
-- set player physics
|
||||
-- TODO: Resolve conflict
|
||||
player:set_physics_override(def.speed, def.jump, def.gravity)
|
||||
-- Set player physics if there's no conflict
|
||||
if player:get_attribute("mcl_beds:sleeping") ~= "true" then
|
||||
player:set_physics_override(def.speed, def.jump, def.gravity)
|
||||
end
|
||||
|
||||
-- Is player suffocating inside node? (Only for solid full opaque cube type nodes
|
||||
-- without group disable_suffocation=1)
|
||||
|
|
|
@ -100,8 +100,8 @@ function setSprinting(playerName, sprinting) --Sets the state of a player (0=sto
|
|||
local player = minetest.get_player_by_name(playerName)
|
||||
if players[playerName] then
|
||||
players[playerName]["sprinting"] = sprinting
|
||||
-- Don't overwrite physics when standing on soul sand
|
||||
if mcl_playerplus[playerName].node_stand ~= "mcl_nether:soul_sand" then
|
||||
-- Don't overwrite physics when standing on soul sand or sleeping
|
||||
if mcl_playerplus[playerName].node_stand ~= "mcl_nether:soul_sand" and player:get_attribute("mcl_beds:sleeping") ~= "true" then
|
||||
if sprinting == true then
|
||||
player:set_physics_override({speed=mcl_sprint.SPEED})
|
||||
elseif sprinting == false then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue