Fix syntax error from rebase, fix cart tilt, change cart speed to 4 blocks/second and make into a setting, make minecart settings compatibily with upcoming dynamic rules PR (#4662)

This commit is contained in:
teknomunk 2024-11-10 07:11:12 -06:00
parent dd04e0c961
commit bb7357ef49
4 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,8 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local FURNACE_CART_SPEED = {tonumber(minetest.settings:get("mcl_minecarts_furnace_speed") or 4)}
-- Minecart with Furnace
mcl_minecarts.register_minecart({
itemstring = "mcl_minecarts:furnace_minecart",
@ -73,8 +75,10 @@ mcl_minecarts.register_minecart({
-- Update furnace stuff
if (staticdata.fueltime or 0) > 0 then
if staticdata.velocity < 0.25 then
staticdata.velocity = 0.25
for car in mcl_minecarts.train_cars(staticdata) do
if car.velocity < FURNACE_CART_SPEED[1] - 0.1 then -- Slightly less to allow train cars to maintain spacing
car.velocity = FURNACE_CART_SPEED[1]
end
end
staticdata.fueltime = (staticdata.fueltime or dtime) - dtime

View File

@ -3,9 +3,9 @@ local modpath = minetest.get_modpath(modname)
local mod = mcl_minecarts
local S = minetest.get_translator(modname)
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_minecarts", false)
local LOGGING_ON = {minetest.settings:get_bool("mcl_logging_minecarts", false)}
local function mcl_log(message)
if LOGGING_ON then
if LOGGING_ON[1] then
mcl_util.mcl_log(message, "[Minecarts]", true)
end
end

View File

@ -441,7 +441,7 @@ end
local _2_pi = math.pi * 2
local _half_pi = math.pi * 0.5
local _quart_pi = math.pi * 0.5
local _quart_pi = math.pi * 0.25
local pi = math.pi
local rot_debug = {}
function mod.update_cart_orientation(self)
@ -469,9 +469,9 @@ function mod.update_cart_orientation(self)
end
-- Forward/backwards tilt (pitch)
if dir.y < 0 then
if dir.y > 0 then
rot.x = -_quart_pi
elseif dir.y > 0 then
elseif dir.y < 0 then
rot.x = _quart_pi
else
rot.x = 0

View File

@ -61,6 +61,7 @@ tsm_railcorridors.carts = {
"mcl_minecarts:minecart", "mcl_minecarts:minecart",
"mcl_minecarts:chest_minecart", "mcl_minecarts:chest_minecart",
"mcl_minecarts:tnt_minecart"
}
local has_loot = {
["mcl_minecarts:chest_minecart"] = true,
["mcl_minecarts:hopper_minceart"] = true,