sorcery  global.lua at tip

File global.lua from the latest check-in


-- abuses the engine to provide additional generic features useful to multiple units
local log = sorcery.logger 'global'

minetest.register_lbm {
	name = 'sorcery:activate_nodes';
	label = 'trigger instantiation-time callbacks';
	nodenames = { 'group:sorcery_instantiate' };
	run_at_every_load = true;
	action = function(pos,node)
		local s = minetest.registered_nodes[node.name]._sorcery
		if not s or not s.on_load then
			log.errf('node type "%s" marked for instantiation-time callback, but no callback specified', node.name)
			return
		end

		s.on_load(pos,node)
	end;
}