92 lines
2.4 KiB
Lua
Raw Normal View History

-- LUALOCALS < ---------------------------------------------------------
2019-03-02 19:35:36 -05:00
-- SKIP: include nodecore
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
-- LUALOCALS > ---------------------------------------------------------
2019-01-12 20:46:56 -05:00
local nodecore = rawget(_G, "nodecore") or {}
rawset(_G, "nodecore", nodecore)
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)
nodecore.product = "NodeCore"
2019-02-04 20:15:33 -05:00
nodecore.version = include("version")
local function callguard(n, t, k, v)
if type(v) ~= "function" then return v end
return function(first, ...)
if first == t then
error("called " .. n .. ":" .. k .. "() instead of " .. n .. "." .. k .. "()")
end
return v(first, ...)
end
end
for k, v in pairs(minetest) do
minetest[k] = callguard("minetest", minetest, k, v)
end
setmetatable(nodecore, {
__newindex = function(t, k, v)
rawset(nodecore, k, callguard("nodecore", t, k, v))
end
})
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)
include("compat_vector")
2019-10-13 09:38:07 -04:00
include("issue9043")
2019-02-04 20:15:33 -05:00
include("util_misc")
include("util_falling")
2019-02-04 20:15:33 -05:00
include("util_scan_flood")
include("util_node_is")
include("util_toolcaps")
include("util_stack")
include("util_phealth")
2019-03-05 23:05:56 -05:00
include("util_facedir")
include("util_sound")
include("util_translate")
include("util_ezschematic")
include("util_gametime")
include("util_settlescan")
2019-02-04 20:16:54 -05:00
include("match")
include("fx_digparticles")
include("register_mods")
2020-03-22 10:59:06 -04:00
include("mapgen_limits")
include("mapgen_shared")
2019-02-04 20:15:33 -05:00
include("item_on_register")
include("item_drop_in_place")
include("item_oldnames")
include("item_tool_break")
include("item_tool_sounds")
2019-03-14 21:48:29 -04:00
include("item_punch_sounds")
include("item_sound_pitch")
include("item_nodebox_zfighting")
include("item_virtual")
2019-12-09 07:51:53 -05:00
include("item_stackmax")
include("item_touch_hurt")
include("item_txp_overlay")
include("item_tiledump")