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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
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' 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 };
expirationtime = 0.4,
size = 50,
collisiondetection = false,
vertical = false,
texture = "tnt_boom.png",
glow = 14,
})
local boom = function(len,num,speed)
minetest.add_particlespawner {
amount = num;
time = len;
minpos = vector.subtract(pos, 1.2);
maxpos = vector.add(pos, 1,2);
minvel = vector.multiply({ x = -10; y = -10; z = -10; }, speed);
maxvel = vector.multiply({ x = 10; y = 10; z = 10; }, speed);
minacc = vector.multiply({ x = -1; y = -1; z = -1; }, speed);
maxacc = vector.multiply({ x = 1; y = 1; z = 1; }, speed);
minexptime = 0.1;
maxexptime = 0.3;
minsize = 6;
maxsize = 25;
texture = 'tnt_smoke.png';
}
end
boom(0.7, 140, 0.8)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 40}, true)
end
::destroy:: do
if self._meta then for _,v in pairs(self._meta.emitters) do
minetest.delete_particlespawner(v)
end end
self.object:remove()
end
end;
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
>
>
>
|
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
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 };
-- expirationtime = 0.4,
-- size = 50,
-- collisiondetection = false,
-- vertical = false,
-- texture = "tnt_boom.png",
-- glow = 14,
-- })
local boom = function(len,num,speed)
-- minetest.add_particlespawner {
-- amount = num;
-- time = len;
-- minpos = vector.subtract(pos, 1.2);
-- maxpos = vector.add(pos, 1,2);
-- minvel = vector.multiply({ x = -10; y = -10; z = -10; }, speed);
-- maxvel = vector.multiply({ x = 10; y = 10; z = 10; }, speed);
-- minacc = vector.multiply({ x = -1; y = -1; z = -1; }, speed);
-- maxacc = vector.multiply({ x = 1; y = 1; z = 1; }, speed);
-- minexptime = 0.1;
-- maxexptime = 0.3;
-- minsize = 6;
-- maxsize = 25;
-- texture = 'tnt_smoke.png';
-- }
end
boom(0.7, 140, 0.8)
-- minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 40}, true)
tnt.boom(pos, {
radius = self._blastradius;
})
end
::destroy:: do
if self._meta then for _,v in pairs(self._meta.emitters) do
minetest.delete_particlespawner(v)
end end
self.object:remove()
end
end;
})
|