sorcery  Check-in [b24c5f49c7]

Overview
Comment:bug fixes, add spellshatter visuals, maybe finally defuckulate imbuement effect?
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b24c5f49c7a55b2fa03e5f202dbceb8e8fef5738c6553d62bba82c7ec5ba2896
User & Date: lexi on 2021-07-05 03:07:21
Other Links: manifest | tags
Context
2021-07-05
03:24
really unbreak imbue this time, also fix dumb rune bug check-in: f9d8ede806 user: lexi tags: trunk
03:07
bug fixes, add spellshatter visuals, maybe finally defuckulate imbuement effect? check-in: b24c5f49c7 user: lexi tags: trunk
01:02
remove debug statements durr check-in: 5fbd1ed57c user: lexi tags: trunk
Changes

Modified data/runes.lua from [7cffae6fa3] to [6661143040].

546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
...
600
601
602
603
604
605
606

607
608
609
610
611
612
613
614
615





































































































616
617
618
619
620
621
622
									}
								}
							end;
							[0.3] = function(s,te,tl)
								s.visual_caster {
									amount = 100 * s.duration, time = s.duration, glow = 14;
									texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
									minpos = { x = -0.1, y =  3.0, z = -0.1 };
									maxpos = { x =  0.1, y =  3.2, z =  0.1 };
									minvel = { x = -5.0, y = -0.5, z = -5.0 };
									maxvel = { x =  5.0, y =  0.5, z =  5.0 };
									minacc = { x = -0.4, y =  1.0, z = -0.4 };
									maxacc = { x =  0.4, y = -1.0, z =  0.4 };
									minexptime = 6, maxexptime = 6;
									minsize = 0.2, maxsize = 1.4;
									animation = {
................................................................................
				end;
				frame = {
					iridium = {
						name = 'Spellshatter';
						desc = 'Blast out a tidal wave of anti-magic that will nullify active spells, but also disenchant or destroy all magical items in range of its violently mundane grip';
						cast = function(ctx)
							local where = ctx.caster:get_pos()

							local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power))
							local who = {}
							local pfac = math.min(1, ctx.stats.power/8)
							for _, w in pairs(what) do
								if w:is_player() and w ~= ctx.caster then
									who[#who+1] = {player = w}
								end
							end
							if not next(who) then return false end





































































































						end;
					};
				};
			};
		}
	};
	repulse = {







|
|







 







>
|







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
									}
								}
							end;
							[0.3] = function(s,te,tl)
								s.visual_caster {
									amount = 100 * s.duration, time = s.duration, glow = 14;
									texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
									minpos = { x = -0.1, y =  4.0, z = -0.1 };
									maxpos = { x =  0.1, y =  4.2, z =  0.1 };
									minvel = { x = -5.0, y = -0.5, z = -5.0 };
									maxvel = { x =  5.0, y =  0.5, z =  5.0 };
									minacc = { x = -0.4, y =  1.0, z = -0.4 };
									maxacc = { x =  0.4, y = -1.0, z =  0.4 };
									minexptime = 6, maxexptime = 6;
									minsize = 0.2, maxsize = 1.4;
									animation = {
................................................................................
				end;
				frame = {
					iridium = {
						name = 'Spellshatter';
						desc = 'Blast out a tidal wave of anti-magic that will nullify active spells, but also disenchant or destroy all magical items in range of its violently mundane grip';
						cast = function(ctx)
							local where = ctx.caster:get_pos()
							local radius = 3 + (2*ctx.stats.power)
							local what = minetest.get_objects_inside_radius(where, radius)
							local who = {}
							local pfac = math.min(1, ctx.stats.power/8)
							for _, w in pairs(what) do
								if w:is_player() and w ~= ctx.caster then
									who[#who+1] = {player = w}
								end
							end
							--if not next(who) then return false end
							local h = ctx.heading.eyeheight*1.1
							local tex = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
							local epicenter = ctx.caster:get_pos() + vector.new(0, h/2, 0)
							local maxima = vector.new(radius, radius, radius)
							local potential_targets = minetest.find_nodes_in_area(epicenter - maxima, epicenter + maxima, {'group:sorcery_magical', 'group:sorcery_magitech'})
							local wreck = {}
							for _, pos in pairs(potential_targets) do
								if sorcery.lib.math.vdcomp(radius,epicenter,pos) then
									print('got wreckable at',pos)
									wreck[#wreck+1] = pos
								end
							end
							sorcery.spell.cast {
								name = 'sorcery:spellshatter';
								caster = ctx.caster;
								anchor = epicenter;
								--disjunction = true;
								--range = radius;
								duration = 10;
								timeline = {
									[0] = function(s)
										s.visual_caster {
											texture = tex;
											amount = 100, time = 0.2;
											minpos = { x = -0.1, y = -0.5, z = -0.1 };
											maxpos = { x =  0.1, y =  h,   z =  0.1 };
											minvel = { x = -10.0, y = -0.0, z = -10.0 };
											maxvel = { x =  10.0, y =  0.0, z =  10.0 };
											minexptime = 3, maxexptime = 3;
											minsize = 5, maxsize = 8;
											animation = {
												type = 'vertical_frames', length = (21/6) + 0.1;
												aspect_w = 16, aspect_h = 16;
											}
										}
										s.visual_caster {
											texture = tex;
											amount = 5000, time = 2;
											minpos = { x = -0.1, y = -0.5, z = -0.1 };
											maxpos = { x =  0.1, y =  h,   z =  0.1 };
											minvel = { x = -10.0, y = -0.0, z = -10.0 };
											maxvel = { x =  10.0, y =  0.0, z =  10.0 };
											minexptime = 3, maxexptime = 3;
											minsize = 0.7, maxsize = 2;
											animation = {
												type = 'vertical_frames', length = (21/6) + 0.1;
												aspect_w = 16, aspect_h = 16;
											}
										}
									end;
								};
								intervals = {
									{period = 0.1, after = 0.15, fn = function(c)
										print('interval running')
										for i = 1,80 do
											local life = 0.2 + math.random() * 2
											local dir = vector.new(math.random()-0.5,0,math.random()-0.5):normalize()
											local pos = epicenter + (dir * (math.random()*radius))
											print('setting particle at',pos)
											minetest.add_particle {
												texture = tex;
												pos = pos;
												expirationtime = life;
												velocity = {x = 0, y = math.random() * 0.3 + 0.1, z = 0};
												size = 0.4 + math.random() * 3;
												glow = 14;
												animation = {
													type = 'vertical_frames', length = math.random(1,3)/10;
													aspect_w = 16, aspect_h = 16;
												}
											}
										end
										if next(wreck) then
											local k,p = sorcery.lib.tbl.pick(wreck)

											minetest.add_particle {
												texture = sorcery.lib.image('sorcery_sparking.png'):glow(sorcery.lib.color(255,0,0)):render();
												pos = vector.offset(p,math.random(),math.random(),math.random());
												expirationtime = 1;
												size = 5 + math.random() * 4;
												glow = 14;
												animation = {
													type = 'vertical_frames', length = 0.3;
													aspect_w = 64, aspect_h = 64;
												}
											}
											minetest.add_particle {
												texture = sorcery.lib.image('sorcery_crackle.png'):glow(sorcery.lib.color(255,0,0)):render();
												pos = vector.offset(p,math.random(),math.random(),math.random());
												expirationtime = 1;
												size = 4 + math.random() * 6;
												glow = 14;
												animation = {
													type = 'vertical_frames', length = 0.6;
													aspect_w = 64, aspect_h = 64;
												}
											}
										end
									end};
								};
							}
						end;
					};
				};
			};
		}
	};
	repulse = {

Modified lib/math.lua from [80f52c4aaf] to [4d5bf7109c].

1
2
3
4
5
6
7
8
9
10
11
12
13
local fn = {}

fn.vsep = function(vec) -- separate a vector into a direction + magnitude
	local magnitude = math.max(math.abs(vec.x), math.abs(vec.y), math.abs(vec.z))
	local inv = 1 / magnitude
	return vector.multiply(vec,inv), magnitude
end

fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
	-- (cheaper than calculating distance outright)
	local d if v2
		then d = vector.subtract(v1,v2)
		else d = v1



|
<
<







1
2
3
4


5
6
7
8
9
10
11
local fn = {}

fn.vsep = function(vec) -- separate a vector into a direction + magnitude
	return vec:normalize(), vec:length()


end

fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
	-- (cheaper than calculating distance outright)
	local d if v2
		then d = vector.subtract(v1,v2)
		else d = v1

Modified recipes.lua from [8dde1ca421] to [993e34739f].

254
255
256
257
258
259
260

261
262
263
264
265
266
267
end

minetest.register_craftitem('sorcery:inferno_crystal', {
	-- made with melding wand from ruby, lithium ingot, and gunpowder
	-- under sign of the wyvern or the winged serpent
	inventory_image = 'sorcery_inferno_crystal.png';
	description = 'Inferno Crystal';

	_sorcery = {
		material = {
			gem = true;
			sacrifice_value = 900;
		};
	}
})







>







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
end

minetest.register_craftitem('sorcery:inferno_crystal', {
	-- made with melding wand from ruby, lithium ingot, and gunpowder
	-- under sign of the wyvern or the winged serpent
	inventory_image = 'sorcery_inferno_crystal.png';
	description = 'Inferno Crystal';
	groups = {sorcery_magical = 1, fuel = 1};
	_sorcery = {
		material = {
			gem = true;
			sacrifice_value = 900;
		};
	}
})

Modified spell.lua from [4f39d5643f] to [a858b6f5bf].

217
218
219
220
221
222
223

224
225
226
227
228
229
230
231
232
233
234
		for _,f in pairs(s.impacts) do if f.subject == t then f.effect:stop() end end
		for _,f in pairs(s.vfx) do
			if f.subject == t then minetest.delete_particlespawner(f.handle) end
		end
		s.subjects[si] = nil
	end
	local interpret_timespec = function(when)

		local t if type(when) == 'number' then
			t = s.duration * when
		else
			t = (s.duration * (when.whence or 0)) + when.secs
		end
		if t then return math.min(s.duration,math.max(0,t)) end

		log.err('invalid timespec ' .. dump(when))
		return 0
	end
	s.queue = function(when,fn)







>



|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
		for _,f in pairs(s.impacts) do if f.subject == t then f.effect:stop() end end
		for _,f in pairs(s.vfx) do
			if f.subject == t then minetest.delete_particlespawner(f.handle) end
		end
		s.subjects[si] = nil
	end
	local interpret_timespec = function(when)
		if when == nil then return 0 end
		local t if type(when) == 'number' then
			t = s.duration * when
		else
			t = (s.duration * (when.whence or 0)) + (when.secs or 0)
		end
		if t then return math.min(s.duration,math.max(0,t)) end

		log.err('invalid timespec ' .. dump(when))
		return 0
	end
	s.queue = function(when,fn)

Modified vfx.lua from [48046fb0bd] to [d83b2a6c69].

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
			pos = ppos;
			velocity = vector.multiply(dir,vel);
			expirationtime = far / vel;
			size = math.random()*2.4 + 0.6;
			texture = sorcery.lib.image('sorcery_sputter.png'):glow(col):render();
			glow = 14;
			animation = {
				type = 'vertical_frames', length = far/vel;
				aspect_w = 16, aspect_h = 16;
			};
		}
	end
end

function sorcery.vfx.drip(liquid, noz, amt, time, exp)
	if type(liquid) == 'string' then liquid = sorcery.register.liquid.db[liquid] end







|
|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
			pos = ppos;
			velocity = vector.multiply(dir,vel);
			expirationtime = far / vel;
			size = math.random()*2.4 + 0.6;
			texture = sorcery.lib.image('sorcery_sputter.png'):glow(col):render();
			glow = 14;
			animation = {
				type = 'vertical_frames', length = math.floor((far/vel)*10)*.10;
				aspect_w = 16, aspect_h = 16
			};
		}
	end
end

function sorcery.vfx.drip(liquid, noz, amt, time, exp)
	if type(liquid) == 'string' then liquid = sorcery.register.liquid.db[liquid] end