sorcery  Check-in [65759dbfde]

Overview
Comment:updates
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 65759dbfde9defcb84d6999c9836b777cbdaa996403529e4cdcf87e18ba77cb0
User & Date: lexi on 2020-08-30 22:47:46
Other Links: manifest | tags
Context
2020-09-24
23:07
add blood god, add gravitator, add hand-drawn ore images, add mana hud display for enchanted items, various tweaks and enhancements check-in: f165d9e39f user: lexi tags: trunk
2020-08-30
22:47
updates check-in: 65759dbfde user: lexi tags: trunk
14:46
rename improperly namespaced files check-in: 76581a64d9 user: lexi tags: trunk
Changes

Modified compat.lua from [b94ab7bfcd] to [c2cb3e762c].

32
33
34
35
36
37
38





39
40
41
42
43
44
else
	minetest.register_craftitem('sorcery:ash', {
		description = 'Ash';
		inventory_image = 'sorcery_iron_powder.png^[colorize:#FFFFFF:100';
	})
	minetest.register_alias('new_campfire:ash', 'sorcery:ash')
end






return {
	defp = function(name)
		return minetest.registered_items[name] or minetest.registered_aliases[name]
	end;
}







>
>
>
>
>






32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
else
	minetest.register_craftitem('sorcery:ash', {
		description = 'Ash';
		inventory_image = 'sorcery_iron_powder.png^[colorize:#FFFFFF:100';
	})
	minetest.register_alias('new_campfire:ash', 'sorcery:ash')
end

-- xdecor offers a conflicting and somewhat poorly designed enchantment
-- mechanism; make it inaccessible but don't fuck up already existing
-- enchanters in the world
minetest.clear_craft { output='xdecor:enchanter'; }

return {
	defp = function(name)
		return minetest.registered_items[name] or minetest.registered_aliases[name]
	end;
}

Modified displacer.lua from [54869bc440] to [e06af858b3].

309
310
311
312
313
314
315
316







317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
			on_construct = m.construct;
			on_rightclick = mode ~= 'gem' and n.button or nil;
			on_punch = n.button and function(pos,node,puncher)
				if puncher and puncher:get_wielded_item():is_empty() then
					n.button(pos)
				end
			end or nil;
			after_place_node = function(...) autoselect(...) end;







			allow_metadata_inventory_put = m.allowput;
			_sorcery = {
				attune = (mode == 'attune') and n.attune or nil;
			};
			after_dig_node = function(...)
				autoselect(...)
				sorcery.lib.node.purge_container(...)

			end;
			groups = {
				cracky = 2;
				sorcery_magitech = 1;
			};
		})
	end
end







|
>
>
>
>
>
>
>







>








309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
			on_construct = m.construct;
			on_rightclick = mode ~= 'gem' and n.button or nil;
			on_punch = n.button and function(pos,node,puncher)
				if puncher and puncher:get_wielded_item():is_empty() then
					n.button(pos)
				end
			end or nil;
			after_place_node = function(...)
				autoselect(...)
				-- these are not ley devices but they still affect the
				-- energy consumption of the ley device they are attached
				-- to, so we need to manually run the notification routine
				-- when they are placed or dug
				sorcery.ley.notify(...)
			end;
			allow_metadata_inventory_put = m.allowput;
			_sorcery = {
				attune = (mode == 'attune') and n.attune or nil;
			};
			after_dig_node = function(...)
				autoselect(...)
				sorcery.lib.node.purge_container(...)
				sorcery.lib.node.notifyneighbors(...)
			end;
			groups = {
				cracky = 2;
				sorcery_magitech = 1;
			};
		})
	end
end

Modified enchanter.lua from [cca22cad27] to [59f5727496].

301
302
303
304
305
306
307




