sorcery  Check-in [a08f21c56c]

Overview
Comment:look i don't fucking remember okay
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a08f21c56c00148cff83a118fe0525e114e36fd7c90dd5456bdfdb8423f7ba1e
User & Date: lexi on 2021-06-23 09:31:24
Other Links: manifest | tags
Context
2021-06-24
07:15
add basic keg impl check-in: 9b8118877e user: lexi tags: trunk
2021-06-23
09:31
look i don't fucking remember okay check-in: a08f21c56c user: lexi tags: trunk
2021-04-21
01:32
ui tweaks, rework enchantment slightly check-in: 41fdb5b0b8 user: lexi tags: trunk
Changes

Modified data/compat.lua from [40f7d044df] to [e10c4cb361].

70
71
72
73
74
75
76


77

		['default:stone_with_iron'   ] = { id = 'steel',   metal = true };-- :/
		['default:stone_with_copper' ] = { id = 'copper',  metal = true };
		['default:stone_with_tin'    ] = { id = 'tin',     metal = true };
		['default:stone_with_gold'   ] = { id = 'gold',    metal = true };
		['default:stone_with_mese'   ] = { id = 'mese',    gem = true };
		['default:stone_with_diamond'] = { id = 'diamond', gem = true };
	};


}








>
>
|
>
70
71
72
73
74
75
76
77
78
79
80
		['default:stone_with_iron'   ] = { id = 'steel',   metal = true };-- :/
		['default:stone_with_copper' ] = { id = 'copper',  metal = true };
		['default:stone_with_tin'    ] = { id = 'tin',     metal = true };
		['default:stone_with_gold'   ] = { id = 'gold',    metal = true };
		['default:stone_with_mese'   ] = { id = 'mese',    gem = true };
		['default:stone_with_diamond'] = { id = 'diamond', gem = true };
	};
	residue = {
		['farming:hemp_oil'] = 'vessels:glass_bottle';
	};
}

Modified data/oils.lua from [1e67dfd074] to [dff1ef8974].

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
			'farming:peas';
			'farming:peas';
		};
	};
	luscious = {
		color = {10,255,10};
		mix = {
			'sorcery:extract_greengrass';
			'sorcery:extract_grape';

			'farming:cocoa_beans';
			'farming:sugar';
			'farming:sugar';
		};
	};
	luck = {
		color = {156,54,255};
		style = 'sparkle';
		mix = {
			'sorcery:extract_marram';
			'farming:hemp_leaf';
			'farming:hemp_oil';
			'xdecor:honey';
			'farming:salt';
			'farming:salt';
		};
	};
}







|
|
>











<






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
			'farming:peas';
			'farming:peas';
		};
	};
	luscious = {
		color = {10,255,10};
		mix = {
			'farming:hemp_oil';
			'farming:grapes';
			'farming:cocoa_beans';
			'farming:cocoa_beans';
			'farming:sugar';
			'farming:sugar';
		};
	};
	luck = {
		color = {156,54,255};
		style = 'sparkle';
		mix = {
			'sorcery:extract_marram';
			'farming:hemp_leaf';

			'xdecor:honey';
			'farming:salt';
			'farming:salt';
		};
	};
}

Modified data/runes.lua from [92db18c27d] to [b47d0e6fa4].

