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 shots = {}
local function spawn_particles(p, v, d, texture) local function spawn_particles(p, v, d, texture)
if texture.type ~= "string" then if type(texture) ~= "string" then
texture = SHOOTER_EXPLOSION_TEXTURE texture = SHOOTER_EXPLOSION_TEXTURE
end end
local pos = vector.add(p, vector.multiply(v, {x=d, y=d, z=d})) local pos = vector.add(p, vector.multiply(v, {x=d, y=d, z=d}))
@ -55,9 +55,7 @@ local function punch_node(pos, def)
return return
end end
local item = minetest.registered_items[node.name] local item = minetest.registered_items[node.name]
if not item.groups then if item and item.groups then
return
end
for k, v in pairs(def.groups) do for k, v in pairs(def.groups) do
local level = item.groups[k] or 0 local level = item.groups[k] or 0
if level >= v then if level >= v then
@ -77,6 +75,7 @@ local function punch_node(pos, def)
break break
end end
end end
end
end end
function shooter:fire_weapon(user, pointed_thing, def) function shooter:fire_weapon(user, pointed_thing, def)