diff --git a/mods/bg_player/init.lua b/mods/bg_player/init.lua index 1af3873..de66f03 100644 --- a/mods/bg_player/init.lua +++ b/mods/bg_player/init.lua @@ -1,2 +1,3 @@ load_file("hand") load_file("run") +load_file("step_height") diff --git a/mods/bg_player/step_height.lua b/mods/bg_player/step_height.lua new file mode 100644 index 0000000..54f643f --- /dev/null +++ b/mods/bg_player/step_height.lua @@ -0,0 +1,8 @@ +minetest.register_globalstep(function(delta_time) + for _, player in pairs(minetest.get_connected_players()) do + local control = player:get_player_control() + local properties = player:get_properties() + properties.stepheight = control.sneak and 0.01 or 1.05 + player:set_properties(properties) + end +end)