Fix stop rails sometimes not sending stop command

h137
orwell96 2019-02-16 21:50:07 +01:00
parent ee079d02ff
commit 84f1c3d8a5
2 changed files with 3 additions and 5 deletions

View File

@ -174,9 +174,9 @@ minetest.register_node(nodename, {
^- the code in these 3 default minetest API functions is required for advtrains to work, however you can add your own code
advtrains = {
on_train_enter=function(pos, train_id) end
on_train_enter=function(pos, train_id, train, index) end
^- called when a train enters the rail
on_train_leave=function(pos, train_id) end
on_train_leave=function(pos, train_id, train, index) end
^- called when a train leaves the rail
-- The following function is only in effect when interlocking is enabled:

View File

@ -146,9 +146,7 @@ local adefunc = function(def, preset, suffix, rotation)
end
end
end,
on_train_enter = function(pos, train_id)
local train = advtrains.trains[train_id]
local index = atfloor(train.index)
on_train_enter = function(pos, train_id, train, index)
if train.path_cn[index] == 1 then
local pe = advtrains.encode_pos(pos)
local stdata = advtrains.lines.stops[pe]