technic/technic/init.lua

85 lines
1.8 KiB
Lua
Raw Normal View History

2013-04-04 01:17:39 +02:00
-- namespace: technic
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
2013-01-27 14:03:46 +01:00
2023-12-20 12:24:29 +01:00
if not minetest.get_translator then
error("[technic] Your Minetest version is no longer supported."
.. " (version < 5.0.0)")
end
local load_start = os.clock()
technic = rawget(_G, "technic") or {}
technic.creative_mode = minetest.settings:get_bool("creative_mode")
2013-07-11 18:19:09 +02:00
local modpath = minetest.get_modpath("technic")
technic.modpath = modpath
2013-10-30 18:50:24 +01:00
-- Boilerplate to support intllib
if rawget(_G, "intllib") then
2015-02-08 13:45:13 +01:00
technic.getter = intllib.Getter()
else
-- Intllib copypasta: TODO replace with the client-side translation API
technic.getter = function(s,a,...)
if a==nil then return s end
a={a,...}
return s:gsub("(@?)@(%(?)(%d+)(%)?)", function(e,o,n,c)
if e==""then
return a[tonumber(n)]..(o==""and c or"")
end
return "@"..o..n..c
end)
end
2015-02-08 13:45:13 +01:00
end
local S = technic.getter
-- Check if mcl_core or default is installed
if not minetest.get_modpath("mcl_core") and not minetest.get_modpath("default") then
error(S(minetest.get_current_modname()).." "..S("requires mcl_core or default to be installed (please install MTG or MCL2, or compatible games)"))
end
2013-07-17 21:34:35 +02:00
-- Read configuration file
2013-01-27 14:03:46 +01:00
dofile(modpath.."/config.lua")
2013-07-17 21:34:35 +02:00
-- MineClone2 Support
dofile(modpath.."/mcl_support.lua")
dofile(modpath.."/mcl_craftguide.lua")
2013-07-17 21:34:35 +02:00
-- Helper functions
2013-02-21 22:01:49 +01:00
dofile(modpath.."/helpers.lua")
2013-01-27 14:03:46 +01:00
-- Items
2013-01-27 14:03:46 +01:00
dofile(modpath.."/items.lua")
-- Craft recipes for items
2013-07-17 21:34:35 +02:00
dofile(modpath.."/crafts.lua")
-- Register functions
2013-07-17 21:34:35 +02:00
dofile(modpath.."/register.lua")
-- Radiation
dofile(modpath.."/radiation.lua")
2013-07-11 18:19:09 +02:00
-- Machines
dofile(modpath.."/machines/init.lua")
2013-02-06 15:34:01 +01:00
2013-07-11 21:10:14 +02:00
-- Tools
dofile(modpath.."/tools/init.lua")
2013-07-17 21:34:35 +02:00
-- Aliases for legacy node/item names
dofile(modpath.."/legacy.lua")
if minetest.settings:get_bool("log_mods") then
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
2013-07-17 21:34:35 +02:00
end