Fix nil item exception and node particle texture
This commit is contained in:
parent
a541304155
commit
4d0fd5b93c
1 changed files with 18 additions and 19 deletions
37
shooter.lua
37
shooter.lua
|
@ -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,26 +55,25 @@ 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
|
for k, v in pairs(def.groups) do
|
||||||
end
|
local level = item.groups[k] or 0
|
||||||
for k, v in pairs(def.groups) do
|
if level >= v then
|
||||||
local level = item.groups[k] or 0
|
minetest.remove_node(pos)
|
||||||
if level >= v then
|
local sounds = item.sounds
|
||||||
minetest.remove_node(pos)
|
if sounds then
|
||||||
local sounds = item.sounds
|
local soundspec = sounds.dug
|
||||||
if sounds then
|
if soundspec then
|
||||||
local soundspec = sounds.dug
|
soundspec.pos = pos
|
||||||
if soundspec then
|
minetest.sound_play(soundspec.name, soundspec)
|
||||||
soundspec.pos = pos
|
end
|
||||||
minetest.sound_play(soundspec.name, soundspec)
|
|
||||||
end
|
end
|
||||||
|
local tiles = item.tiles
|
||||||
|
if tiles then
|
||||||
|
return tiles[1]
|
||||||
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
local tiles = item.tiles
|
|
||||||
if tiles then
|
|
||||||
return tiles[1]
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue