diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 23:42:26 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 23:42:26 +0100 |
commit | c3627551b091d27819c242da204ed1e9dd8f15f0 (patch) | |
tree | fb51d5e91b5a6357327266b00f466881b9be1f60 /new_flow_logic/abm_register.lua | |
parent | d69941a0ae763d6681ede2185ad88e25b11fead5 (diff) |
move all current new_flow_logic code to dedicated sub-directory
Diffstat (limited to 'new_flow_logic/abm_register.lua')
-rw-r--r-- | new_flow_logic/abm_register.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/new_flow_logic/abm_register.lua b/new_flow_logic/abm_register.lua new file mode 100644 index 0000000..e7bed6a --- /dev/null +++ b/new_flow_logic/abm_register.lua @@ -0,0 +1,49 @@ +-- register new flow logic ABMs +-- written 2017 by thetaepsilon + + + +local register = {} +pipeworks.flowlogic.abmregister = register + + + +-- register a node name for the pressure balancing ABM. +-- currently this only exists as a per-node function to allow nodes to be registered outside pipeworks. +local register_abm_balance = function(nodename) + minetest.register_abm({ + nodenames = { nodename }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + pipeworks.flowlogic.balance_pressure(pos, node) + end + }) +end +register.balance = register_abm_balance + +-- register a node for the pump ABM. +-- maxpressure is the maximum pressure that this pump can drive. +local register_abm_input = function(nodename, maxpressure) + minetest.register_abm({ + nodenames = { nodename }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + pipeworks.flowlogic.run_pump_intake(pos, node) + end + }) +end +register.input = register_abm_input + +-- old spigot ABM code, not yet migrated +--[[ + 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 + }) +]] |