summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 17:37:00 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 18:05:52 -0400
commita84b5f3b28789318738dfa52ee1264c8d31eecb4 (patch)
treebd62d919ded5a54458e47792e38c266c535e6281
parent9d5bd90b57a1104ed98d183c8f9584b8507f88a5 (diff)
print warning to console if redundant switching station is found
and where it is only prints the warning once per redundant station, per minetest session. if there are multiple redundant stations on a network, digging one should cause the warning to appear for the next one technic finds, if it doesn't show them all right away.
-rw-r--r--technic/machines/switching_station.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index 6f561e4..dcc0520 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -2,6 +2,7 @@
technic.networks = {}
technic.cables = {}
+technic.redundant_warn = {}
local mesecons_path = minetest.get_modpath("mesecons")
local digilines_path = minetest.get_modpath("digilines")
@@ -44,11 +45,15 @@ minetest.register_node("technic:switching_station",{
meta:set_string("active", 1)
meta:set_string("channel", "switching_station"..minetest.pos_to_string(pos))
meta:set_string("formspec", "field[channel;Channel;${channel}]")
+ local poshash = minetest.hash_node_position(pos)
+ technic.redundant_warn.poshash = nil
end,
after_dig_node = function(pos)
minetest.forceload_free_block(pos)
pos.y = pos.y - 1
minetest.forceload_free_block(pos)
+ local poshash = minetest.hash_node_position(pos)
+ technic.redundant_warn.poshash = nil
end,
on_receive_fields = function(pos, formname, fields, sender)
if not fields.channel then
@@ -234,6 +239,13 @@ minetest.register_abm({
minetest.forceload_free_block(pos)
minetest.forceload_free_block(pos1)
meta:set_string("infotext",S("%s Already Present"):format(machine_name))
+
+ local poshash = minetest.hash_node_position(pos)
+
+ if not technic.redundant_warn.poshash then
+ technic.redundant_warn.poshash = true
+ print("[TECHNIC] Warning: redundant switching station found near "..minetest.pos_to_string(pos))
+ end
return
end