Changes to pipe bombs, cops, and node groups

This commit is contained in:
2022-11-22 15:32:50 -05:00
parent ba2da987ad
commit 71d289d98e
10 changed files with 56 additions and 88 deletions

View File

@@ -9,64 +9,7 @@ local playerWhoThrewObject = minetest.get_player_by_name("singleplayer")
minetest.register_craftitem('more_fire:pipebomb', {
description = 'Pipe Bomb',
inventory_image = 'more_fire_pipebomb.png',
on_place = function(itemstack, user, pointed_thing)
itemstack:take_item()
minetest.sound_play('more_fire_shatter', {gain = 1.0})
--smoke particles
minetest.add_particlespawner({
amount = 400,
time = 0.1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=0.5, z=-2},
minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 5,
maxexptime = 2,
minsize = 5,
maxsize = 20,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
--more smoke particles
minetest.add_particlespawner({
amount = 600,
time = 1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=10, y= 3, z=10},
maxvel = {x=-10, y= 3, z=-10},
minacc = {x=2, y=2, z=2},
maxacc = {x=-2, y=1, z=-2},
minexptime = 2,
maxexptime = 3,
minsize = 2,
maxsize = 20,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
--even more smoke particles
minetest.add_particlespawner({
amount = 400,
time = 1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=0.2, y=0.2, z=0.2},
maxvel = {x=-0.2, y=0.5, z=-0.2},
minacc = {x=10, y= 2, z=10},
maxacc = {x=-10, y= 1, z=-10},
minexptime = 2,
maxexptime = 3,
minsize = 20,
maxsize = 2,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
local dir = Vec3(user:get_look_dir()) *20
minetest.add_particle(
{x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2,
6, false, 'more_fire_smokebomb.png')
return itemstack
end,
})
local function throw_pipebomb(item, player)
@@ -130,13 +73,13 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.01 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
if self.timer > 0.005 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:pipebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then
if self.node ~= '' then
explosives.boom(pos, {})
explosives.boom(pos, {radius = 5})
local damage = 1
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
@@ -147,7 +90,7 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
end
end
end
if self.lastpos.x ~= nil then
if node.name ~= 'air' then
self.object:remove()
@@ -172,7 +115,7 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
})
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
end