diff --git a/mods/game/init.lua b/mods/game/init.lua index 814fca5..bb1031d 100644 --- a/mods/game/init.lua +++ b/mods/game/init.lua @@ -10,6 +10,7 @@ dofile(minetest.get_modpath("game").."/items.lua") dofile(minetest.get_modpath("game").."/awards.lua") dofile(minetest.get_modpath("game").."/armor.lua") dofile(minetest.get_modpath("game").."/friends.lua") +dofile(minetest.get_modpath("game").."/sprint.lua") minetest.register_item(":", { type = "none", @@ -173,7 +174,7 @@ minetest.register_on_respawnplayer(function(player) local meta = player:get_meta() if meta:get_string("location") == "dungeon" then - if #game.parties[game.party[name]] <= 1 then + if game.get_table_size(game.parties[game.party[name]]) <= 1 then game.clear_mobs_near(player:get_pos(), 150) end diff --git a/mods/game/sprint.lua b/mods/game/sprint.lua new file mode 100644 index 0000000..40cc8cd --- /dev/null +++ b/mods/game/sprint.lua @@ -0,0 +1,20 @@ +local sprint_step = 0 +minetest.register_globalstep(function(dtime) + sprint_step = sprint_step + dtime + + if sprint_step >= 0.5 then + sprint_step = 0 + + for _, p in ipairs(minetest.get_connected_players()) do + local meta = p:get_meta() + + if meta:get_string("location") == "spawn" and p:get_player_control().aux1 == true then + p:set_physics_override({speed = 2}) + else + if p:get_physics_override().speed ~= 1 then + p:set_physics_override({speed = 1}) + end + end + end + end +end) \ No newline at end of file