diff options
author | autocommitter <autocommitter@linux-forks.de> | 2025-08-26 00:00:02 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2025-08-26 00:00:02 +0200 |
commit | 98ee5a1df5a6cd70fe57175c5ff8fc7b99add245 (patch) | |
tree | b1d1f25b1fec8217ba7f451a1c5bfee7fe2fea66 /m4/init_code.lua | |
parent | 951dc4d254c941f0e519ff5183e65883eb4b6938 (diff) | |
download | luaatc_envs-98ee5a1df5a6cd70fe57175c5ff8fc7b99add245.tar.gz luaatc_envs-98ee5a1df5a6cd70fe57175c5ff8fc7b99add245.tar.bz2 luaatc_envs-98ee5a1df5a6cd70fe57175c5ff8fc7b99add245.zip |
State at 2025-08-26
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) |