Fix nil item exception and node particle texture

This commit is contained in:
stujones11 2013-12-24 21:44:51 +00:00
parent a541304155
commit 4d0fd5b93c

View file

@ -20,7 +20,7 @@ local timer = 0
local shots = {}
local function spawn_particles(p, v, d, texture)
if texture.type ~= "string" then
if type(texture) ~= "string" then
texture = SHOOTER_EXPLOSION_TEXTURE
end
local pos = vector.add(p, vector.multiply(v, {x=d, y=d, z=d}))
@ -55,26 +55,25 @@ local function punch_node(pos, def)
return
end
local item = minetest.registered_items[node.name]
if not item.groups then
return
end
for k, v in pairs(def.groups) do
local level = item.groups[k] or 0
if level >= v then
minetest.remove_node(pos)
local sounds = item.sounds
if sounds then
local soundspec = sounds.dug
if soundspec then
soundspec.pos = pos
minetest.sound_play(soundspec.name, soundspec)
if item and item.groups then
for k, v in pairs(def.groups) do
local level = item.groups[k] or 0
if level >= v then
minetest.remove_node(pos)
local sounds = item.sounds
if sounds then
local soundspec = sounds.dug
if soundspec then
soundspec.pos = pos
minetest.sound_play(soundspec.name, soundspec)
end
end
local tiles = item.tiles
if tiles then
return tiles[1]
end
break
end
local tiles = item.tiles
if tiles then
return tiles[1]
end
break
end
end
end