sorcery  Diff

Differences From Artifact [8532b8e5fe]:

To Artifact [c6bfabb8a9]:


   158    158   	minetest.register_node(id, {
   159    159   		description = 'Half-' .. b[1] .. ' Conduit';
   160    160   		paramtype2 = 'facedir';
   161    161   		groups = {
   162    162   			cracky = 2;
   163    163   			choppy = 1;
   164    164   			sorcery_ley_device = 1;
   165         -			sorcery_ley_conduit = 1;
   166    165   		};
   167    166   		_sorcery = {
   168    167   			ley = { mode = 'signal'; power = 5; }
   169    168   		};
   170    169   		tiles = tiles;
   171    170   	})
   172    171   	minetest.register_craft {
................................................................................
   207    206   			drawtype = 'nodebox';
   208    207   			groups = {
   209    208   				sorcery_ley_device = 1; snappy = 3; attached = 1;
   210    209   				sorcery_ley_cable = 1;
   211    210   			};
   212    211   			_sorcery = {
   213    212   				ley = { mode = 'signal', power = metal.conduct };
          213  +				recipe = { note = 'Conducts up to ' .. metal.conduct .. ' thaum/sec'; };
   214    214   			};
   215    215   			sunlight_propagates = true;
   216    216   			node_box = {
   217    217   				type = 'connected';
   218    218   				disconnected   = { -0.05, -0.35, -0.40; 0.05, -0.25, 0.40 };
   219    219   				connect_front  = { -0.05, -0.35, -0.50; 0.05, -0.25, 0.05 };
   220    220   				connect_back   = { -0.05, -0.35, -0.05; 0.05, -0.25, 0.50 };
................................................................................
   305    305   			'default_stone.png';
   306    306   			'default_copper_block.png';
   307    307   			emerald:render();
   308    308   		};
   309    309   		groups = {
   310    310   			cracky = 2;
   311    311   			sorcery_ley_device = 1;
          312  +			sorcery_magitech = 1;
   312    313   		};
   313    314   		on_construct = function(pos)
   314    315   			local meta = minetest.get_meta(pos)
   315    316   			meta:set_string('infotext','Condenser')
   316    317   		end;
   317    318   		_sorcery = {
   318    319   			ley = { mode = 'produce';
................................................................................
   374    375   				local sum = vector.add(pos,p)
   375    376   				if not foundp(sum) then
   376    377   					checked[#checked + 1] = sum
   377    378   					local nodename = minetest.get_node(sum).name
   378    379   					if nodename == 'ignore' then
   379    380   						minetest.load_area(sum)
   380    381   						nodename = minetest.get_node(sum).name
          382  +						print('**** ignorenode, loaded',nodename)
   381    383   					end
   382    384   					if minetest.get_item_group(nodename,'sorcery_ley_device') ~= 0
   383    385   					   or sorcery.data.compat.ley[nodename] then
   384    386   						local d = sorcery.ley.sample(pos,1,nodename,{query={mode=true}})
   385    387   						assert(d.mode == 'signal'
   386    388   						    or d.mode == 'consume'
   387    389   						    or d.mode == 'produce')
................................................................................
   485    487   	meta:set_string('sorcery:ley',sorcery.ley.encode(l))
   486    488   end
   487    489   
   488    490   sorcery.ley.sample = function(pos,timespan,name,flags)
   489    491   	-- returns how much ley-force can be transmitted by a
   490    492   	-- device over timespan
   491    493   	local ret = {}
          494  +	minetest.load_area(pos)
   492    495   	name = name or minetest.get_node(pos).name
   493    496   	flags = flags or {}
   494    497   	flags.query = flags.query or {
   495    498   		mode = true; power = true; affinity = true;
   496    499   		minpower = true; maxpower = true;
   497    500   	}
   498    501   	local props = minetest.registered_nodes[name]._sorcery
................................................................................
   561    564   	if ret.power then
   562    565   		if flags.query.minpower and not ret.minpower then ret.minpower = power end
   563    566   		if flags.query.maxpower and not ret.maxpower then ret.maxpower = power end
   564    567   	end
   565    568   	return ret
   566    569   end
   567    570   
   568         -sorcery.ley.netcaps = function(pos,timespan,exclude)
   569         -	local net = sorcery.ley.mapnet(pos)
          571  +sorcery.ley.netcaps = function(pos,timespan,exclude,minconduct)
          572  +	local net = sorcery.ley.mapnet(pos,minconduct)
   570    573   	local maxpower = 0
   571    574   	local freepower = 0
   572    575   	local affs,usedaffs = {},{}
   573    576   	local flexpowerdevs = {}
   574    577   	local devself
   575    578   	for _,n in pairs(net.devices.produce) do
   576    579   		if vector.equals(pos,n.pos) then devself = n end