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

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

     1      1   local fn = {}
     2      2   
     3      3   fn.vsep = function(vec) -- separate a vector into a direction + magnitude
     4         -	local magnitude = math.max(math.abs(vec.x), math.abs(vec.y), math.abs(vec.z))
     5         -	local inv = 1 / magnitude
     6         -	return vector.multiply(vec,inv), magnitude
            4  +	return vec:normalize(), vec:length()
     7      5   end
     8      6   
     9      7   fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
    10      8   	-- (cheaper than calculating distance outright)
    11      9   	local d if v2
    12     10   		then d = vector.subtract(v1,v2)
    13     11   		else d = v1

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

   254    254   end
   255    255   
   256    256   minetest.register_craftitem('sorcery:inferno_crystal', {
   257    257   	-- made with melding wand from ruby, lithium ingot, and gunpowder
   258    258   	-- under sign of the wyvern or the winged serpent
   259    259   	inventory_image = 'sorcery_inferno_crystal.png';
   260    260   	description = 'Inferno Crystal';
          261  +	groups = {sorcery_magical = 1, fuel = 1};
   261    262   	_sorcery = {
   262    263   		material = {
   263    264   			gem = true;
   264    265   			sacrifice_value = 900;
   265    266   		};
   266    267   	}
   267    268   })

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

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

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

   142    142   			pos = ppos;
   143    143   			velocity = vector.multiply(dir,vel);
   144    144   			expirationtime = far / vel;
   145    145   			size = math.random()*2.4 + 0.6;
   146    146   			texture = sorcery.lib.image('sorcery_sputter.png'):glow(col):render();
   147    147   			glow = 14;
   148    148   			animation = {
   149         -				type = 'vertical_frames', length = far/vel;
   150         -				aspect_w = 16, aspect_h = 16;
          149  +				type = 'vertical_frames', length = math.floor((far/vel)*10)*.10;
          150  +				aspect_w = 16, aspect_h = 16
   151    151   			};
   152    152   		}
   153    153   	end
   154    154   end
   155    155   
   156    156   function sorcery.vfx.drip(liquid, noz, amt, time, exp)
   157    157   	if type(liquid) == 'string' then liquid = sorcery.register.liquid.db[liquid] end