summaryrefslogtreecommitdiff
path: root/technic
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 22:21:40 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 22:21:40 -0400
commit047a770ad04fc264039fa5b6109c803bd3d2d258 (patch)
tree0e1f8278a0bd4b4ff1fcc97cecd3a245c0ceb820 /technic
parent6d28a6dd1a5dbaaba0e08087220aed861d7a5699 (diff)
downloaddreambuilder_modpack-047a770ad04fc264039fa5b6109c803bd3d2d258.tar
dreambuilder_modpack-047a770ad04fc264039fa5b6109c803bd3d2d258.tar.gz
dreambuilder_modpack-047a770ad04fc264039fa5b6109c803bd3d2d258.tar.bz2
dreambuilder_modpack-047a770ad04fc264039fa5b6109c803bd3d2d258.tar.xz
dreambuilder_modpack-047a770ad04fc264039fa5b6109c803bd3d2d258.zip
update pipeworks and technic
Diffstat (limited to 'technic')
-rw-r--r--technic/machines/switching_station.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index 40b40e7..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
@@ -189,12 +194,29 @@ end
-----------------------------------------------
-- The action code for the switching station --
-----------------------------------------------
+
+technic.powerctrl_state = true
+
+minetest.register_chatcommand("powerctrl", {
+ params = "state",
+ description = "Enables or disables technic's switching station ABM",
+ privs = { basic_privs = true },
+ func = function(name, state)
+ if state == "on" then
+ technic.powerctrl_state = true
+ else
+ technic.powerctrl_state = false
+ end
+ end
+})
+
minetest.register_abm({
nodenames = {"technic:switching_station"},
label = "Switching Station", -- allows the mtt profiler to profile this abm individually
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
+ if not technic.powerctrl_state then return end
local meta = minetest.get_meta(pos)
local meta1 = nil
local pos1 = {}
@@ -217,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