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_mvps | |
parent | 1b10610f9221f2df1afb0dba18a88c1ac324ab60 (diff) |
MVPS: pull objects (#374)
Diffstat (limited to 'mesecons_mvps')
-rw-r--r-- | mesecons_mvps/init.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 014ff19..c53946d 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -205,7 +205,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti return true, nodes, oldstack end -function mesecon.mvps_move_objects(pos, dir, nodestack) +function mesecon.mvps_move_objects(pos, dir, nodestack, movefactor) local objects_to_move = {} local dir_k local dir_l @@ -216,6 +216,8 @@ function mesecon.mvps_move_objects(pos, dir, nodestack) break end end + movefactor = movefactor or 1 + dir = vector.multiply(dir, movefactor) for id, obj in pairs(minetest.object_refs) do local obj_pos = obj:get_pos() local cbox = obj:get_properties().collisionbox @@ -229,7 +231,7 @@ function mesecon.mvps_move_objects(pos, dir, nodestack) edge2 = v + 0.51 else edge1 = v - 0.5 * dir_l - edge2 = v + (#nodestack + 0.5) * dir_l + edge2 = v + (#nodestack + 0.5 * movefactor) * dir_l -- Make sure, edge1 is bigger than edge2: if edge1 > edge2 then edge1, edge2 = edge2, edge1 |