summaryrefslogtreecommitdiff
path: root/register_flow_logic.lua
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 17:25:16 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 17:25:16 +0100
commitdf8ef255a3a66c676fc74197fb034e5033aed763 (patch)
treed0212adc23e333fb3e05cc7ef80f0cffc6d0b575 /register_flow_logic.lua
parent69133818f7283ea3a8b14060b71df769cac9eb48 (diff)
downloadpipeworks-df8ef255a3a66c676fc74197fb034e5033aed763.tar
pipeworks-df8ef255a3a66c676fc74197fb034e5033aed763.tar.gz
pipeworks-df8ef255a3a66c676fc74197fb034e5033aed763.tar.bz2
pipeworks-df8ef255a3a66c676fc74197fb034e5033aed763.tar.xz
pipeworks-df8ef255a3a66c676fc74197fb034e5033aed763.zip
flowing_logic.lua: add new spigot code + ABM registration
Diffstat (limited to 'register_flow_logic.lua')
-rw-r--r--register_flow_logic.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/register_flow_logic.lua b/register_flow_logic.lua
index e027dae..c6fc46f 100644
--- a/register_flow_logic.lua
+++ b/register_flow_logic.lua
@@ -7,13 +7,20 @@ local pipes_empty_nodenames = pipeworks.pipes_empty_nodenames
-- FIXME: DRY principle, get this from elsewhere in the code
local pump_on = "pipeworks:pump_on"
local pump_off = "pipeworks:pump_off"
+local spigot_off = "pipeworks:spigot"
+local spigot_on = "pipeworks:spigot_pouring"
local pipes_all_nodenames = pipes_full_nodenames
for _, pipe in ipairs(pipes_empty_nodenames) do
table.insert(pipes_all_nodenames, pipe)
end
-table.insert(pipes_all_nodenames, pump_off)
-table.insert(pipes_all_nodenames, pump_on)
+
+if pipeworks.enable_pipe_devices then
+ table.insert(pipes_all_nodenames, pump_off)
+ table.insert(pipes_all_nodenames, pump_on)
+ table.insert(pipes_all_nodenames, spigot_on)
+ table.insert(pipes_all_nodenames, spigot_off)
+end
if pipeworks.enable_pipes then
@@ -37,4 +44,14 @@ if pipeworks.enable_pipe_devices then
pipeworks.run_pump_intake(pos, node)
end
})
+ -- output water from spigots
+ -- add both "on/off" spigots so one can be used to indicate a certain level of fluid.
+ minetest.register_abm({
+ nodenames = { spigot_on, spigot_off },
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ pipeworks.run_spigot_output(pos, node)
+ end
+ })
end