mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-21 18:11:11 +00:00
Rename minetest.*
to core.*
in devtest
This commit is contained in:
parent
d849d51c2d
commit
88c7a54e08
78 changed files with 914 additions and 914 deletions
|
@ -73,8 +73,8 @@ end
|
|||
unittests.register("test_v3f_metatable", test_v3f_metatable, {player=true})
|
||||
|
||||
local function test_v3s16_metatable(player, pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local found_pos = minetest.find_node_near(pos, 0, node.name, true)
|
||||
local node = core.get_node(pos)
|
||||
local found_pos = core.find_node_near(pos, 0, node.name, true)
|
||||
assert(vector.check(found_pos))
|
||||
end
|
||||
unittests.register("test_v3s16_metatable", test_v3s16_metatable, {map=true})
|
||||
|
@ -181,7 +181,7 @@ local function test_write_json()
|
|||
for i = 1, 1000 do
|
||||
data = {data}
|
||||
end
|
||||
local roundtripped = minetest.parse_json(minetest.write_json(data))
|
||||
local roundtripped = core.parse_json(core.write_json(data))
|
||||
for i = 1, 1000 do
|
||||
roundtripped = roundtripped[1]
|
||||
end
|
||||
|
@ -190,7 +190,7 @@ end
|
|||
unittests.register("test_write_json", test_write_json)
|
||||
|
||||
local function test_game_info()
|
||||
local info = minetest.get_game_info()
|
||||
local info = core.get_game_info()
|
||||
local game_conf = Settings(info.path .. "/game.conf")
|
||||
assert(info.id == "devtest")
|
||||
assert(info.title == game_conf:get("title"))
|
||||
|
@ -199,27 +199,27 @@ unittests.register("test_game_info", test_game_info)
|
|||
|
||||
local function test_mapgen_edges(cb)
|
||||
-- Test that the map can extend to the expected edges and no further.
|
||||
local min_edge, max_edge = minetest.get_mapgen_edges()
|
||||
local min_edge, max_edge = core.get_mapgen_edges()
|
||||
local min_finished = {}
|
||||
local max_finished = {}
|
||||
local function finish()
|
||||
if #min_finished ~= 1 then
|
||||
return cb("Expected 1 block to emerge around mapgen minimum edge")
|
||||
end
|
||||
if min_finished[1] ~= (min_edge / minetest.MAP_BLOCKSIZE):floor() then
|
||||
if min_finished[1] ~= (min_edge / core.MAP_BLOCKSIZE):floor() then
|
||||
return cb("Expected block within minimum edge to emerge")
|
||||
end
|
||||
if #max_finished ~= 1 then
|
||||
return cb("Expected 1 block to emerge around mapgen maximum edge")
|
||||
end
|
||||
if max_finished[1] ~= (max_edge / minetest.MAP_BLOCKSIZE):floor() then
|
||||
if max_finished[1] ~= (max_edge / core.MAP_BLOCKSIZE):floor() then
|
||||
return cb("Expected block within maximum edge to emerge")
|
||||
end
|
||||
return cb()
|
||||
end
|
||||
local emerges_left = 2
|
||||
local function emerge_block(blockpos, action, blocks_left, finished)
|
||||
if action ~= minetest.EMERGE_CANCELLED then
|
||||
if action ~= core.EMERGE_CANCELLED then
|
||||
table.insert(finished, blockpos)
|
||||
end
|
||||
if blocks_left == 0 then
|
||||
|
@ -229,34 +229,34 @@ local function test_mapgen_edges(cb)
|
|||
end
|
||||
end
|
||||
end
|
||||
minetest.emerge_area(min_edge:subtract(1), min_edge, emerge_block, min_finished)
|
||||
minetest.emerge_area(max_edge, max_edge:add(1), emerge_block, max_finished)
|
||||
core.emerge_area(min_edge:subtract(1), min_edge, emerge_block, min_finished)
|
||||
core.emerge_area(max_edge, max_edge:add(1), emerge_block, max_finished)
|
||||
end
|
||||
unittests.register("test_mapgen_edges", test_mapgen_edges, {map=true, async=true})
|
||||
|
||||
local finish_test_on_mapblocks_changed
|
||||
minetest.register_on_mapblocks_changed(function(modified_blocks, modified_block_count)
|
||||
core.register_on_mapblocks_changed(function(modified_blocks, modified_block_count)
|
||||
if finish_test_on_mapblocks_changed then
|
||||
finish_test_on_mapblocks_changed(modified_blocks, modified_block_count)
|
||||
finish_test_on_mapblocks_changed = nil
|
||||
end
|
||||
end)
|
||||
local function test_on_mapblocks_changed(cb, player, pos)
|
||||
local bp1 = (pos / minetest.MAP_BLOCKSIZE):floor()
|
||||
local bp1 = (pos / core.MAP_BLOCKSIZE):floor()
|
||||
local bp2 = bp1:add(1)
|
||||
for _, bp in ipairs({bp1, bp2}) do
|
||||
-- Make a modification in the block.
|
||||
local p = bp * minetest.MAP_BLOCKSIZE
|
||||
minetest.load_area(p)
|
||||
local meta = minetest.get_meta(p)
|
||||
local p = bp * core.MAP_BLOCKSIZE
|
||||
core.load_area(p)
|
||||
local meta = core.get_meta(p)
|
||||
meta:set_int("test_on_mapblocks_changed", meta:get_int("test_on_mapblocks_changed") + 1)
|
||||
end
|
||||
finish_test_on_mapblocks_changed = function(modified_blocks, modified_block_count)
|
||||
if modified_block_count < 2 then
|
||||
return cb("Expected at least two mapblocks to be recorded as modified")
|
||||
end
|
||||
if not modified_blocks[minetest.hash_node_position(bp1)] or
|
||||
not modified_blocks[minetest.hash_node_position(bp2)] then
|
||||
if not modified_blocks[core.hash_node_position(bp1)] or
|
||||
not modified_blocks[core.hash_node_position(bp2)] then
|
||||
return cb("The expected mapblocks were not recorded as modified")
|
||||
end
|
||||
cb()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue