diff --git a/init.lua b/init.lua index 06ee16c..cce841d 100755 --- a/init.lua +++ b/init.lua @@ -66,6 +66,7 @@ dofile(MP.."/register_nodes.lua") dofile(MP.."/shop.lua") dofile(MP .. "/extender.lua") dofile(MP .. "/tools.lua") +dofile(MP .. "/sprint.lua") ---------------------- -- Helper Functions -- diff --git a/sprint.lua b/sprint.lua new file mode 100644 index 0000000..0798fee --- /dev/null +++ b/sprint.lua @@ -0,0 +1,16 @@ +local players = {} + +minetest.register_globalstep(function(dtime) + for _,player in ipairs(minetest.get_connected_players()) do + local name = player:get_player_name() + players[name] = true + local control = player:get_player_control() + local sprint = control.aux1 and control.up + if sprint and players[name] then + player:set_physics_override({speed = 1.2}) + else + player:set_physics_override({speed = 1}) + players[name] = nil + end + end +end)