diff options
Diffstat (limited to 'm4/init_code.lua')
-rw-r--r-- | m4/init_code.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/m4/init_code.lua b/m4/init_code.lua index b7c58a3..65e58bb 100644 --- a/m4/init_code.lua +++ b/m4/init_code.lua @@ -53,33 +53,36 @@ function F.cpllooparound(ln) end --new ones +--these work with train going forward with engine in front! :D function F.split_looparound(ln) if not (event.train) then return end if not (F.get_line_safe() == ln) then return end + if not (F.get_train_length_safe() >= 2) then return end -- no wagons? do nothing! :D - split_at_index(F.get_train_length_safe()-1,"A0S0OC") --Stopping the wagons is handled here by SO + --split_at_index(F.get_train_length_safe()-1,"A0S0OC") --Stopping the wagons is handled here by SO + split_at_index(2,"A0S0OC") --Stopping the wagons is handled here by SO set_rc("ENGINE") atc_send("A1") - end function F.split_looparound_left(ln) if not (event.train) then return end if not (F.get_line_safe() == ln) then return end + if not (F.get_train_length_safe() >= 2) then return end -- no wagons? do nothing! :D - split_at_index(F.get_train_length_safe()-1,"A0S0OL") --Stopping the wagons is handled here by SO + split_at_index(2,"A0S0OL") --Stopping the wagons is handled here by SO set_rc("ENGINE") atc_send("A1") - end + function F.split_looparound_right(ln) if not (event.train) then return end if not (F.get_line_safe() == ln) then return end + if not (F.get_train_length_safe() >= 2) then return end -- no wagons? do nothing! :D - split_at_index(F.get_train_length_safe()-1,"A0S0OR") --Stopping the wagons is handled here by SO + split_at_index(2,"A0S0OR") --Stopping the wagons is handled here by SO set_rc("ENGINE") atc_send("A1") - end function F.cpl_looparound(ln) @@ -91,7 +94,6 @@ function F.cpl_looparound(ln) set_rc("") return end - end --end of new cpl functions @@ -101,6 +103,7 @@ function F.print_length() F.print(F.get_train_length_safe()) end + --[[ Utility Functions ]]-- F.indicator = function(indicator,set) |