tweak light staff (thanks Ghaydn)

This commit is contained in:
tenplus1 2021-08-22 19:44:10 +01:00
parent dcf01bcfa1
commit 4d60175462

View File

@ -381,6 +381,11 @@ minetest.register_craft({
} }
}) })
ethereal.lightstaff_recipes = {
["nether:rack"] = "nether:glowstone",
["nether:rack_deep"] = "nether:glowstone_deep"
}
-- Staff of Light (by Xanthin) -- Staff of Light (by Xanthin)
minetest.register_tool("ethereal:light_staff", { minetest.register_tool("ethereal:light_staff", {
description = S("Staff of Light"), description = S("Staff of Light"),
@ -406,27 +411,12 @@ minetest.register_tool("ethereal:light_staff", {
local node = minetest.get_node(pos).name local node = minetest.get_node(pos).name
local def = minetest.registered_nodes[node] local def = minetest.registered_nodes[node]
local stone = def and def.groups and def.groups.stone and def.groups.stone == 1 local stone = def and def.groups and def.groups.stone and def.groups.stone == 1
local take = false
local glo = "ethereal:glostone"
if node == "nether:rack" then if ethereal.lightstaff_recipes[node] or stone then
glo = "nether:glowstone" local glo = ethereal.lightstaff_recipes[node] or "ethereal:glostone"
take = true
elseif node == "nether:rack_deep" then minetest.set_node(pos, {name = glo})
glo = "nether:glowstone_deep"
take = true
elseif stone then
take = true
end
if take == true then
minetest.swap_node(pos, {name = glo})
itemstack:add_wear(65535 / 149) -- 150 uses itemstack:add_wear(65535 / 149) -- 150 uses