Update shooter
This commit is contained in:
parent
d6ad3ca3d9
commit
ed6e37a1c4
5 changed files with 17 additions and 28 deletions
|
@ -22,10 +22,10 @@ minetest.register_entity("shooter:grenade_entity", {
|
||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
if self.timer > 0.2 then
|
if self.timer > 0.2 then
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
local below = {x=pos.x, y=pos.y - 1, z=pos.z}
|
local above = {x=pos.x, y=pos.y + 1, z=pos.z}
|
||||||
if minetest.get_node(below).name ~= "air" then
|
if minetest.get_node(pos).name ~= "air" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
shooter:blast(pos, 1, 25, 5, self.player)
|
shooter:blast(above, 2, 25, 5, self.player)
|
||||||
end
|
end
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,9 +28,10 @@ minetest.register_entity("shooter:rocket_entity", {
|
||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
if self.timer > 0.2 then
|
if self.timer > 0.2 then
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
|
local above = {x=pos.x, y=pos.y + 1, z=pos.z}
|
||||||
if minetest.get_node(pos).name ~= "air" then
|
if minetest.get_node(pos).name ~= "air" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
shooter:blast(pos, 2, 50, 7, self.player)
|
shooter:blast(above, 4, 50, 8, self.player)
|
||||||
end
|
end
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ shooter = {
|
||||||
rounds = {},
|
rounds = {},
|
||||||
shots = {},
|
shots = {},
|
||||||
update_time = 0,
|
update_time = 0,
|
||||||
reload_time = 0
|
reload_time = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
SHOOTER_ADMIN_WEAPONS = false
|
SHOOTER_ADMIN_WEAPONS = false
|
||||||
|
@ -71,30 +71,18 @@ local function get_particle_pos(p, v, d)
|
||||||
end
|
end
|
||||||
|
|
||||||
function shooter:spawn_particles(pos, texture)
|
function shooter:spawn_particles(pos, texture)
|
||||||
if not SHOOTER_ENABLE_PARTICLE_FX then
|
if SHOOTER_ENABLE_PARTICLE_FX == true then
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(texture) ~= "string" then
|
if type(texture) ~= "string" then
|
||||||
texture = SHOOTER_EXPLOSION_TEXTURE
|
texture = SHOOTER_EXPLOSION_TEXTURE
|
||||||
end
|
end
|
||||||
local spread = {x=0.1, y=0.1, z=0.1}
|
local spread = {x=0.1, y=0.1, z=0.1}
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner(15, 0.3,
|
||||||
amount = 15,
|
vector.subtract(pos, spread), vector.add(pos, spread),
|
||||||
time = 0.3,
|
{x=-1, y=1, z=-1}, {x=1, y=2, z=1},
|
||||||
minpos = vector.subtract(pos, spread),
|
{x=-2, y=-2, z=-2}, {x=2, y=-2, z=2},
|
||||||
maxpos = vector.add(pos, spread),
|
0.1, 0.75, 1, 2, false, texture
|
||||||
minvel = {x=-1, y=1, z=-1},
|
)
|
||||||
maxvel = {x=1, y=2, z=1},
|
end
|
||||||
minacc = {x=-2, y=-2, z=-2},
|
|
||||||
maxacc = {x=2, y=-2, z=2},
|
|
||||||
minexptime = 0.1,
|
|
||||||
maxexptime = 0.75,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 2,
|
|
||||||
collisiondetection = false,
|
|
||||||
texture = texture
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function shooter:play_node_sound(node, pos)
|
function shooter:play_node_sound(node, pos)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 659 B |
Loading…
Reference in a new issue