Make the maximal speed configurable using minetest.conf

This commit is contained in:
SmallJoker 2017-06-09 22:25:58 +02:00
parent 08918701b0
commit b80d3aed4c
3 changed files with 19 additions and 3 deletions

View File

@ -7,7 +7,8 @@ Target: Run smoothly as possible even on laggy server
Features Features
---------- ----------
- A fast cart for your railway or roller coaster (up to 10 m/s!) - A fast cart for your railway or roller coaster
- Easily configurable cart speed using the Advanced Settings
- Boost and brake rails - Boost and brake rails
- By mesecons controlled Start-Stop rails - By mesecons controlled Start-Stop rails
- Detector rails that send a mesecons signal when the cart drives over them - Detector rails that send a mesecons signal when the cart drives over them

View File

@ -2,10 +2,19 @@
boost_cart = {} boost_cart = {}
boost_cart.modpath = minetest.get_modpath("boost_cart") boost_cart.modpath = minetest.get_modpath("boost_cart")
-- Settings glue for <= 0.4.15
local setting_getter = minetest.setting_get
if minetest.settings then
setting_getter = function (key)
return minetest.settings:get(key)
end
end
-- Maximal speed of the cart in m/s -- Maximal speed of the cart in m/s
boost_cart.speed_max = 10 boost_cart.speed_max = tonumber(setting_getter("boost_cart.speed_max")) or 10
-- Set to -1 to disable punching the cart from inside -- Set to -1 to disable punching the cart from inside
boost_cart.punch_speed_max = 7 boost_cart.punch_speed_max = tonumber(setting_getter("boost_cart.punch_speed_max")) or 7
if not boost_cart.modpath then if not boost_cart.modpath then

6
settingtypes.txt Normal file
View File

@ -0,0 +1,6 @@
# Maximal speed of the cart in m/s (min=1, max=100)
boost_cart.speed_max (Maximal speed) int 10 1 100
# Maximal speed to which the driving player can accelerate the cart by punching
# from inside the cart. -1 will disable this feature. (min=-1, max=100)
boost_cart.punch_speed_max (Maximal punch speed) int 7 -1 100