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
|
||||
if self.timer > 0.2 then
|
||||
local pos = self.object:getpos()
|
||||
local below = {x=pos.x, y=pos.y - 1, z=pos.z}
|
||||
if minetest.get_node(below).name ~= "air" then
|
||||
local above = {x=pos.x, y=pos.y + 1, z=pos.z}
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
self.object:remove()
|
||||
shooter:blast(pos, 1, 25, 5, self.player)
|
||||
shooter:blast(above, 2, 25, 5, self.player)
|
||||
end
|
||||
self.timer = 0
|
||||
end
|
||||
|
|
|
@ -28,9 +28,10 @@ minetest.register_entity("shooter:rocket_entity", {
|
|||
self.timer = self.timer + dtime
|
||||
if self.timer > 0.2 then
|
||||
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
|
||||
self.object:remove()
|
||||
shooter:blast(pos, 2, 50, 7, self.player)
|
||||
shooter:blast(above, 4, 50, 8, self.player)
|
||||
end
|
||||
self.timer = 0
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ shooter = {
|
|||
rounds = {},
|
||||
shots = {},
|
||||
update_time = 0,
|
||||
reload_time = 0
|
||||
reload_time = 0,
|
||||
}
|
||||
|
||||
SHOOTER_ADMIN_WEAPONS = false
|
||||
|
@ -71,30 +71,18 @@ local function get_particle_pos(p, v, d)
|
|||
end
|
||||
|
||||
function shooter:spawn_particles(pos, texture)
|
||||
if not SHOOTER_ENABLE_PARTICLE_FX then
|
||||
return
|
||||
if SHOOTER_ENABLE_PARTICLE_FX == true then
|
||||
if type(texture) ~= "string" then
|
||||
texture = SHOOTER_EXPLOSION_TEXTURE
|
||||
end
|
||||
local spread = {x=0.1, y=0.1, z=0.1}
|
||||
minetest.add_particlespawner(15, 0.3,
|
||||
vector.subtract(pos, spread), vector.add(pos, spread),
|
||||
{x=-1, y=1, z=-1}, {x=1, y=2, z=1},
|
||||
{x=-2, y=-2, z=-2}, {x=2, y=-2, z=2},
|
||||
0.1, 0.75, 1, 2, false, texture
|
||||
)
|
||||
end
|
||||
|
||||
if type(texture) ~= "string" then
|
||||
texture = SHOOTER_EXPLOSION_TEXTURE
|
||||
end
|
||||
local spread = {x=0.1, y=0.1, z=0.1}
|
||||
minetest.add_particlespawner({
|
||||
amount = 15,
|
||||
time = 0.3,
|
||||
minpos = vector.subtract(pos, spread),
|
||||
maxpos = vector.add(pos, spread),
|
||||
minvel = {x=-1, y=1, z=-1},
|
||||
maxvel = {x=1, y=2, z=1},
|
||||
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
|
||||
|
||||
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