diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-30 15:36:24 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-30 15:36:24 +0100 |
commit | c4bac79bf07b2d94f97893c41889d619d1ef97e0 (patch) | |
tree | 4606c14e5685782262853dc132091439f713cd60 | |
parent | 190b476b66b7fec28f49c8afddddea1af8c41650 (diff) | |
download | advtrains-c4bac79bf07b2d94f97893c41889d619d1ef97e0.tar.gz advtrains-c4bac79bf07b2d94f97893c41889d619d1ef97e0.tar.bz2 advtrains-c4bac79bf07b2d94f97893c41889d619d1ef97e0.zip |
Do not allow static signals for routesetting
-rw-r--r-- | advtrains_interlocking/tcb_ts_ui.lua | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index c0e0d98..203e0b1 100644 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -141,20 +141,25 @@ minetest.register_on_punchnode(function(pos, node, player, pointed_thing) if vector.distance(pos, sigd.p)<=50 then local is_signal = minetest.get_item_group(node.name, "advtrains_signal") >= 2 if is_signal then - local tcbs = ildb.get_tcbs(sigd) - if tcbs then - tcbs.signal = pos - if not tcbs.signal_name then - tcbs.signal_name = "Signal at "..minetest.pos_to_string(sigd.p) + local ndef = minetest.registered_nodes[node.name] + if ndef and ndef.advtrains and ndef.advtrains.set_aspect then + local tcbs = ildb.get_tcbs(sigd) + if tcbs then + tcbs.signal = pos + if not tcbs.signal_name then + tcbs.signal_name = "Signal at "..minetest.pos_to_string(sigd.p) + end + if not tcbs.routes then + tcbs.routes = {} + end + ildb.set_sigd_for_signal(pos, sigd) + minetest.chat_send_player(pname, "Configuring TCB: Successfully assigned signal.") + advtrains.interlocking.show_ip_form(pos, pname, true) + else + minetest.chat_send_player(pname, "Configuring TCB: Internal error, TCBS doesn't exist. Aborted.") end - if not tcbs.routes then - tcbs.routes = {} - end - ildb.set_sigd_for_signal(pos, sigd) - minetest.chat_send_player(pname, "Configuring TCB: Successfully assigned signal.") - advtrains.interlocking.show_ip_form(pos, pname, true) else - minetest.chat_send_player(pname, "Configuring TCB: Internal error, TCBS doesn't exist. Aborted.") + minetest.chat_send_player(pname, "Configuring TCB: Cannot use static signals for routesetting. Aborted.") end else minetest.chat_send_player(pname, "Configuring TCB: Not a compatible signal. Aborted.") |