diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-29 01:30:27 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-29 01:30:27 +0200 |
commit | 0b14d8ddb131343a588f27b8c06f1742036d00a7 (patch) | |
tree | fcce867b15622073bb84de0fbf079e1e0c0c616d /advtrains_luaautomation/atc_rail.lua | |
parent | f458f39fde62432cae0829974b37ac72d3c3dbce (diff) | |
download | advtrains-0b14d8ddb131343a588f27b8c06f1742036d00a7.tar.gz advtrains-0b14d8ddb131343a588f27b8c06f1742036d00a7.tar.bz2 advtrains-0b14d8ddb131343a588f27b8c06f1742036d00a7.zip |
Add autocouple mode
The shunting mode no longer makes trains couple, since it was meant
for other purposes. For autocoupling, the new autocoupling mode is
used. If trains are in autocouple mode, they couple when they collide
with another train.
Diffstat (limited to 'advtrains_luaautomation/atc_rail.lua')
-rw-r--r-- | advtrains_luaautomation/atc_rail.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua index feac8d1..0bb9871 100644 --- a/advtrains_luaautomation/atc_rail.lua +++ b/advtrains_luaautomation/atc_rail.lua @@ -67,13 +67,20 @@ function r.fire_event(pos, evtdata) return false end, set_shunt = function() - -- enable shunting mode if not train_id then return false end - train.is_shunt = true + train.autocouple = true end, unset_shunt = function() if not train_id then return false end - train.is_shunt = nil + train.autocouple = nil + end, + set_autcouple = function () + if not train_id then return false end + train.autocouple = true + end, + unset_autocouple = function () + if not train_id then return false end + train.autocouple = nil end, set_line = function(line) if type(line)~="string" and type(line)~="number" then |