Put node in test move info

This commit is contained in:
Jude Melton-Houghton 2022-04-04 08:13:09 -04:00
parent f2eded427f
commit 7680b31663
2 changed files with 4 additions and 4 deletions

View File

@ -33,8 +33,8 @@ mesecon._test_moves = {}
minetest.register_node("mesecons_mvps:test_on_move", { minetest.register_node("mesecons_mvps:test_on_move", {
description = "Test Moveable", description = "Test Moveable",
mesecon = { mesecon = {
on_mvps_move = function(pos, _, oldpos, meta) on_mvps_move = function(pos, node, oldpos, meta)
table.insert(mesecon._test_moves, {pos, oldpos, meta}) table.insert(mesecon._test_moves, {pos, node, oldpos, meta})
end end
}, },
}) })

View File

@ -122,9 +122,9 @@ describe("node movement", function()
it("calls move callbacks", function() it("calls move callbacks", function()
local pos = {x = 0, y = 0, z = 0} local pos = {x = 0, y = 0, z = 0}
local dir = {x = 1, y = 0, z = 0} local dir = {x = 1, y = 0, z = 0}
world.set_node(pos, "mesecons_mvps:test_on_move") world.set_node(pos, {name = "mesecons_mvps:test_on_move", param2 = 123})
minetest.get_meta(pos):set_string("foo", "bar") minetest.get_meta(pos):set_string("foo", "bar")
local move_info = {vector.add(pos, dir), pos, minetest.get_meta(pos):to_table()} local move_info = {vector.add(pos, dir), world.get_node(pos), pos, minetest.get_meta(pos):to_table()}
mesecon.mvps_push(pos, dir, 1, "") mesecon.mvps_push(pos, dir, 1, "")
assert.equal(1, #mesecon._test_moves) assert.equal(1, #mesecon._test_moves)