diff options
author | orwell96 <orwell@bleipb.de> | 2018-08-12 14:25:38 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-08-12 14:25:38 +0200 |
commit | cb56b8b49aa872642e53fc1a82cbdb546d5bfbcb (patch) | |
tree | cd11da5a2c3c1bac4c1361458ca754672abbcd30 /advtrains_interlocking/signal_api.lua | |
parent | 6cdb47edd231da08b32b8258eaa507ff312134cd (diff) | |
download | advtrains-cb56b8b49aa872642e53fc1a82cbdb546d5bfbcb.tar.gz advtrains-cb56b8b49aa872642e53fc1a82cbdb546d5bfbcb.tar.bz2 advtrains-cb56b8b49aa872642e53fc1a82cbdb546d5bfbcb.zip |
Signal aspect handling, make default signals compatible, fix signal digging
Diffstat (limited to 'advtrains_interlocking/signal_api.lua')
-rw-r--r-- | advtrains_interlocking/signal_api.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/advtrains_interlocking/signal_api.lua b/advtrains_interlocking/signal_api.lua index 17799ae..cd1ab54 100644 --- a/advtrains_interlocking/signal_api.lua +++ b/advtrains_interlocking/signal_api.lua @@ -21,7 +21,7 @@ asp = { } Signals API: groups = { - advtrains_signal = 1, + advtrains_signal = 2, save_in_at_nodedb = 1, } advtrains = { @@ -30,6 +30,7 @@ advtrains = { end } on_rightclick = advtrains.interlocking.signal_rc_handler +can_dig = advtrains.interlocking.signal_can_dig ]]-- @@ -48,6 +49,17 @@ local DANGER = { info = {} } +function advtrains.interlocking.update_signal_aspect(tcbs) + if tcbs.signal then + local asp = tcbs.aspect or DANGER + advtrains.interlocking.signal_set_aspect(tcbs.signal, asp) + end +end + +function advtrains.interlocking.signal_can_dig(pos) + return not advtrains.interlocking.db.get_sigd_for_signal(pos) +end + function advtrains.interlocking.signal_set_aspect(pos, asp) local node=advtrains.ndb.get_node(pos) local ndef=minetest.registered_nodes[node.name] |