From e18a5e913a0ed6f10668ac6b9051980259c5d087 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 4 Feb 2015 10:26:48 +0000 Subject: Update: add light staff and change crystal usage --- extra.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'extra.lua') diff --git a/extra.lua b/extra.lua index c6c6a31..f499643 100644 --- a/extra.lua +++ b/extra.lua @@ -264,6 +264,48 @@ minetest.register_node("ethereal:illumishroom3", { }, }) +local USES = 100 + +-- Staff of Light (by Xanthin) +minetest.register_tool("ethereal:light_staff", { + description = "Staff of Light", + inventory_image = "light_staff.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + + local pos = pointed_thing.under + + if pointed_thing.type ~= "node" then return end + + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return + end + + local node = minetest.get_node(pos).name + + if node == "default:stone" then + minetest.env:add_node(pos, {name="ethereal:glostone"}) + elseif node == "ethereal:glostone" then + minetest.env:add_node(pos, {name="default:stone"}) + end + + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535 / (USES - 1)) + end + return itemstack + end, +}) + +minetest.register_craft({ + output = "ethereal:light_staff", + recipe = { + {"ethereal:illumishroom", "default:mese_crystal", "ethereal:illumishroom"}, + {"ethereal:illumishroom2", "default:steel_ingot", "ethereal:illumishroom2"}, + {"ethereal:illumishroom3", "default:steel_ingot", "ethereal:illumishroom3"} + } +}) + -- Generate Illumishroom in caves next to coal minetest.register_on_generated(function(minp, maxp, seed) -- cgit v1.2.3