Add function to step through freight codes
parent
c54e0b341a
commit
45413ee5c0
|
@ -922,6 +922,16 @@ function advtrains.split_train_at_fc(train)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function advtrains.train_step_fc(train)
|
||||||
|
for i=1,#train.trainparts do
|
||||||
|
local w_id = train.trainparts[i]
|
||||||
|
local data = advtrains.wagons[w_id]
|
||||||
|
if data then
|
||||||
|
advtrains.step_fc(data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function advtrains.split_train_at_index(train, index)
|
function advtrains.split_train_at_index(train, index)
|
||||||
-- this function splits a train at index, creating a new train from the back part of the train.
|
-- this function splits a train at index, creating a new train from the back part of the train.
|
||||||
|
|
||||||
|
|
|
@ -874,6 +874,7 @@ function wagon.prev_fc(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function wagon.next_fc(data)
|
function wagon.next_fc(data)
|
||||||
|
if not data.fc then return end
|
||||||
if data.fcrev then
|
if data.fcrev then
|
||||||
wagon.prev_fc(data)
|
wagon.prev_fc(data)
|
||||||
return
|
return
|
||||||
|
@ -1127,7 +1128,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
wagon.show_wagon_properties({id=uid}, pname)
|
wagon.show_wagon_properties({id=uid}, pname)
|
||||||
end
|
end
|
||||||
if fields.fcn then
|
if fields.fcn then
|
||||||
wagon.next_fc(data)
|
advtrains.step_fc(data)
|
||||||
wagon.show_wagon_properties({id=uid}, pname)
|
wagon.show_wagon_properties({id=uid}, pname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,6 +75,10 @@ function r.fire_event(pos, evtdata)
|
||||||
end
|
end
|
||||||
return fc
|
return fc
|
||||||
end,
|
end,
|
||||||
|
step_fc = function()
|
||||||
|
if not train_id then return false end
|
||||||
|
advtrains.train_step_fc(train)
|
||||||
|
end,
|
||||||
set_shunt = function()
|
set_shunt = function()
|
||||||
if not train_id then return false end
|
if not train_id then return false end
|
||||||
train.autocouple = true
|
train.autocouple = true
|
||||||
|
|
Loading…
Reference in New Issue