diff --git a/api.lua b/api.lua index e57e8b2..cb5c2f4 100644 --- a/api.lua +++ b/api.lua @@ -11,7 +11,6 @@ mcl_decor.sit = function(pos, _, player) if not mcl_player.player_attached[name] then -- check movement if vector.length(player:get_velocity() or player:get_player_velocity()) > 0.125 then - --minetest.chat_send_player(name, S("You have to stop moving before sitting down!")) mcl_title.set(player, "actionbar", {text=S("You have to stop moving before sitting down!"), color="white", stay=60}) return end @@ -29,11 +28,14 @@ mcl_decor.sit = function(pos, _, player) end end mcl_decor.up = function(_, _, player) - local name = player:get_player_name() - if mcl_player.player_attached[name] then - mcl_decor.stand(player, name) - end + local name = player:get_player_name() + if not player or not name then + return false end + if mcl_player.player_attached[name] then + mcl_decor.stand(player, name) + end +end mcl_decor.stand = function(player, name) player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) player:set_physics_override(1, 1, 1)