sorcery  Diff

Differences From Artifact [8532b8e5fe]:

To Artifact [c6bfabb8a9]:


158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
...
207
208
209
210
211
212
213

214
215
216
217
218
219
220
...
305
306
307
308
309
310
311

312
313
314
315
316
317
318
...
374
375
376
377
378
379
380

381
382
383
384
385
386
387
...
485
486
487
488
489
490
491

492
493
494
495
496
497
498
...
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
	minetest.register_node(id, {
		description = 'Half-' .. b[1] .. ' Conduit';
		paramtype2 = 'facedir';
		groups = {
			cracky = 2;
			choppy = 1;
			sorcery_ley_device = 1;
			sorcery_ley_conduit = 1;
		};
		_sorcery = {
			ley = { mode = 'signal'; power = 5; }
		};
		tiles = tiles;
	})
	minetest.register_craft {
................................................................................
			drawtype = 'nodebox';
			groups = {
				sorcery_ley_device = 1; snappy = 3; attached = 1;
				sorcery_ley_cable = 1;
			};
			_sorcery = {
				ley = { mode = 'signal', power = metal.conduct };

			};
			sunlight_propagates = true;
			node_box = {
				type = 'connected';
				disconnected   = { -0.05, -0.35, -0.40; 0.05, -0.25, 0.40 };
				connect_front  = { -0.05, -0.35, -0.50; 0.05, -0.25, 0.05 };
				connect_back   = { -0.05, -0.35, -0.05; 0.05, -0.25, 0.50 };
................................................................................
			'default_stone.png';
			'default_copper_block.png';
			emerald:render();
		};
		groups = {
			cracky = 2;
			sorcery_ley_device = 1;

		};
		on_construct = function(pos)
			local meta = minetest.get_meta(pos)
			meta:set_string('infotext','Condenser')
		end;
		_sorcery = {
			ley = { mode = 'produce';
................................................................................
				local sum = vector.add(pos,p)
				if not foundp(sum) then
					checked[#checked + 1] = sum
					local nodename = minetest.get_node(sum).name
					if nodename == 'ignore' then
						minetest.load_area(sum)
						nodename = minetest.get_node(sum).name

					end
					if minetest.get_item_group(nodename,'sorcery_ley_device') ~= 0
					   or sorcery.data.compat.ley[nodename] then
						local d = sorcery.ley.sample(pos,1,nodename,{query={mode=true}})
						assert(d.mode == 'signal'
						    or d.mode == 'consume'
						    or d.mode == 'produce')
................................................................................
	meta:set_string('sorcery:ley',sorcery.ley.encode(l))
end

sorcery.ley.sample = function(pos,timespan,name,flags)
	-- returns how much ley-force can be transmitted by a
	-- device over timespan
	local ret = {}

	name = name or minetest.get_node(pos).name
	flags = flags or {}
	flags.query = flags.query or {
		mode = true; power = true; affinity = true;
		minpower = true; maxpower = true;
	}
	local props = minetest.registered_nodes[name]._sorcery
................................................................................
	if ret.power then
		if flags.query.minpower and not ret.minpower then ret.minpower = power end
		if flags.query.maxpower and not ret.maxpower then ret.maxpower = power end
	end
	return ret
end

sorcery.ley.netcaps = function(pos,timespan,exclude)
	local net = sorcery.ley.mapnet(pos)
	local maxpower = 0
	local freepower = 0
	local affs,usedaffs = {},{}
	local flexpowerdevs = {}
	local devself
	for _,n in pairs(net.devices.produce) do
		if vector.equals(pos,n.pos) then devself = n end







<







 







>







 







>







 







>







 







>







 







|
|







158
159
160
161
162
163
164

165
166
167
168
169
170
171
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
...
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
...
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
	minetest.register_node(id, {
		description = 'Half-' .. b[1] .. ' Conduit';
		paramtype2 = 'facedir';
		groups = {
			cracky = 2;
			choppy = 1;
			sorcery_ley_device = 1;

		};
		_sorcery = {
			ley = { mode = 'signal'; power = 5; }
		};
		tiles = tiles;
	})
	minetest.register_craft {
................................................................................
			drawtype = 'nodebox';
			groups = {
				sorcery_ley_device = 1; snappy = 3; attached = 1;
				sorcery_ley_cable = 1;
			};
			_sorcery = {
				ley = { mode = 'signal', power = metal.conduct };
				recipe = { note = 'Conducts up to ' .. metal.conduct .. ' thaum/sec'; };
			};
			sunlight_propagates = true;
			node_box = {
				type = 'connected';
				disconnected   = { -0.05, -0.35, -0.40; 0.05, -0.25, 0.40 };
				connect_front  = { -0.05, -0.35, -0.50; 0.05, -0.25, 0.05 };
				connect_back   = { -0.05, -0.35, -0.05; 0.05, -0.25, 0.50 };
................................................................................
			'default_stone.png';
			'default_copper_block.png';
			emerald:render();
		};
		groups = {
			cracky = 2;
			sorcery_ley_device = 1;
			sorcery_magitech = 1;
		};
		on_construct = function(pos)
			local meta = minetest.get_meta(pos)
			meta:set_string('infotext','Condenser')
		end;
		_sorcery = {
			ley = { mode = 'produce';
................................................................................
				local sum = vector.add(pos,p)
				if not foundp(sum) then
					checked[#checked + 1] = sum
					local nodename = minetest.get_node(sum).name
					if nodename == 'ignore' then
						minetest.load_area(sum)
						nodename = minetest.get_node(sum).name
						print('**** ignorenode, loaded',nodename)
					end
					if minetest.get_item_group(nodename,'sorcery_ley_device') ~= 0
					   or sorcery.data.compat.ley[nodename] then
						local d = sorcery.ley.sample(pos,1,nodename,{query={mode=true}})
						assert(d.mode == 'signal'
						    or d.mode == 'consume'
						    or d.mode == 'produce')
................................................................................
	meta:set_string('sorcery:ley',sorcery.ley.encode(l))
end

sorcery.ley.sample = function(pos,timespan,name,flags)
	-- returns how much ley-force can be transmitted by a
	-- device over timespan
	local ret = {}
	minetest.load_area(pos)
	name = name or minetest.get_node(pos).name
	flags = flags or {}
	flags.query = flags.query or {
		mode = true; power = true; affinity = true;
		minpower = true; maxpower = true;
	}
	local props = minetest.registered_nodes[name]._sorcery
................................................................................
	if ret.power then
		if flags.query.minpower and not ret.minpower then ret.minpower = power end
		if flags.query.maxpower and not ret.maxpower then ret.maxpower = power end
	end
	return ret
end

sorcery.ley.netcaps = function(pos,timespan,exclude,minconduct)
	local net = sorcery.ley.mapnet(pos,minconduct)
	local maxpower = 0
	local freepower = 0
	local affs,usedaffs = {},{}
	local flexpowerdevs = {}
	local devself
	for _,n in pairs(net.devices.produce) do
		if vector.equals(pos,n.pos) then devself = n end