1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

[mff & runes] More work on wizard class : spontafire and info wand

- Add wands and scrolls to reserved items list for wizards
 - Add spontaneous inflaming (spontafire) glyph and scroll
 - Add information wand
This commit is contained in:
LeMagnesium 2016-06-28 19:20:06 +02:00
parent 326ceb6afb
commit 93139c8db7
5 changed files with 99 additions and 1 deletions

View File

@ -24,3 +24,10 @@ pclasses.api.register_class("wizard", {
})
-- Reserved items here
pclasses.api.reserve_item("wizard", "runes:info_wand")
pclasses.api.reserve_item("wizard", "runes:recharge_wand")
pclasses.api.reserve_item("wizard", "runes:stylus")
for scroll, _ in pairs(runes.scrolls) do
pclasses.api.reserve_item("wizard", "runes:scroll_" .. scroll)
end

View File

@ -67,7 +67,7 @@ minetest.register_craftitem("runes:recharge_wand", {
description = "Recharge wand",
inventory_image = "runes_recharge_wand.png",
on_use = function(itemstack, user, pointed_thing)
if not pointed_thing.type == "node" then
if not pointed_thing.type == "node" or not pointed_thing.under then
return
end
@ -113,6 +113,58 @@ minetest.register_craft({
},
})
minetest.register_craftitem("runes:info_wand", {
description = "Information wand",
inventory_image = "runes_info_wand.png",
on_use = function(itemstack, user, pointed_thing)
if not pointed_thing.type == "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
if not node or not minetest.registered_nodes[node.name]
or minetest.get_item_group(node.name, "glyph") == 0 then
return
end
local meta = minetest.get_meta(pointed_thing.under)
local metas = meta:to_table().fields
local owner = meta:get_string("master")
if owner == "" then
owner = "nobody"
end
local rname = node.name:sub(13)
local formspec = "size[7,7]" ..
"label[0,0; Rune informations :]" ..
"button_exit[3, 6.6; 1, 0.6; rune_info_exit; Exit]" ..
"textlist[0, 0.5; 6.8, 5.9; runes_info;" ..
"Rune : " .. rname .. "," ..
"Charge : " .. metas["charge"] .. "/" .. runes.glyphs[rname].max_charge .. "," ..
"Owner : " .. owner
local i = 4
for field, value in pairs(metas) do
if field ~= "master" and field ~= "charge" then
formspec = formspec .. "," .. field .. " (meta) : " .. value
i = i + 1
end
end
formspec = formspec .. ";]"
minetest.show_formspec(user:get_player_name(), "runes:glyph_info", formspec)
end,
})
minetest.register_craft({
output = "runes:info_wand",
recipe = {
{"", "", "default:grass"},
{"", "default:mithril_ingot", ""},
{"default:stick", "", ""},
},
})
function register_glyph(name, basics, tab)
--[[ Basics can contain :
- texture = "runes_glyph_unknown.png",
@ -286,3 +338,36 @@ register_glyph("manasucker", {
end
}
)
register_glyph("spontafire", {
description = "Spontaneous Fire Glyph",
texture = "runes_glyph_spontafire.png",
initial_charge = 0,
maximum_charge = 500,
mana_cost = 20,
}, {
groups = {snappy = 1},
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local charge = meta:get_int("charge")
for _, ref in pairs(minetest.get_objects_inside_radius(pos, 10)) do
if ((not ref:is_player()) and ref:get_entity_name() ~= "gauges:hp_bar")
or (ref:get_player_name() ~= "" and ref:get_player_name() ~= meta:get_string("master")) then
local rpos = vector.round(ref:getpos())
rpos.y = rpos.y - 1
local node = minetest.get_node(rpos)
if node.name == "air" and (not minetest.is_protected(rpos, meta:get_string("master")))
and charge >= runes.glyphs["spontafire"].mana_cost then
minetest.add_node(rpos, {name = "fire:basic_flame"})
charge = charge - runes.glyphs["spontafire"].mana_cost
end
end
end
meta:set_int("charge", charge)
return true
end,
})

View File

@ -33,3 +33,9 @@ register_scroll("manasucker", "knowledge", {
texture = "runes_scroll_manasucker.png",
description = "Mana Sucker Knowledge Scroll",
})
register_scroll("spontafire", "knowledge", {
glyph = "runes:glyph_spontafire",
texture = "runes_scroll_spontafire.png",
description = "Spontaneous Fire Knowledge Scroll",
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B