Fix detector rail strangeness, prevent crash

This commit is contained in:
teknomunk 2024-11-09 12:33:39 -06:00 committed by the-real-herowl
parent 524fe37f4a
commit fcbb4f6e34
2 changed files with 5 additions and 13 deletions

View file

@ -276,7 +276,7 @@ local function calculate_acceleration(staticdata)
if (ctrl.forward or 0) > time_active then
if staticdata.velocity == 0 then
local look_dir = look_directions[ctrl.look or 0]
local look_dir = look_directions[ctrl.look or 0] or mod.north
local dot = vector.dot(staticdata.dir, look_dir)
if dot < 0 then
reverse_direction(staticdata)

View file

@ -19,12 +19,8 @@ mod.register_straight_rail("mcl_minecarts:detector_rail_v2",{"mcl_minecarts_rail
},
_mcl_minecarts_on_enter = function(pos, cart)
local node = minetest.get_node(pos)
local newnode = {
name = "mcl_minecarts:detector_rail_v2_on",
param2 = node.param2
}
minetest.swap_node( pos, newnode )
node.name = "mcl_minecarts:detector_rail_v2_on"
minetest.set_node( pos, node )
mesecon.receptor_on(pos)
end,
craft = {
@ -51,12 +47,8 @@ mod.register_straight_rail("mcl_minecarts:detector_rail_v2_on",{"mcl_minecarts_r
},
_mcl_minecarts_on_leave = function(pos, cart)
local node = minetest.get_node(pos)
local newnode = {
name = "mcl_minecarts:detector_rail",
param2 = node.param2
}
minetest.swap_node( pos, newnode )
node.name = "mcl_minecarts:detector_rail_v2"
minetest.set_node( pos, node )
mesecon.receptor_off(pos)
end,
drop = "mcl_minecarts:detector_rail_v2",