diff options
Diffstat (limited to 'advtrains_luaautomation/atc_rail.lua')
-rw-r--r-- | advtrains_luaautomation/atc_rail.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua index b98648e..594de5c 100644 --- a/advtrains_luaautomation/atc_rail.lua +++ b/advtrains_luaautomation/atc_rail.lua @@ -2,6 +2,9 @@ -- registers and handles the ATC rail. Active component. -- This is the only component that can interface with trains, so train interface goes here too. +-- Get current translator +local S = atlatc.translate + --Using subtable local r={} @@ -62,7 +65,7 @@ function r.fire_event(pos, evtdata, appr_internal) local new_id = advtrains.split_train_at_index(train, index) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) - return true + return new_id end return false end, @@ -73,7 +76,7 @@ function r.fire_event(pos, evtdata, appr_internal) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) end - return fc or "" + return (fc or ""), new_id end, split_off_locomotive = function(cmd, len) assertt(cmd, "string") @@ -81,7 +84,8 @@ function r.fire_event(pos, evtdata, appr_internal) local new_id, fc = advtrains.split_train_at_fc(train, true, len) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) - end + end + return (fc or ""), new_id end, train_length = function () if not train_id then return false end @@ -95,10 +99,18 @@ function r.fire_event(pos, evtdata, appr_internal) if not train_id then return end local fc_list = {} for index,wagon_id in ipairs(train.trainparts) do - fc_list[index] = table.concat(advtrains.wagons[wagon_id].fc,"!") or "" + fc_list[index] = table.concat(advtrains.wagons[wagon_id].fc or {},"!") end return fc_list end, + get_fc_index = function() + if not train_id then return end + local fc_index_list = {} + for widx, wagon_id in ipars(train.trainparts) do + fc_index_list[widx] = advtrains.wagons[wagon_id].fcind or 1 + end + return fc_index_list + end, set_fc = function(fc_list,reset_index) assertt(fc_list, "table") if not train_id then return false end @@ -220,7 +232,7 @@ advtrains.register_tracks("default", { models_prefix="advtrains_dtrack", models_suffix=".b3d", shared_texture="advtrains_dtrack_shared_atc.png", - description=atltrans("LuaATC Rail"), + description=S("LuaATC Track"), formats={}, get_additional_definiton = function(def, preset, suffix, rotation) return { |