summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 12:16:36 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 12:16:36 +0100
commit465e28cbd3e2d176a4ca0429711bc459fe37cf0d (patch)
treeea8263e40e73b3f0af912c574fe953f9e3ba9cac
parent7eb5dc6aca664bbca5c81203f5d72d9abc39578c (diff)
downloadpipeworks-465e28cbd3e2d176a4ca0429711bc459fe37cf0d.tar
pipeworks-465e28cbd3e2d176a4ca0429711bc459fe37cf0d.tar.gz
pipeworks-465e28cbd3e2d176a4ca0429711bc459fe37cf0d.tar.bz2
pipeworks-465e28cbd3e2d176a4ca0429711bc459fe37cf0d.tar.xz
pipeworks-465e28cbd3e2d176a4ca0429711bc459fe37cf0d.zip
devices.lua: factor out usage of flowlogic helper into dedicated registry function
-rw-r--r--devices.lua12
-rw-r--r--new_flow_logic/flowable_node_registry_install.lua4
2 files changed, 10 insertions, 6 deletions
diff --git a/devices.lua b/devices.lua
index 1eb18be..61648da 100644
--- a/devices.lua
+++ b/devices.lua
@@ -377,9 +377,9 @@ minetest.register_node(nodename_spigot_loaded, {
new_flow_logic_register.simple(nodename_spigot_empty)
new_flow_logic_register.simple(nodename_spigot_loaded)
local spigot_min = 1
-local outputfn = pipeworks.flowlogic.helpers.make_neighbour_output_fixed({{x=0, y=-1, z=0}})
-new_flow_logic_register.output(nodename_spigot_empty, spigot_min, outputfn)
-new_flow_logic_register.output(nodename_spigot_loaded, spigot_min, outputfn)
+local spigot_neighbours={{x=0, y=-1, z=0}}
+new_flow_logic_register.output_simple(nodename_spigot_empty, spigot_min, spigot_neighbours)
+new_flow_logic_register.output_simple(nodename_spigot_loaded, spigot_min, spigot_neighbours)
@@ -670,9 +670,9 @@ minetest.register_node(nodename_fountain_loaded, {
new_flow_logic_register.simple(nodename_fountain_empty)
new_flow_logic_register.simple(nodename_fountain_loaded)
local fountain_min = 1
-local fountainfn = pipeworks.flowlogic.helpers.make_neighbour_output_fixed({{x=0, y=1, z=0}})
-new_flow_logic_register.output(nodename_fountain_empty, fountain_min, fountainfn)
-new_flow_logic_register.output(nodename_fountain_loaded, fountain_min, fountainfn)
+local fountain_neighbours={{x=0, y=1, z=0}}
+new_flow_logic_register.output_simple(nodename_fountain_empty, fountain_min, fountain_neighbours)
+new_flow_logic_register.output_simple(nodename_fountain_loaded, fountain_min, fountain_neighbours)
diff --git a/new_flow_logic/flowable_node_registry_install.lua b/new_flow_logic/flowable_node_registry_install.lua
index 79f5997..3d9ce0a 100644
--- a/new_flow_logic/flowable_node_registry_install.lua
+++ b/new_flow_logic/flowable_node_registry_install.lua
@@ -77,3 +77,7 @@ end
-- which tries to place water nodes around it.
-- possibly this could be given a helper function to determine which faces a node should try,
-- to allow things like rotation or other param values determining "direction" to be respected.
+register.output_simple = function(nodename, threshold, neighbours)
+ local outputfn = pipeworks.flowlogic.helpers.make_neighbour_output_fixed(neighbours)
+ register.output(nodename, threshold, outputfn)
+end