diff options
author | 12Me21 <12Me21.mc@gmail.com> | 2018-09-15 10:30:13 -0400 |
---|---|---|
committer | 12Me21 <12Me21.mc@gmail.com> | 2018-09-15 10:30:13 -0400 |
commit | d8ed6d3af41051c2d5a7fe3f71bc0005aa0fd39e (patch) | |
tree | a6a52e51eb2c1966b9e9e4cb57f891bd682d7ac4 /autoplace_tubes.lua | |
parent | a69c210b569df7b659a3fd4fe6f5a414b3d1282c (diff) |
Tubes now update their connections when rotated with the screwdriver.
Diffstat (limited to 'autoplace_tubes.lua')
-rw-r--r-- | autoplace_tubes.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/autoplace_tubes.lua b/autoplace_tubes.lua index 0d28e64..a3a6aee 100644 --- a/autoplace_tubes.lua +++ b/autoplace_tubes.lua @@ -111,6 +111,22 @@ function pipeworks.after_dig(pos) pipeworks.scan_for_tube_objects(pos) end +-- Screwdriver calls this function before rotating a node. +-- However, connections must be updated *after* the node is rotated +-- So, this function does the rotation itself and returns `true`. +-- (Note: screwdriver already checks for protected areas.) + +-- This should only be used for tubes that don't autoconnect. +-- (For example, one-way tubes.) +-- Autoconnecting tubes will just revert back to their original state +-- when they are updated. +function pipeworks.on_rotate(pos, node, user, mode, new_param2) + node.param2 = new_param2 + minetest.set_node(pos, node) + pipeworks.scan_for_tube_objects(pos) + return true +end + if minetest.get_modpath("mesecons_mvps") then mesecon.register_on_mvps_move(function(moved_nodes) for _, n in ipairs(moved_nodes) do |