Wand focus of light

This commit is contained in:
Evert Prants 2020-01-22 14:32:52 +02:00
parent fcd2c49bbb
commit b89d49caf2
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
6 changed files with 67 additions and 3 deletions

View File

@ -42,6 +42,11 @@ The <b>Transterra</b> is a stone that can be used to <b>create or remove nodes f
The <b>Elemental Ring</b> can show you what elements a crystal contains and their quantities.
#2magicalities:focus_blank
The <b>Blank Wand Focus</b> is your gateway to the world of <b>Wand Focuses</b>.
Wand Focuses are used with the wand to peform magical activites. <b>Right Click</b> with your <action name="#2magicalities:wand_steel">Wand</action> to select a focus from your inventory.
#2magicalities:focus_swap
The <b>Wand Focus of Swapping</b> is a <action name="#2magicalities:focus_blank">Wand Focus</action> which can be used to replace nodes in the world with nodes in your inventory. Use <b>Right Mouse Button</b> to select the node to replace with and <b>Left Mouse Button</b> to replace nodes in the world. Each operation requires <b>1 Earth</b>.
#2magicalities:focus_light
The <b>Wand Focus of Light</b> is a <action name="#2magicalities:focus_blank">Wand Focus</action> which can be used to place light source nodes in place of stone. Each node of light takes <b>1 Light</b> element.
#2magicalities:axe_tellium
<b>Tellium Axe</b> is a Diamond-tier tool that can be empowered by right-clicking. In empowered mode, the axe is 2x as fast but breaks about 4x faster.
#2magicalities:pick_tellium

View File

@ -72,6 +72,7 @@ minetest.register_craftitem("magicalities:focus_swap", {
local pos = pointed_thing.under
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return itemstack
end
@ -129,6 +130,48 @@ minetest.register_craftitem("magicalities:focus_swap", {
end
})
-- Light Source
minetest.register_node("magicalities:light_source", {
description = "Magical Light Source",
tiles = {"magicalities_light_source.png"},
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = 13,
drop = ""
})
minetest.register_craftitem("magicalities:focus_light", {
description = "Wand Focus of Light",
groups = {wand_focus = 1},
inventory_image = "magicalities_focus_light.png",
stack_max = 1,
_wand_requirements = {
["light"] = 1
},
_wand_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local pname = user:get_player_name()
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
local node = minetest.get_node(pos).name
if node == "default:stone" or node == "default:desert_stone" then
minetest.swap_node(pos, {name = "magicalities:light_source"})
itemstack = magicalities.wands.wand_take_contents(itemstack, {light = 1})
magicalities.wands.update_wand_desc(itemstack)
end
return itemstack
end,
})
---------------
-- Tunneling --
---------------

View File

@ -226,6 +226,20 @@ local recipes = {
requirements = {
["air"] = 10,
},
learnable = {
depends = {"magicalities:focus_atk_air"}
}
},
{
input = {
{"magicalities:crystal_light", "magicalities:crystal_block_light", "magicalities:crystal_light"},
{"default:stone", "magicalities:focus_blank", "default:stone"},
{"magicalities:crystal_light", "magicalities:crystal_block_light", "magicalities:crystal_light"}
},
output = "magicalities:focus_light",
requirements = {
["light"] = 10,
},
learnable = {
depends = {"magicalities:focus_blank"}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

View File

@ -196,7 +196,7 @@ function magicalities.wands.wand_take_contents(stack, to_take)
for name, count in pairs(to_take) do
if not data_table[name] or data_table[name] - count < 0 then
return nil
return stack
end
data_table[name] = data_table[name] - count
@ -300,10 +300,11 @@ end
local function use_wand(itemstack, user, pointed_thing)
local imeta = itemstack:get_meta()
local pname = user:get_player_name()
-- Initialize wand metadata
if imeta:get_string("contents") == "" then
initialize_wand(itemstack, user:get_player_name())
initialize_wand(itemstack, pname)
magicalities.wands.update_wand_desc(itemstack)
end
@ -325,7 +326,8 @@ local function use_wand(itemstack, user, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node_or_nil(pos)
if not node or node.name == "air" or minetest.is_protected(pos, user:get_player_name()) then
if not node or node.name == "air" or minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
magicalities.wands.update_wand_desc(itemstack)
return itemstack
end