sorcery  Diff

Differences From Artifact [aaa85eb70f]:

To Artifact [423ee7c3cf]:


   104    104   			},
   105    105   			acceleration = {
   106    106   				x = 0,
   107    107   				y = -1,
   108    108   				z = 0
   109    109   			}
   110    110   		}
          111  +	end
          112  +end
          113  +
          114  +-- target can be an entity or a pos vector
          115  +sorcery.vfx.imbue = function(color, target, strength, height)
          116  +	local tpos if target.get_pos then
          117  +		tpos = target:get_pos()
          118  +		if target.get_properties then
          119  +			height = height or ((target:get_properties().eye_height or 1)*1.3)
          120  +		end
          121  +	else
          122  +		tpos = target
          123  +	end
          124  +	height = height or 1
          125  +	local scenter = vector.add(tpos, {x=0,y=height/2,z=0})
          126  +	for i=1,math.random(64*(strength or 1),128*(strength or 1)) do
          127  +		local high = (height+0.8)*math.random() - 0.8
          128  +		local far = (high >= -0.5 and high <= height) and
          129  +			(math.random() * 0.3 + 0.4) or
          130  +			(math.random() * 0.5)
          131  +		local yaw = {x=0, y = math.random()*(2*math.pi), z=0}
          132  +		local po = vector.rotate({x=far,y=high,z=0}, yaw)
          133  +		local ppos = vector.add(po,tpos)
          134  +		local dir = vector.direction(ppos,scenter)
          135  +		local vel = math.random() * 0.8 + 0.4
          136  +		local col if type(color) == 'function'
          137  +			then col = color(i, {high = high, far = far, dir = dir, vel = vel, pos = po})
          138  +			else col = color
          139  +		end
          140  +		minetest.add_particle {
          141  +			pos = ppos;
          142  +			velocity = vector.multiply(dir,vel);
          143  +			expirationtime = far / vel;
          144  +			size = math.random()*2.4 + 0.6;
          145  +			texture = sorcery.lib.image('sorcery_sputter.png'):glow(col):render();
          146  +			glow = 14;
          147  +			animation = {
          148  +				type = 'vertical_frames', length = far/vel;
          149  +				aspect_w = 16, aspect_h = 16;
          150  +			};
          151  +		}
   111    152   	end
   112    153   end