104
105
106
107
108
109
110
111
112
|
},
acceleration = {
x = 0,
y = -1,
z = 0
}
}
end
end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
},
acceleration = {
x = 0,
y = -1,
z = 0
}
}
end
end
-- target can be an entity or a pos vector
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)
local dir = vector.direction(ppos,scenter)
local vel = math.random() * 0.8 + 0.4
local col if type(color) == 'function'
then col = color(i, {high = high, far = far, dir = dir, vel = vel, pos = po})
else col = color
end
minetest.add_particle {
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
|