2014-07-22 23:15:43 +02:00
|
|
|
|
2019-10-18 10:09:29 +02:00
|
|
|
if not minetest.features.object_use_texture_alpha then
|
2017-10-03 08:35:20 +02:00
|
|
|
error("[boost_cart] Your Minetest version is no longer supported."
|
2019-10-18 10:09:29 +02:00
|
|
|
.. " (Version < 5.0.0)")
|
2017-06-09 22:25:58 +02:00
|
|
|
end
|
|
|
|
|
2019-10-18 10:09:29 +02:00
|
|
|
boost_cart = {}
|
|
|
|
boost_cart.modpath = minetest.get_modpath("boost_cart")
|
|
|
|
boost_cart.MESECONS = minetest.global_exists("mesecon")
|
|
|
|
boost_cart.MTG_CARTS = minetest.global_exists("carts") and carts.pathfinder
|
|
|
|
boost_cart.PLAYER_API = minetest.global_exists("player_api")
|
|
|
|
boost_cart.player_attached = {}
|
|
|
|
|
2017-10-09 10:58:11 +02:00
|
|
|
local function getNum(setting)
|
|
|
|
return tonumber(minetest.settings:get(setting))
|
|
|
|
end
|
|
|
|
|
2016-04-15 09:45:26 +02:00
|
|
|
-- Maximal speed of the cart in m/s
|
2017-10-09 10:58:11 +02:00
|
|
|
boost_cart.speed_max = getNum("boost_cart.speed_max") or 10
|
2016-10-12 17:22:49 +02:00
|
|
|
-- Set to -1 to disable punching the cart from inside
|
2017-10-09 10:58:11 +02:00
|
|
|
boost_cart.punch_speed_max = getNum("boost_cart.punch_speed_max") or 7
|
|
|
|
-- Maximal distance for the path correction (for dtime peaks)
|
|
|
|
boost_cart.path_distance_max = 3
|
|
|
|
|
2016-04-15 09:45:26 +02:00
|
|
|
|
2019-10-18 10:09:29 +02:00
|
|
|
if boost_cart.PLAYER_API then
|
|
|
|
-- This is a table reference!
|
|
|
|
boost_cart.player_attached = player_api.player_attached
|
2015-06-05 20:30:48 +02:00
|
|
|
end
|
|
|
|
|
2016-11-22 20:32:17 +01:00
|
|
|
dofile(boost_cart.modpath.."/functions.lua")
|
|
|
|
dofile(boost_cart.modpath.."/rails.lua")
|
2016-04-15 09:45:26 +02:00
|
|
|
|
2019-10-18 10:09:29 +02:00
|
|
|
if boost_cart.MESECONS then
|
2016-11-22 20:32:17 +01:00
|
|
|
dofile(boost_cart.modpath.."/detector.lua")
|
|
|
|
--else
|
|
|
|
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
|
|
|
|
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
|
2014-07-22 23:15:43 +02:00
|
|
|
end
|
|
|
|
|
2019-10-18 10:09:29 +02:00
|
|
|
if boost_cart.MTG_CARTS then
|
2016-11-22 20:32:17 +01:00
|
|
|
minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
|
2014-07-22 23:15:43 +02:00
|
|
|
end
|
2016-11-22 20:32:17 +01:00
|
|
|
dofile(boost_cart.modpath.."/cart_entity.lua")
|