Speed up search for objects to be moved in MVPS (#512)

This commit is contained in:
cheapie 2020-04-24 17:33:00 -05:00 committed by GitHub
parent 68c1729990
commit d3aedd2b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,7 +285,7 @@ function mesecon.mvps_move_objects(pos, dir, nodestack, movefactor)
end end
movefactor = movefactor or 1 movefactor = movefactor or 1
dir = vector.multiply(dir, movefactor) dir = vector.multiply(dir, movefactor)
for id, obj in pairs(minetest.object_refs) do for id, obj in pairs(minetest.get_objects_inside_radius(pos, #nodestack + 1)) do
local obj_pos = obj:get_pos() local obj_pos = obj:get_pos()
local cbox = obj:get_properties().collisionbox local cbox = obj:get_properties().collisionbox
local min_pos = vector.add(obj_pos, vector.new(cbox[1], cbox[2], cbox[3])) local min_pos = vector.add(obj_pos, vector.new(cbox[1], cbox[2], cbox[3]))