aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/signal_api.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-08-12 14:25:38 +0200
committerorwell96 <orwell@bleipb.de>2018-08-12 14:25:38 +0200
commitcb56b8b49aa872642e53fc1a82cbdb546d5bfbcb (patch)
treecd11da5a2c3c1bac4c1361458ca754672abbcd30 /advtrains_interlocking/signal_api.lua
parent6cdb47edd231da08b32b8258eaa507ff312134cd (diff)
downloadadvtrains-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.lua14
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]