diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-08 15:07:12 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-08 15:07:12 +0100 |
commit | 32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb (patch) | |
tree | ad073b8a979cf5a8b496d8300d464e0e7291053b /new_flow_logic | |
parent | e98e4e268b5faf898a0b8f580d7da2b46ead05c4 (diff) | |
download | pipeworks-32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb.tar pipeworks-32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb.tar.gz pipeworks-32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb.tar.bz2 pipeworks-32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb.tar.xz pipeworks-32a24730f1ab8cd596ed2f4cf6eda1a58c877ecb.zip |
new flow logic: change simple transition set logic to take list of key-value pairs, add set registration for flow sensor pipe
Diffstat (limited to 'new_flow_logic')
-rw-r--r-- | new_flow_logic/flowable_node_registry_install.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/new_flow_logic/flowable_node_registry_install.lua b/new_flow_logic/flowable_node_registry_install.lua index 63151f0..f019dc3 100644 --- a/new_flow_logic/flowable_node_registry_install.lua +++ b/new_flow_logic/flowable_node_registry_install.lua @@ -147,8 +147,11 @@ local simple_transitions = pipeworks.flowables.transitions.simple register.transition_simple_set = function(nodeset) local set = {} - for nodename, value in pairs(nodeset) do - if type(nodename) ~= "string" then simpleseterror("nodename key "..tostring(nodename).."was not a string!") end + for index, element in ipairs(nodeset) do + if type(element) ~= "table" then simpleseterror("element "..tostring(index).." in nodeset was not table!") end + local nodename = element[1] + local value = element[2] + if type(nodename) ~= "string" then simpleseterror("nodename "..tostring(nodename).."was not a string!") end if type(value) ~= "number" then simpleseterror("pressure value "..tostring(value).."was not a number!") end insert_transition_base(nodename) if simple_transitions[nodename] then duplicateerr("simple transition set", nodename) end @@ -159,7 +162,7 @@ register.transition_simple_set = function(nodeset) -- sort pressure values, smallest first local smallest_first = function(a, b) - return a.value < b.value + return a.threshold < b.threshold end table.sort(set, smallest_first) |