diff options
Diffstat (limited to 'advtrains/couple.lua')
-rw-r--r-- | advtrains/couple.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/advtrains/couple.lua b/advtrains/couple.lua index 9474dcf..cbeb661 100644 --- a/advtrains/couple.lua +++ b/advtrains/couple.lua @@ -28,6 +28,20 @@ end advtrains.register_coupler_type("chain", attrans("Buffer and Chain Coupler")) advtrains.register_coupler_type("scharfenberg", attrans("Scharfenberg Coupler")) +for _, name in pairs {"couple", "decouple"} do + local t = {} + local function reg(f) + table.insert(t, f) + end + local function cb(...) + for _, f in ipairs(t) do + f(...) + end + end + advtrains["te_registered_on_" .. name] = t + advtrains["te_register_on_" .. name] = reg + advtrains["te_run_callbacks_on_" .. name] = cb +end local function create_couple_entity(pos, train1, t1_is_front, train2, t2_is_front) local id1 = train1.id @@ -235,6 +249,8 @@ function advtrains.couple_trains(init_train, invert_init_train, stat_train, stat return end + advtrains.te_run_callbacks_on_couple(init_train, stat_train) + if stat_train_opposite then -- insert wagons in inverse order and set their wagon_flipped state for i=1,stat_wagoncnt do |