sorcery  global.lua at [aece454800]

File global.lua artifact 3ad50b0db8 part of check-in aece454800


-- 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;
}