7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
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 = false;
collide_with_objects = false;
pointable = false;
glow = 14;
static_save = false;
};
on_step = function(self,dtime,collision)
local pos = self.object:get_pos()
if not self._meta then
................................................................................
spawn(250, 4.0,9, 0.3, 0.8, 3.0, 7.0)
spawn(500, 10,20, 1.0, 1.8, 2.0, 0.2)
spawn(500, 10,20, 0.5, 1.0, 3.0, 0.5)
end
::collcheck:: do
-- if no collision then return end
local nname = minetest.get_node(pos).name
if nname == 'air' or minetest.registered_nodes[nname].walkable ~= true then return
elseif nname == 'ignore' then goto destroy end
-- else fall through to explode
end
::explode:: do
-- minetest.add_particle({
-- pos = pos,
-- velocity = { x = 0, y = 0, z = 0 };
-- acceleration = { x = 0, y = 0, z = 0 };
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
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
................................................................................
spawn(250, 4.0,9, 0.3, 0.8, 3.0, 7.0)
spawn(500, 10,20, 1.0, 1.8, 2.0, 0.2)
spawn(500, 10,20, 0.5, 1.0, 3.0, 0.5)
end
::collcheck:: do
-- if no collision then return end
-- local nname = minetest.get_node(pos).name
-- if nname == 'air' or minetest.registered_nodes[nname].walkable ~= true then return
-- elseif nname == 'ignore' then goto destroy end
-- else fall through to explode
if collision then -- since 5.3 only!!
print('collision detected!',dump(collision))
if collision.collides == false then return end
if #collision.collisions > 0 then
local col = collision.collisions[1]
if col.node_pos then
pos = col.node_pos
elseif col.object then
pos = col.object:get_pos()
end
-- fall through to explode
else return end
else return end
end
::explode:: do
-- minetest.add_particle({
-- pos = pos,
-- velocity = { x = 0, y = 0, z = 0 };
-- acceleration = { x = 0, y = 0, z = 0 };
|