diff options
author | Carter Kolwey <cheapiephp@gmail.com> | 2016-12-25 23:50:09 -0600 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2017-01-02 14:51:28 +0100 |
commit | 1bd936ad8c9e326f9466af66d78c8bda75bfd1c6 (patch) | |
tree | 09cd677fcc1e8e9486248d824b80ca2d34256728 /mesecons | |
parent | 79edbed8d7dc3a0280b2f631b95e36a49d7c5916 (diff) | |
download | mesecons-1bd936ad8c9e326f9466af66d78c8bda75bfd1c6.tar mesecons-1bd936ad8c9e326f9466af66d78c8bda75bfd1c6.tar.gz mesecons-1bd936ad8c9e326f9466af66d78c8bda75bfd1c6.tar.bz2 mesecons-1bd936ad8c9e326f9466af66d78c8bda75bfd1c6.tar.xz mesecons-1bd936ad8c9e326f9466af66d78c8bda75bfd1c6.zip |
Properly handle rotation of buttons / levers
Buttons and levers can now also be pointed upwards / downwards which will make them connect to corresponding up / down receivers. You will need to use the screwdriver for this.
Receivers cannot be rotated using the screwdriver anymore.
Diffstat (limited to 'mesecons')
-rw-r--r-- | mesecons/presets.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mesecons/presets.lua b/mesecons/presets.lua index 2f2f643..8c3ed67 100644 --- a/mesecons/presets.lua +++ b/mesecons/presets.lua @@ -41,12 +41,19 @@ mesecon.rules.alldirs = mesecon.rules.buttonlike_get = function(node) local rules = mesecon.rules.buttonlike - if node.param2 == 2 then + local dir = minetest.facedir_to_dir(node.param2) + if dir.x == 1 then + -- No action needed + elseif dir.z == -1 then rules=mesecon.rotate_rules_left(rules) - elseif node.param2 == 3 then + elseif dir.x == -1 then rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules)) - elseif node.param2 == 0 then + elseif dir.z == 1 then rules=mesecon.rotate_rules_right(rules) + elseif dir.y == -1 then + rules=mesecon.rotate_rules_up(rules) + elseif dir.y == 1 then + rules=mesecon.rotate_rules_down(rules) end return rules end |