aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_track/init.lua
diff options
context:
space:
mode:
authororwell <orwell@bleipb.de>2024-11-25 22:31:26 +0100
committerorwell <orwell@bleipb.de>2024-11-25 22:31:26 +0100
commit922e654b7bef51c7ddaf510ec70880d48181dd35 (patch)
tree3d12820d7a67180df3d2bd36d3fa7b4d61c1166c /advtrains_train_track/init.lua
parent73c393e223b1d2d81b767d8036c7fdec7ca20100 (diff)
downloadadvtrains-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/init.lua')
-rw-r--r--advtrains_train_track/init.lua29
1 files changed, 29 insertions, 0 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',