diff options
author | DS <vorunbekannt75@web.de> | 2017-10-18 21:53:22 +0200 |
---|---|---|
committer | Vitaliy <silverunicorn2011@yandex.ru> | 2017-10-18 22:53:22 +0300 |
commit | 748446b3cc4d663764e632c9de62eff2e530b44c (patch) | |
tree | bd92de0b0e0ffa517def4fdd4d4102d358e8cf60 /mesecons_movestones/init.lua | |
parent | 1b10610f9221f2df1afb0dba18a88c1ac324ab60 (diff) |
MVPS: pull objects (#374)
Diffstat (limited to 'mesecons_movestones/init.lua')
-rw-r--r-- | mesecons_movestones/init.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index 48481ea..723c7fd 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -50,7 +50,6 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical) minetest.get_node_timer(pos):start(timer_interval) return end - mesecon.mvps_process_stack(stack) mesecon.mvps_move_objects(frontpos, direction, oldstack) -- ### Step 2: Move the movestone ### @@ -61,9 +60,13 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical) minetest.get_node_timer(frontpos):start(timer_interval) -- ### Step 3: If sticky, pull stack behind ### - if is_sticky then - local backpos = vector.subtract(pos, direction) - mesecon.mvps_pull_all(backpos, direction, max_pull) + if not is_sticky then + return + end + local backpos = vector.subtract(pos, direction) + success, stack, oldstack = mesecon.mvps_pull_all(backpos, direction, max_pull) + if success then + mesecon.mvps_move_objects(backpos, vector.multiply(direction, -1), oldstack, -1) end end |