Added no node check
This commit is contained in:
parent
b860ec6fd8
commit
208401a5f9
31
chisel.lua
31
chisel.lua
@ -1,7 +1,5 @@
|
|||||||
local USES = 200
|
local USES = 200
|
||||||
|
|
||||||
local mode = {}
|
local mode = {}
|
||||||
|
|
||||||
local function parti(pos)
|
local function parti(pos)
|
||||||
minetest.add_particlespawner(25, 0.3,
|
minetest.add_particlespawner(25, 0.3,
|
||||||
pos, pos,
|
pos, pos,
|
||||||
@ -11,14 +9,15 @@ local function parti(pos)
|
|||||||
0.2, 2,
|
0.2, 2,
|
||||||
true, "mychisel_parti.png")
|
true, "mychisel_parti.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
mode = "1"
|
mode = "1"
|
||||||
minetest.register_tool( "mychisel:chisel",{
|
minetest.register_tool( "mychisel:chisel",{
|
||||||
description = "Chisel",
|
description = "Chisel",
|
||||||
inventory_image = "mychisel_chisel.png",
|
inventory_image = "mychisel_chisel.png",
|
||||||
wield_image = "mychisel_chisel.png",
|
wield_image = "mychisel_chisel.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local default_material = {
|
local default_material = {
|
||||||
@ -41,8 +40,6 @@ minetest.register_tool( "mychisel:chisel",{
|
|||||||
local item = default_material [i][1]
|
local item = default_material [i][1]
|
||||||
local mat = default_material [i][2]
|
local mat = default_material [i][2]
|
||||||
local desc = default_material [i][3]
|
local desc = default_material [i][3]
|
||||||
|
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -146,8 +143,7 @@ end
|
|||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
local usr = user:get_player_name()
|
local usr = user:get_player_name()
|
||||||
|
|
||||||
if mode == "1" then
|
if mode == "1" then
|
||||||
@ -172,7 +168,6 @@ end,
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mychisel:chisel",
|
output = "mychisel:chisel",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -181,19 +176,3 @@ minetest.register_craft({
|
|||||||
{"", "wool:brown", ""},
|
{"", "wool:brown", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user