2018-11-02 21:20:51 -04:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-03-02 19:35:36 -05:00
|
|
|
-- SKIP: include nodecore
|
2019-03-10 01:32:36 -05:00
|
|
|
local dofile, error, minetest, pairs, rawget, rawset, setmetatable,
|
|
|
|
table, type
|
|
|
|
= dofile, error, minetest, pairs, rawget, rawset, setmetatable,
|
|
|
|
table, type
|
2019-02-04 20:15:33 -05:00
|
|
|
local table_concat, table_insert
|
|
|
|
= table.concat, table.insert
|
2018-11-02 21:20:51 -04:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
2019-01-12 20:46:56 -05:00
|
|
|
local nodecore = rawget(_G, "nodecore") or {}
|
2018-11-02 07:52:23 -04:00
|
|
|
rawset(_G, "nodecore", nodecore)
|
2018-11-02 18:47:44 -04:00
|
|
|
|
2019-02-04 20:15:33 -05:00
|
|
|
local include = rawget(_G, "include") or function(...)
|
|
|
|
local parts = {...}
|
|
|
|
table_insert(parts, 1, minetest.get_modpath(minetest.get_current_modname()))
|
|
|
|
if parts[#parts]:sub(-4) ~= ".lua" then
|
|
|
|
parts[#parts] = parts[#parts] .. ".lua"
|
|
|
|
end
|
|
|
|
return dofile(table_concat(parts, "/"))
|
|
|
|
end
|
|
|
|
rawset(_G, "include", include)
|
2018-11-02 21:20:51 -04:00
|
|
|
|
2019-09-07 09:08:57 -04:00
|
|
|
nodecore.product = "NodeCore"
|
2019-02-04 20:15:33 -05:00
|
|
|
nodecore.version = include("version")
|
2018-11-03 08:46:14 -04:00
|
|
|
|
2019-03-10 01:32:36 -05:00
|
|
|
local function callguard(n, t, k, v)
|
|
|
|
if type(v) ~= "function" then return v end
|
|
|
|
return function(first, ...)
|
|
|
|
if first == t then
|
2019-03-24 22:32:36 -04:00
|
|
|
error("called " .. n .. ":" .. k .. "() instead of " .. n .. "." .. k .. "()")
|
2019-03-10 01:32:36 -05:00
|
|
|
end
|
|
|
|
return v(first, ...)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for k, v in pairs(minetest) do
|
|
|
|
minetest[k] = callguard("minetest", minetest, k, v)
|
|
|
|
end
|
2019-08-27 19:14:51 -04:00
|
|
|
setmetatable(nodecore, {
|
|
|
|
__newindex = function(t, k, v)
|
2019-03-10 01:32:36 -05:00
|
|
|
rawset(nodecore, k, callguard("nodecore", t, k, v))
|
2019-08-27 19:14:51 -04:00
|
|
|
end
|
|
|
|
})
|
2019-03-10 01:32:36 -05:00
|
|
|
|
2020-05-27 07:00:13 -04:00
|
|
|
minetest.register_on_mods_loaded(function()
|
|
|
|
for _, n in pairs(minetest.get_modnames()) do
|
|
|
|
if n == "default" then
|
|
|
|
error(nodecore.product
|
|
|
|
.. " cannot be loaded on top of another game!")
|
|
|
|
error()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2019-10-27 10:05:57 -04:00
|
|
|
include("compat_vector")
|
2019-10-13 09:38:07 -04:00
|
|
|
include("issue9043")
|
2019-02-03 12:10:27 -05:00
|
|
|
|
2019-02-04 20:15:33 -05:00
|
|
|
include("util_misc")
|
2019-09-09 07:05:01 -04:00
|
|
|
include("util_falling")
|
2019-02-04 20:15:33 -05:00
|
|
|
include("util_scan_flood")
|
|
|
|
include("util_node_is")
|
|
|
|
include("util_toolcaps")
|
2019-02-23 09:44:22 -05:00
|
|
|
include("util_stack")
|
2019-02-23 13:14:09 -05:00
|
|
|
include("util_phealth")
|
2019-03-05 23:05:56 -05:00
|
|
|
include("util_facedir")
|
2019-04-06 23:51:05 -04:00
|
|
|
include("util_sound")
|
2019-08-23 20:40:33 -04:00
|
|
|
include("util_translate")
|
2019-08-27 21:41:03 -04:00
|
|
|
include("util_ezschematic")
|
2019-11-10 08:10:34 -05:00
|
|
|
include("util_gametime")
|
2020-01-04 10:51:10 -05:00
|
|
|
include("util_settlescan")
|
2019-02-04 20:16:54 -05:00
|
|
|
include("match")
|
2019-02-09 22:44:56 -05:00
|
|
|
|
|
|
|
include("fx_digparticles")
|
2019-01-06 12:02:37 -05:00
|
|
|
|
2019-09-07 09:08:57 -04:00
|
|
|
include("register_mods")
|
2020-03-22 10:59:06 -04:00
|
|
|
include("mapgen_limits")
|
2019-02-23 22:48:39 -05:00
|
|
|
include("mapgen_shared")
|
2018-11-02 19:08:59 -04:00
|
|
|
|
2019-02-04 20:15:33 -05:00
|
|
|
include("item_on_register")
|
|
|
|
include("item_drop_in_place")
|
|
|
|
include("item_oldnames")
|
|
|
|
include("item_tool_wears_to")
|
2019-04-01 00:39:30 -04:00
|
|
|
include("item_tool_sounds")
|
2019-03-14 21:48:29 -04:00
|
|
|
include("item_punch_sounds")
|
2019-12-07 22:24:09 -05:00
|
|
|
include("item_nodebox_zfighting")
|
2019-12-09 04:46:33 -05:00
|
|
|
include("item_virtual")
|
2019-12-09 07:51:53 -05:00
|
|
|
include("item_stackmax")
|
2020-03-29 07:55:54 -04:00
|
|
|
include("item_touch_hurt")
|
2020-04-05 20:35:51 -04:00
|
|
|
include("item_txp_overlay")
|
2020-04-20 08:15:53 -04:00
|
|
|
include("item_tiledump")
|