Carts for Minetest, but optimized! Also compatible with MTG carts https://content.minetest.net/packages/Krock/boost_cart/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4KB

  1. if not minetest.features.object_use_texture_alpha then
  2. error("[boost_cart] Your Minetest version is no longer supported."
  3. .. " (Version < 5.0.0)")
  4. end
  5. boost_cart = {}
  6. boost_cart.modpath = minetest.get_modpath("boost_cart")
  7. boost_cart.MESECONS = minetest.global_exists("mesecon")
  8. boost_cart.MTG_CARTS = minetest.global_exists("carts") and carts.pathfinder
  9. boost_cart.PLAYER_API = minetest.global_exists("player_api")
  10. boost_cart.player_attached = {}
  11. local function getNum(setting)
  12. return tonumber(minetest.settings:get(setting))
  13. end
  14. -- Maximal speed of the cart in m/s
  15. boost_cart.speed_max = getNum("boost_cart.speed_max") or 10
  16. -- Set to -1 to disable punching the cart from inside
  17. boost_cart.punch_speed_max = getNum("boost_cart.punch_speed_max") or 7
  18. -- Maximal distance for the path correction (for dtime peaks)
  19. boost_cart.path_distance_max = 3
  20. if boost_cart.PLAYER_API then
  21. -- This is a table reference!
  22. boost_cart.player_attached = player_api.player_attached
  23. end
  24. dofile(boost_cart.modpath.."/functions.lua")
  25. dofile(boost_cart.modpath.."/rails.lua")
  26. if boost_cart.MESECONS then
  27. dofile(boost_cart.modpath.."/detector.lua")
  28. --else
  29. -- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
  30. -- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
  31. end
  32. if boost_cart.MTG_CARTS then
  33. minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
  34. end
  35. dofile(boost_cart.modpath.."/cart_entity.lua")