898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
...
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
....
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
									if sorcery.lib.node.is_clear(sum) then
										vp[#vp+1] = sum
									end
								end
								if #vp > 0 then npos=vp[math.random(#vp)] end
							end
							if npos then
								minetest.set_node(npos, minetest.get_node(ctx.target.under))
								if minetest.registered_nodes[ty].on_construct then
									minetest.registered_nodes[ty].on_construct(npos)
								end
								minetest.get_meta(npos):from_table(origmeta)
								return npos, true
							else
								local nstack = ItemStack(ty)
								nstack:get_meta():from_table(origmeta)
								local leftover = ctx.caster:get_inventory():add_item('main',nstack)
								if leftover and not leftover.is_empty() then
................................................................................
			};
		};
	};
	luminate = {
		name = 'Luminate';
		tone = {255,194,0};
		minpower = 1;
		rarity = 5;
		amulets = {
			luxite = {
				name = 'Glow';
				desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage';
				cast = function(ctx)
					local fac = (ctx.stats.power * 0.1)
					local radius = 2 + 5*fac
................................................................................
								if sorcery.lib.str.beginswith(minetest.get_node(n).name,'sorcery:air_glimmer_') then
									minetest.remove_node(n)
								end
							end
						end;
						intervals = {
							{period = period, after = {whence=0,secs=0.7}, fn = function(c)
								print('cycling!')
								for _,sub in pairs(c.spell.subjects) do
									local ox, oy, oz = math.random(-radius,radius),
													   math.random(-radius,radius),
													   math.random(-radius,radius)
									local pos = vector.offset(sub.player:get_pos(), ox,oy,oz)
									print('pos',minetest.pos_to_string(pos),'player',minetest.pos_to_string(sub.player:get_pos()))
									if sorcery.lib.node.is_air(pos) then
										print('is air!')
										local power = math.random(4,minetest.LIGHT_MAX)
										minetest.set_node(pos, {
											name = 'sorcery:air_glimmer_' .. tostring(power);
										})
										c.spell.nodes[#c.spell.nodes + 1] = pos
										local d = glowduration * (0.5 + math.random()*0.5)
										local m = minetest.get_meta(pos)
										m:set_float('duration', d)
										m:set_float('timeleft', d)
										m:set_int('power', power)
									else
										print('not air!', dump(minetest.get_node(pos)))
									end
								end
							end};
						};
					}
				end;
				iridium = {







|
|
|
|







 







|







 







<





|

<










|
|







898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
...
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
....
1013
1014
1015
1016
1017
1018
1019

1020
1021
1022
1023
1024
1025
1026

1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
									if sorcery.lib.node.is_clear(sum) then
										vp[#vp+1] = sum
									end
								end
								if #vp > 0 then npos=vp[math.random(#vp)] end
							end
							if npos then
								minetest.place_node(npos, minetest.get_node(ctx.target.under))
								-- if minetest.registered_nodes[ty].on_construct then
								-- 	minetest.registered_nodes[ty].on_construct(npos)
								-- end
								minetest.get_meta(npos):from_table(origmeta)
								return npos, true
							else
								local nstack = ItemStack(ty)
								nstack:get_meta():from_table(origmeta)
								local leftover = ctx.caster:get_inventory():add_item('main',nstack)
								if leftover and not leftover.is_empty() then
................................................................................
			};
		};
	};
	luminate = {
		name = 'Luminate';
		tone = {255,194,0};
		minpower = 1;
		rarity = 8;
		amulets = {
			luxite = {
				name = 'Glow';
				desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage';
				cast = function(ctx)
					local fac = (ctx.stats.power * 0.1)
					local radius = 2 + 5*fac
................................................................................
								if sorcery.lib.str.beginswith(minetest.get_node(n).name,'sorcery:air_glimmer_') then
									minetest.remove_node(n)
								end
							end
						end;
						intervals = {
							{period = period, after = {whence=0,secs=0.7}, fn = function(c)

								for _,sub in pairs(c.spell.subjects) do
									local ox, oy, oz = math.random(-radius,radius),
													   math.random(-radius,radius),
													   math.random(-radius,radius)
									local pos = vector.offset(sub.player:get_pos(), ox,oy,oz)
									-- print('pos',minetest.pos_to_string(pos),'player',minetest.pos_to_string(sub.player:get_pos()))
									if sorcery.lib.node.is_air(pos) then

										local power = math.random(4,minetest.LIGHT_MAX)
										minetest.set_node(pos, {
											name = 'sorcery:air_glimmer_' .. tostring(power);
										})
										c.spell.nodes[#c.spell.nodes + 1] = pos
										local d = glowduration * (0.5 + math.random()*0.5)
										local m = minetest.get_meta(pos)
										m:set_float('duration', d)
										m:set_float('timeleft', d)
										m:set_int('power', power)
									-- else
									-- 	print('not air!', dump(minetest.get_node(pos)))
									end
								end
							end};
						};
					}
				end;
				iridium = {

Modified enchanter.lua from [5ad2e81269] to [9c51c1ba24].

170
171
172
173
174
175
176

177
178
179

180

181

182
183
184
185
186
187
188
189
...
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
...
439
440
441
442
443
444
445
446

447
448
449
450
451
452
453
454
455
456
457
458
...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
	end
	sorcery.enchant.strength = function(stack,id)
		-- this functions should be used whenever you need to
		-- determine the power of a particular enchantment on
		-- an enchanted item.
		local e = sorcery.enchant.get(stack)
		local p = 0.0

		local slots = sorcery.matreg.lookup[stack:get_name()].data.slots
		-- TODO handle strength-boosting spells!
		for _,s in pairs(e.spells) do

			if s.id == id then p = p + ((s.boost * slots[s.slot].confluence)/10) end

		end

		return p
	end
	sorcery.enchant.stackup = function(stack)
		-- stack update function. this should be called whenever
		-- the enchantment status of a stack changes; it will
		-- alter/reset tool capabilities and tooltip as necessary
		local e = sorcery.enchant.get(stack)
		local meta = stack:get_meta()
................................................................................
	local material = sorcery.enchant.getsubj(tool)
	local totalcost = 0
	do local done = {} for _,sp in pairs(ench.spells) do
		if done[sp.id] then goto skip end
		done[sp.id] = true

		local data = sorcery.data.enchants[sp.id]
		local strength = sorcery.enchant.strength(tool,sp.id)
		local ch = math.random(1,100)
		local props = {
			fail = ch > sp.reliability;
			user = puncher;
			pos = pos;
			node = node;
			tool = tool;
................................................................................
			enchantment = ench;
			power = strength;
			spell = sp;
			sparks = sparks;
			cost = data.cost;
		} 
		if data.on_dig then data.on_dig(props) end
		if props.cost ~= 0 then totalcost = totalcost + math.max(1,math.floor(props.cost * strength)) end


		if ch > sp.reliability then goto skip end
		sparks[#sparks + 1] = {
			color = sorcery.lib.color(data.tone):brighten(1.1);
			count = strength * 7;
		}
	::skip::end end
	if totalcost > 0 then
		local conservation = math.floor(sorcery.enchant.strength(tool,'conserve') * 6)
		-- totalcost = totalcost - (totalcost * conservation)
		if conservation == 0 or math.random(conservation) == 1 then
			ench.energy = math.max(0,ench.energy - (totalcost - (material.data.energysource or 0)))
................................................................................
				};
				velocity = {
					x = range(-1.3,1.3);
					z = range(-1.3,1.3);
					y = range( 0.3,0.9);
				};
				expirationtime = life;
				size = range(0.5,1.5);
				texture = sorcery.lib.image('sorcery_spark.png'):multiply(s.color):render();
				glow = 14;
				animation = {
					type = "vertical_frames";
					aspect_w = 16;
					aspect_h = 16;
					length = life + 0.1;







>



>
|
>
|
>
|







 







|







 







|
>




|







 







|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
	end
	sorcery.enchant.strength = function(stack,id)
		-- this functions should be used whenever you need to
		-- determine the power of a particular enchantment on
		-- an enchanted item.
		local e = sorcery.enchant.get(stack)
		local p = 0.0
		local ct = 0
		local slots = sorcery.matreg.lookup[stack:get_name()].data.slots
		-- TODO handle strength-boosting spells!
		for _,s in pairs(e.spells) do
			if s.id == id then
				p = p + ((s.boost * slots[s.slot].confluence)/10)
				ct = ct + 1
			end
		end
		return p, ct
	end
	sorcery.enchant.stackup = function(stack)
		-- stack update function. this should be called whenever
		-- the enchantment status of a stack changes; it will
		-- alter/reset tool capabilities and tooltip as necessary
		local e = sorcery.enchant.get(stack)
		local meta = stack:get_meta()
................................................................................
	local material = sorcery.enchant.getsubj(tool)
	local totalcost = 0
	do local done = {} for _,sp in pairs(ench.spells) do
		if done[sp.id] then goto skip end
		done[sp.id] = true

		local data = sorcery.data.enchants[sp.id]
		local strength, nsp = sorcery.enchant.strength(tool,sp.id)
		local ch = math.random(1,100)
		local props = {
			fail = ch > sp.reliability;
			user = puncher;
			pos = pos;
			node = node;
			tool = tool;
................................................................................
			enchantment = ench;
			power = strength;
			spell = sp;
			sparks = sparks;
			cost = data.cost;
		} 
		if data.on_dig then data.on_dig(props) end
		if props.cost ~= 0 then totalcost = totalcost + math.max(1,props.cost * nsp) --[[math.max(1,math.floor(props.cost * strength))]] end
		-- strength does not increase cost but number of spell slots occupied does -- incentive for the player to be more clever, less brute-force-y

		if ch > sp.reliability then goto skip end
		sparks[#sparks + 1] = {
			color = sorcery.lib.color(data.tone):brighten(1.1);
			count = strength * 8;
		}
	::skip::end end
	if totalcost > 0 then
		local conservation = math.floor(sorcery.enchant.strength(tool,'conserve') * 6)
		-- totalcost = totalcost - (totalcost * conservation)
		if conservation == 0 or math.random(conservation) == 1 then
			ench.energy = math.max(0,ench.energy - (totalcost - (material.data.energysource or 0)))
................................................................................
				};
				velocity = {
					x = range(-1.3,1.3);
					z = range(-1.3,1.3);
					y = range( 0.3,0.9);
				};
				expirationtime = life;
				size = range(0.2,1.5);
				texture = sorcery.lib.image('sorcery_spark.png'):multiply(s.color):render();
				glow = 14;
				animation = {
					type = "vertical_frames";
					aspect_w = 16;
					aspect_h = 16;
					length = life + 0.1;

Modified potions.lua from [2e6379fa76] to [0b5549f5e7].

1
2
3

4
5
6
7
8
9
10
local u = sorcery.lib
sorcery.registry.mk('infusions',false)
sorcery.registry.mk('residue',false)


sorcery.register_potion_tbl = function(tbl) -- :/
	return sorcery.register_potion(tbl.name,tbl.label,tbl.desc,tbl.color,tbl.imgvariant,tbl.glow,tbl.extra)
end
sorcery.register_potion = function(name,label,desc,color,imgvariant,glow,extra)
	local image = 'sorcery_liquid_'..(imgvariant or 'dull')..'.png' .. 
		'^[multiply:'..tostring(color)..



>







1
2
3
4
5
6
7
8
9
10
11
local u = sorcery.lib
sorcery.registry.mk('infusions',false)
sorcery.registry.mk('residue',false)
sorcery.register.residue.meld(sorcery.data.compat.residue)

sorcery.register_potion_tbl = function(tbl) -- :/
	return sorcery.register_potion(tbl.name,tbl.label,tbl.desc,tbl.color,tbl.imgvariant,tbl.glow,tbl.extra)
end
sorcery.register_potion = function(name,label,desc,color,imgvariant,glow,extra)
	local image = 'sorcery_liquid_'..(imgvariant or 'dull')..'.png' .. 
		'^[multiply:'..tostring(color)..

Modified registration.lua from [d98f045dad] to [8bf4e2559c].

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
		end
		db[key] = value
		for id in pairs(dat.iters) do 
			reg.invoke(id,key)
		end
	end
	reg.meld = function(tbl)
		for k,v in pairs(tbl) do reg.add(k,v) end
	end
	sorcery.register[name] = reg

	local nextfn = sorcery.registry.defercheck
	sorcery.registry.defercheck = function()
		if #dat.defer ~= 0 then
			print('WARNING: ' .. tostring(#dat.defer) .. ' deferred iterator(s) have not yet been discharged for registry “' .. name .. '”')







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
		end
		db[key] = value
		for id in pairs(dat.iters) do 
			reg.invoke(id,key)
		end
	end
	reg.meld = function(tbl)
		for k,v in pairs(tbl) do reg.link(k,v) end
	end
	sorcery.register[name] = reg

	local nextfn = sorcery.registry.defercheck
	sorcery.registry.defercheck = function()
		if #dat.defer ~= 0 then
			print('WARNING: ' .. tostring(#dat.defer) .. ' deferred iterator(s) have not yet been discharged for registry “' .. name .. '”')

Modified vfx.lua from [d0158e43bb] to [8567a33693].

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
sorcery.vfx.imbue = function(color, target, strength, height)
	local tpos if target.get_pos then
		tpos = target:get_pos()
		if target.get_properties then
			height = height or ((target:get_properties().eye_height or 1)*1.3)
		end
	else
		tpos = target
	end
	height = height or 1
	local scenter = vector.add(tpos, {x=0,y=height/2,z=0})
	for i=1,math.random(64*(strength or 1),128*(strength or 1)) do
		local high = (height+0.8)*math.random() - 0.8
		local far = (high >= -0.5 and high <= height) and
			(math.random() * 0.3 + 0.4) or
			(math.random() * 0.5)
		local yaw = {x=0, y = math.random()*(2*math.pi), z=0}
		local po = vector.rotate({x=far,y=high,z=0}, yaw)
		local ppos = vector.add(po,tpos)







|



|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
sorcery.vfx.imbue = function(color, target, strength, height)
	local tpos if target.get_pos then
		tpos = target:get_pos()
		if target.get_properties then
			height = height or ((target:get_properties().eye_height or 1)*1.3)
		end
	else
		tpos = vector.offset(target, 0,0.5,0)
	end
	height = height or 1
	local scenter = vector.add(tpos, {x=0,y=height/2,z=0})
	for i=1,math.random(24*(strength or 1),32*(strength or 1)) do
		local high = (height+0.8)*math.random() - 0.8
		local far = (high >= -0.5 and high <= height) and
			(math.random() * 0.3 + 0.4) or
			(math.random() * 0.5)
		local yaw = {x=0, y = math.random()*(2*math.pi), z=0}
		local po = vector.rotate({x=far,y=high,z=0}, yaw)
		local ppos = vector.add(po,tpos)