diff --git a/init.lua b/init.lua index 57b97b7..96eedd8 100644 --- a/init.lua +++ b/init.lua @@ -25,7 +25,7 @@ local function actionbar_show_status(player) elseif minetest.get_modpath("mcl_tmp_message") then mcl_tmp_message.message(player, S("Move to stand up")) else - minetest.log("warning", "Didn't found any mod to set titles in actionbar (mcl_title or mcl_tmp_message)!") + minetest.log("warning", "[mcl_cozy] Didn't found any mod to set titles in actionbar (mcl_title or mcl_tmp_message)!") end end @@ -38,7 +38,8 @@ minetest.register_globalstep(function(dtime) players[i]:get_player_control().down == true or players[i]:get_player_control().left == true or players[i]:get_player_control().right == true or - players[i]:get_player_control().jump == true) then + players[i]:get_player_control().jump == true or + players[i]:get_player_control().sneak == true) then players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) players[i]:set_physics_override(1, 1, 1) mcl_player.player_attached[name] = false @@ -51,6 +52,8 @@ minetest.register_chatcommand("sit", { description = S("Sit down"), func = function(name) local player = minetest.get_player_by_name(name) + -- check the node below player (and if it's air, just don't sit) + if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end if mcl_player.player_attached[name] then player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) player:set_physics_override(1, 1, 1) @@ -72,6 +75,7 @@ minetest.register_chatcommand("lay", { description = S("Lay down"), func = function(name) local player = minetest.get_player_by_name(name) + if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end if mcl_player.player_attached[name] then player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) player:set_physics_override(1, 1, 1) diff --git a/mod.conf b/mod.conf index 9d01f07..ed26eb8 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,5 @@ name = mcl_cozy +title = MineClone2 Get Comfortable description = Sit and lay using chat commands -depends = mcl_player +depends = mcl_player, mcl_playerinfo optional_depends = mcl_title, mcl_tmp_message