init.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --[[
  2. Sprint mod for Minetest by GunshipPenguin
  3. To the extent possible under law, the author(s)
  4. have dedicated all copyright and related and neighboring rights
  5. to this software to the public domain worldwide. This software is
  6. distributed without any warranty.
  7. ]]
  8. --Configuration variables, these are all explained in README.md
  9. SPRINT_METHOD = 1
  10. SPRINT_SPEED = 2.0
  11. SPRINT_JUMP = 1.1
  12. SPRINT_STAMINA = 20
  13. SPRINT_TIMEOUT = 0.5 --Only used if SPRINT_METHOD = 0
  14. if minetest.get_modpath("hudbars") ~= nil then
  15. hb.register_hudbar("sprint", 0xFFFFFF, "Stamina",
  16. { bar = "sprint_stamina_bar.png", icon = "sprint_stamina_icon.png" },
  17. SPRINT_STAMINA, SPRINT_STAMINA,
  18. false, "%s: %.1f/%.1f")
  19. SPRINT_HUDBARS_USED = true
  20. else
  21. SPRINT_HUDBARS_USED = false
  22. end
  23. if SPRINT_METHOD == 0 then
  24. dofile(minetest.get_modpath("sprint") .. "/wsprint.lua")
  25. elseif SPRINT_METHOD == 1 then
  26. dofile(minetest.get_modpath("sprint") .. "/esprint.lua")
  27. else
  28. minetest.log("error", "Sprint Mod - SPRINT_METHOD is not set properly, using e to sprint")
  29. dofile(minetest.get_modpath("sprint") .. "/esprint.lua")
  30. end