3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
age = u.marshal.t.u32;
lastemit = u.marshal.t.u32;
}
minetest.register_entity('sorcery:spell_projectile_flamebolt',{
initial_properties = {
visual = "sprite";
-- use_texture_alpha = true;
textures = {'sorcery_fireball.png'};
groups = {immortal = 1};
visual_size = { x = 2, y = 2, z = 2 };
physical = true;
collide_with_objects = true;
pointable = false;
glow = 14;
static_save = false;
};
on_step = function(self,dtime,collision)
local pos = self.object:get_pos()
if not self._meta then
self._meta = { age = 0; lastemit = 0; emitters = {} }
goto emit
end
self._meta.age = self._meta.age + dtime
if self._meta.age >= 6 then
goto destroy
elseif (self._meta.age - self._meta.lastemit) < 3 then
goto collcheck
end
::emit:: do
self._meta.lastemit = self._meta.age
local spawn = function(num, life_min, life_max, size_min, size_max, gl, speed, img)
table.insert(self._meta.emitters, minetest.add_particlespawner {
amount = num;
minexptime = life_min;
|
|
<
>
>
>
>
>
>
>
>
>
>
>
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
age = u.marshal.t.u32;
lastemit = u.marshal.t.u32;
}
minetest.register_entity('sorcery:spell_projectile_flamebolt',{
initial_properties = {
visual = "sprite";
use_texture_alpha = true;
textures = {'sorcery_fireball.png'};
visual_size = { x = 2, y = 2, z = 2 };
physical = true;
collide_with_objects = true;
pointable = false;
glow = 14;
static_save = false;
shaded = false;
};
on_activate = function(self)
self.object:set_armor_groups{immortal = 1}
end;
on_step = function(self,dtime,collision)
local pos = self.object:get_pos()
if not self._meta then
self._meta = { age = 0; lastemit = 0; emitters = {} }
goto emit
end
self._meta.age = self._meta.age + dtime
if self._meta.age >= 6 then
goto destroy
elseif (self._meta.age - self._meta.lastemit) < 3 then
goto collcheck
end
-- fireballs dissipate when entering antimagic fields
do local probe = sorcery.spell.probe(self.object:get_pos())
if probe.disjunction and not self._meta.ignore_disjunction then
sorcery.vfx.cast_sparkle(nil,sorcery.lib.color(255,90,10),3,0.3,self.object:get_pos())
goto destroy
end end
::emit:: do
self._meta.lastemit = self._meta.age
local spawn = function(num, life_min, life_max, size_min, size_max, gl, speed, img)
table.insert(self._meta.emitters, minetest.add_particlespawner {
amount = num;
minexptime = life_min;
|