mirror of
https://github.com/minetest-mods/technic.git
synced 2025-07-01 07:40:37 +02:00
Partial rewrite
This commit is contained in:
@ -4,26 +4,25 @@
|
||||
|
||||
technic = {}
|
||||
|
||||
local load_start = os.clock()
|
||||
local modpath = minetest.get_modpath("technic")
|
||||
|
||||
technic.modpath = modpath
|
||||
|
||||
technic.dprint = function(string)
|
||||
if technic.DBG == 1 then
|
||||
print(string)
|
||||
end
|
||||
end
|
||||
|
||||
--Read technic config file
|
||||
-- Read configuration file
|
||||
dofile(modpath.."/config.lua")
|
||||
--helper functions
|
||||
|
||||
-- Helper functions
|
||||
dofile(modpath.."/helpers.lua")
|
||||
|
||||
--items
|
||||
-- Items
|
||||
dofile(modpath.."/items.lua")
|
||||
|
||||
-- Craft recipes for items
|
||||
dofile(modpath.."/crafts.lua")
|
||||
|
||||
-- Register functions
|
||||
dofile(modpath.."/register_machine_and_tool.lua")
|
||||
dofile(modpath.."/register.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(modpath.."/machines/init.lua")
|
||||
@ -31,24 +30,31 @@ dofile(modpath.."/machines/init.lua")
|
||||
-- Tools
|
||||
dofile(modpath.."/tools/init.lua")
|
||||
|
||||
function has_locked_chest_privilege(meta, player)
|
||||
if player:get_player_name() ~= meta:get_string("owner") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
-- Aliases for legacy node/item names
|
||||
dofile(modpath.."/legacy.lua")
|
||||
|
||||
function has_locked_chest_privilege(meta, player)
|
||||
if player:get_player_name() ~= meta:get_string("owner") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Swap nodes out. Return the node name.
|
||||
function hacky_swap_node(pos,name)
|
||||
local node = minetest.env:get_node(pos)
|
||||
if node.name ~= name then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta0 = meta:to_table()
|
||||
node.name = name
|
||||
minetest.env:set_node(pos,node)
|
||||
meta = minetest.env:get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end
|
||||
return node.name
|
||||
function hacky_swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name ~= name then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta_table = meta:to_table()
|
||||
node.name = name
|
||||
minetest.set_node(pos, node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta_table)
|
||||
end
|
||||
return node.name
|
||||
end
|
||||
|
||||
if minetest.setting_get("log_mod") then
|
||||
print("[Technic] Loaded in "..tostring(os.clock() - load_start).."s")
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user