Update shooter

This commit is contained in:
rubenwardy 2016-01-02 16:15:06 +00:00
parent d6ad3ca3d9
commit ed6e37a1c4
5 changed files with 17 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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 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 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 end
function shooter:play_node_sound(node, pos) function shooter:play_node_sound(node, pos)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 659 B