1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Implement minetest.ipc_cas()

This commit is contained in:
sfan5 2024-05-23 15:44:16 +02:00
parent f1a436619f
commit 72801d0233
5 changed files with 68 additions and 8 deletions

View file

@ -22,8 +22,11 @@ local function do_tests()
assert(core.registered_items["unittests:description_test"].on_place == true)
end
-- this is checked from the main env
core.ipc_set("unittests:mg", { pcall(do_tests) })
-- first thread to get here runs the tests
if core.ipc_cas("unittests:mg_once", nil, true) then
-- this is checked from the main env
core.ipc_set("unittests:mg", { pcall(do_tests) })
end
core.register_on_generated(function(vm, pos1, pos2, blockseed)
local n = tonumber(core.get_mapgen_setting("chunksize")) * 16 - 1