diff options
author | orwell <orwell@bleipb.de> | 2024-11-25 22:31:26 +0100 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2024-11-25 22:31:26 +0100 |
commit | 922e654b7bef51c7ddaf510ec70880d48181dd35 (patch) | |
tree | 3d12820d7a67180df3d2bd36d3fa7b4d61c1166c /advtrains_train_track | |
parent | 73c393e223b1d2d81b767d8036c7fdec7ca20100 (diff) | |
download | advtrains-922e654b7bef51c7ddaf510ec70880d48181dd35.tar.gz advtrains-922e654b7bef51c7ddaf510ec70880d48181dd35.tar.bz2 advtrains-922e654b7bef51c7ddaf510ec70880d48181dd35.zip |
Make Buffers become implicitly their own TCBs and signals when interlocking is enabled
Diffstat (limited to 'advtrains_train_track')
-rw-r--r-- | advtrains_train_track/init.lua | 29 | ||||
-rw-r--r-- | advtrains_train_track/mod.conf | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/advtrains_train_track/init.lua b/advtrains_train_track/init.lua index 32e1235..f551ec5 100644 --- a/advtrains_train_track/init.lua +++ b/advtrains_train_track/init.lua @@ -600,6 +600,35 @@ advtrains.register_tracks("default", { --bumpers still use the old texture until the models are redone. description=attrans("Bumper"), formats={}, + get_additional_definiton = function(def, preset, suffix, rotation) + -- 2024-11-25: Bumpers get the additional feature of being both a signal and a self-contained TCB, when interlocking is used. + if advtrains.interlocking then + return { + -- use the special callbacks for self_tcb (see tcb_ts_ui.lua) + can_dig = advtrains.interlocking.self_tcb_make_can_dig_callback(true), + after_dig_node = advtrains.interlocking.self_tcb_make_after_dig_callback(true), + after_place_node = advtrains.interlocking.self_tcb_make_after_place_callback(true, true), + on_rightclick = advtrains.interlocking.self_tcb_make_on_rightclick_callback(false, true), + advtrains = { + main_aspects = { + -- No main aspects, it always shows Stop. + -- But we need to define the table so that signal caplevel is 3 + }, + apply_aspect = function(pos, node, main_aspect, rem_aspect, rem_aspinfo) + -- is a no-op for bumpers, it always shows Stop + end, + get_aspect_info = function(pos, main_aspect) + -- it always shows Stop + return advtrains.interlocking.signal.ASPI_HALT + end, + distant_support = false, -- not a distant + route_role = "end", -- the end is nigh! + } + } + else + return {} -- no additional defs when interlocking is not used + end + end, }, advtrains.ap.t_30deg_straightonly) minetest.register_craft({ output = 'advtrains:dtrack_bumper_placer 2', diff --git a/advtrains_train_track/mod.conf b/advtrains_train_track/mod.conf index 2aece3e..a7fef4d 100644 --- a/advtrains_train_track/mod.conf +++ b/advtrains_train_track/mod.conf @@ -4,4 +4,4 @@ description=Default track set for Advanced Trains author=orwell96 depends=advtrains -optional_depends=mesecons,digtron +optional_depends=mesecons,digtron,advtrains_interlocking |