308
309
310
311
312
313
314
...
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
for i=1,10 do
	minetest.register_node('sorcery:air_flash_' .. i, {
		drawtype = 'airlike';
		pointable = false; walkable = false;
		buildable_to = true;
		sunlight_propagates = true;
		light_source = i + 4;




		on_construct = function(pos)
			minetest.get_node_timer(pos):start(0.05)
		end;
		on_timer = function(pos)
			if i <= 2 then minetest.remove_node(pos) else
				minetest.set_node(pos, {name='sorcery:air_flash_1'})
				return true
................................................................................
	else
		sorcery.enchant.set(tool,ench,true)
	end
	puncher:set_wielded_item(tool)

	-- perform leyline checks and call notify if necessary
	if minetest.get_item_group(node.name, 'sorcery_ley_device') ~= 0 then
		for _,p in pairs(sorcery.ley.txofs) do
			local sum = vector.add(pos,p)
			if minetest.get_item_group(minetest.get_node(sum).name, 'sorcery_ley_device') ~= 0 then
				sorcery.ley.notify(sum)
			end
		end
	end
end)

minetest.register_chatcommand('enchants', {
	description = 'Log information about the currently held object\'s enchantment';
	privs = { server = true };
	func = function(caller,params)







>
>
>
>







 







|
<
<
<
<
<







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
420
421
422
423
424
425
426
427





428
429
430
431
432
433
434
for i=1,10 do
	minetest.register_node('sorcery:air_flash_' .. i, {
		drawtype = 'airlike';
		pointable = false; walkable = false;
		buildable_to = true;
		sunlight_propagates = true;
		light_source = i + 4;
		groups = {
			air = 1, sorcery_air = 1;
			not_in_creative_inventory = 1;
		};
		on_construct = function(pos)
			minetest.get_node_timer(pos):start(0.05)
		end;
		on_timer = function(pos)
			if i <= 2 then minetest.remove_node(pos) else
				minetest.set_node(pos, {name='sorcery:air_flash_1'})
				return true
................................................................................
	else
		sorcery.enchant.set(tool,ench,true)
	end
	puncher:set_wielded_item(tool)

	-- perform leyline checks and call notify if necessary
	if minetest.get_item_group(node.name, 'sorcery_ley_device') ~= 0 then
		sorcery.lib.node.notifyneighbors(pos)





	end
end)

minetest.register_chatcommand('enchants', {
	description = 'Log information about the currently held object\'s enchantment';
	privs = { server = true };
	func = function(caller,params)

Modified lib/node.lua from [ea0569acf8] to [3ae145b117].

88
89
90
91
92
93
94
95






























				end
			end
			checked[#checked+1] = pos
			i = i + 1
		until i > #stack
		return nodes, positions
	end;
}





































|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
				end
			end
			checked[#checked+1] = pos
			i = i + 1
		until i > #stack
		return nodes, positions
	end;

	forneighbor = function(pos, n, fn)
		for _,p in pairs(n) do
			local sum = vector.add(pos, p)
			fn(sum, minetest.get_node(sum))
		end
	end;

	-- when items have already been removed; notify cannot be relied on
	-- to reach the entire network; this function accounts for the gap
	notifyneighbors = function(pos)
		sorcery.lib.node.forneighbor(pos, sorcery.ley.txofs, function(pos,node)
			if minetest.get_item_group(node.name,'sorcery_ley_device') ~= 0 then
				sorcery.ley.notify(sum)
			end
		end)
	end;

	blockpos = function(pos)
		return {
			x = math.floor(pos.x / 16);
			y = math.floor(pos.y / 16);
			z = math.floor(pos.z / 16);
		}
	end;

	preload = function(pos, user)
		minetest.load_area(pos)
		user:send_mapblock(sorcery.lib.node.blockpos(pos))
	end;
}

Modified portal.lua from [2352fa593a] to [5fb5b13994].

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
...
327
328
329
330
331
332
333

334
335
336
337
338
339
340
341
342
343
344

local portal_destination_evaluate = function(circuit,pos)
	-- evaluation of the local network occurs before this function
	-- is ever even called, so we only need to worry about the
	-- farcaster-related transmission costs
	for i,c in pairs(circuit) do
		if vector.equals(c.pos,pos) then
			print('found destination in circuit table',i,dump(c))
			-- the destination is listed in the circuit table
			for j,r in pairs(c.route) do
				local nc = sorcery.ley.netcaps(pos,1)
				print('checking route for sufficient energy to power farcasters', j, nc.freepower)
				if nc.freepower < constants.portal_jump_cost_per_farcaster then
					return false -- only one route to any given portal node
					-- will be listed in the circuit table, so bail early
					-- maybe in the future farcasters should charge up,
					-- and power should be deducted when they are used?
				end
			end
................................................................................
		end
	end
	return false
end

local portal_pick_destination = function(dev,circuit,partner)
	if partner then
		print('paired: evaluating partner')
		if portal_destination_evaluate(circuit,partner)
			then return partner end
		print('partner failed eval')
	end

	local scrambled = sorcery.lib.tbl.scramble(circuit)
	for i=1,#scrambled do
		print('evaluating destination',i,dump(scrambled[i]))
		if portal_destination_evaluate(circuit,scrambled[i].pos)
			then return scrambled[i].pos end
		print('eval failed')
	end
	print('no viable destinations in net')
end

-- minetest.register_lbm {
-- 	name = 'sorcery:activate_portals';
-- 	label = 'activate portals';
-- 	run_at_every_load = true;
-- 	nodenames = { 'sorcery:portal_node' };
................................................................................
					partner = tune.partner
					break
				end
			end
		end

		if cap.self.minpower ~= cap.self.powerdraw then
			print("not enough power")
			return true
		end

		-- clean out user table
		for name,user in pairs(portal_context.users) do
			if user and vector.equals(user.portal, pos) then
				local found = false
................................................................................
						user.time = 0
						user.portal = pos
					end
					local cap = sorcery.ley.netcaps(pos,delta)
					local jc = (constants.portal_jump_cost_local*delta)
					if not user.dest and cap.freepower >= jc  then
						user.dest = portal_pick_destination(dev,crc,partner)

					end
					if not user.dest then goto skippad else
						minetest.load_area(user.dest)
					end
					local fac = (user.time / constants.portal_jump_time);
					minetest.add_particlespawner {
						time = 1, amount = 100 + (fac * 200);
						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});







<



|







 







<


<




<


<

<







 







|







 







>

|
<
<







212
213
214
215
216
217
218

219
220
221
222
223
224
225
226
227
228
229
...
233
234
235
236
237
238
239

240
241

242
243
244
245

246
247

248

249
250
251
252
253
254
255
...
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
...
321
322
323
324
325
326
327
328
329
330


331
332
333
334
335
336
337

local portal_destination_evaluate = function(circuit,pos)
	-- evaluation of the local network occurs before this function
	-- is ever even called, so we only need to worry about the
	-- farcaster-related transmission costs
	for i,c in pairs(circuit) do
		if vector.equals(c.pos,pos) then

			-- the destination is listed in the circuit table
			for j,r in pairs(c.route) do
				local nc = sorcery.ley.netcaps(pos,1)
				-- print('checking route for sufficient energy to power farcasters', j, nc.freepower)
				if nc.freepower < constants.portal_jump_cost_per_farcaster then
					return false -- only one route to any given portal node
					-- will be listed in the circuit table, so bail early
					-- maybe in the future farcasters should charge up,
					-- and power should be deducted when they are used?
				end
			end
................................................................................
		end
	end
	return false
end

local portal_pick_destination = function(dev,circuit,partner)
	if partner then

		if portal_destination_evaluate(circuit,partner)
			then return partner end

	end

	local scrambled = sorcery.lib.tbl.scramble(circuit)
	for i=1,#scrambled do

		if portal_destination_evaluate(circuit,scrambled[i].pos)
			then return scrambled[i].pos end

	end

end

-- minetest.register_lbm {
-- 	name = 'sorcery:activate_portals';
-- 	label = 'activate portals';
-- 	run_at_every_load = true;
-- 	nodenames = { 'sorcery:portal_node' };
................................................................................
					partner = tune.partner
					break
				end
			end
		end

		if cap.self.minpower ~= cap.self.powerdraw then
			-- print("not enough power")
			return true
		end

		-- clean out user table
		for name,user in pairs(portal_context.users) do
			if user and vector.equals(user.portal, pos) then
				local found = false
................................................................................
						user.time = 0
						user.portal = pos
					end
					local cap = sorcery.ley.netcaps(pos,delta)
					local jc = (constants.portal_jump_cost_local*delta)
					if not user.dest and cap.freepower >= jc  then
						user.dest = portal_pick_destination(dev,crc,partner)
						sorcery.lib.node.preload(user.dest, u.object)
					end
					if not user.dest then goto skippad end


					local fac = (user.time / constants.portal_jump_time);
					minetest.add_particlespawner {
						time = 1, amount = 100 + (fac * 200);
						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});

Modified potions.lua from [f457c3868d] to [bf24fbd87b].

38
39
40
41
42
43
44

45
46
47
48
49
50
51
		sounds = default.node_sound_glass_defaults();
	}
	if extra then for k,v in pairs(extra) do node[k] = v end end
	if not node.groups then node.groups = {} end
	node.groups.dig_immediate = 3;
	node.groups.attached_node = 1;
	node.groups.vessel = 1;

	minetest.register_node("sorcery:"..name, node)
end

sorcery.register_oil = function(name,label,desc,color,imgvariant,extra)
	local image = 'xdecor_bowl.png^(sorcery_oil_' .. (imgvariant or 'dull') .. '.png^[colorize:'..tostring(color)..':140)'
	sorcery.data.register.infusion_leftover('sorcery:' .. name, 'xdecor:bowl')
	extra.description = label;







>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
		sounds = default.node_sound_glass_defaults();
	}
	if extra then for k,v in pairs(extra) do node[k] = v end end
	if not node.groups then node.groups = {} end
	node.groups.dig_immediate = 3;
	node.groups.attached_node = 1;
	node.groups.vessel = 1;
	node.groups.not_in_creative_inventory = 1;
	minetest.register_node("sorcery:"..name, node)
end

sorcery.register_oil = function(name,label,desc,color,imgvariant,extra)
	local image = 'xdecor_bowl.png^(sorcery_oil_' .. (imgvariant or 'dull') .. '.png^[colorize:'..tostring(color)..':140)'
	sorcery.data.register.infusion_leftover('sorcery:' .. name, 'xdecor:bowl')
	extra.description = label;

Modified tnodes.lua from [a23f444ae8] to [1f5f95dd4b].

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
		drawtype = 'airlike';
		light_source = 5 + math.ceil(i * (11/minetest.LIGHT_MAX));
		sunlight_propagates = true;
		buildable_to = true;
		pointable = false;
		walkable = false;
		floodable = true;
		groups = { air = 1; sorcery_air = 1; };
		on_construct = function(pos)
			local meta = minetest.get_meta(pos)
			meta:set_float('duration',10)
			meta:set_float('timeleft',10)
			meta:set_int('power',minetest.LIGHT_MAX)
			minetest.get_node_timer(pos):start(1)
		end;







|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
		drawtype = 'airlike';
		light_source = 5 + math.ceil(i * (11/minetest.LIGHT_MAX));
		sunlight_propagates = true;
		buildable_to = true;
		pointable = false;
		walkable = false;
		floodable = true;
		groups = { air = 1; sorcery_air = 1; not_in_creative_inventory = 1; };
		on_construct = function(pos)
			local meta = minetest.get_meta(pos)
			meta:set_float('duration',10)
			meta:set_float('timeleft',10)
			meta:set_int('power',minetest.LIGHT_MAX)
			minetest.get_node_timer(pos):start(1)
		end;

Modified wands.lua from [4ea63112cb] to [54442c247e].

408
409
410
411
412
413
414

415
416
417
418
419
420
421
			title = sorcery.wands.util.basename(kind);
			desc = sorcery.wands.util.basedesc(kind);
		};
		inventory_image = basis.img.whole:render();
		groups = {
			tool = 1;
			sorcery_wand = 1;

		};
		node_dig_prediction = "";
		on_use = wand_cast;
		on_secondary_use = function(stack,user,target)
			return wand_cast(stack,user,nil)
		end;
		-- on_place if we need to use rightclick







>







408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
			title = sorcery.wands.util.basename(kind);
			desc = sorcery.wands.util.basedesc(kind);
		};
		inventory_image = basis.img.whole:render();
		groups = {
			tool = 1;
			sorcery_wand = 1;
			not_in_creative_inventory = 1;
		};
		node_dig_prediction = "";
		on_use = wand_cast;
		on_secondary_use = function(stack,user,target)
			return wand_cast(stack,user,nil)
		end;
		-- on_place if we need to use rightclick