From 53ea4cf04c5548ea2e168e3bf08c463e6062de0b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 1 Jan 2025 07:49:17 -0600 Subject: [PATCH] Implement gamerule:minecartMaxSpeed --- mods/ENTITIES/mcl_minecarts/init.lua | 12 ++++++++++-- mods/ENTITIES/mcl_minecarts/locale/template.txt | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 55960e296..16b91181f 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -1,5 +1,6 @@ -local modname = minetest.get_current_modname() -local modpath = minetest.get_modpath(modname) +local modname = core.get_current_modname() +local modpath = core.get_modpath(modname) +local S = core.get_translator(modname) mcl_minecarts = {} local mod = mcl_minecarts mcl_minecarts.modpath = modpath @@ -12,6 +13,13 @@ mod.MAX_TRAIN_LENGTH = 4 mod.CART_BLOCK_SIZE = 64 mod.PASSENGER_ATTACH_POSITION = vector.new(0, -1.75, 0) +vl_tuning.setting("gamerule:minecartMaxSpeed", "number", { + set = function(value) mod.SPEED_MAX = value end, + get = function() return mod.SPEED_MAX end, + default = 10, + description = S("The maximum speed a minecart may reach.") +}) + for _,filename in pairs({"storage","functions","rails","train","carts"}) do dofile(modpath.."/"..filename..".lua") end diff --git a/mods/ENTITIES/mcl_minecarts/locale/template.txt b/mods/ENTITIES/mcl_minecarts/locale/template.txt index a5cf42d61..0fb55490b 100644 --- a/mods/ENTITIES/mcl_minecarts/locale/template.txt +++ b/mods/ENTITIES/mcl_minecarts/locale/template.txt @@ -1,5 +1,6 @@ # textdomain: mcl_minecarts ##[ carts/minecart.lua ]## +The maximum speed a minecart may reach.= Sneak to dismount= Minecart= Vehicle for fast travel on rails=