sorcery/README.textile

74 lines
3.0 KiB
Plaintext

h1. Sorcery
Sorcery is a dead-simple magic mod. It adds a few craftable wands and spells, as well as a simple API to add more. Sorcery requires the "mana":https://forum.minetest.net/viewtopic.php?f=11&t=11154 mod.
h2. Usage
Left-click with a spell in hand to equip it, then left-click with a wand in hand to use the currently equipped spell. It's that simple. You can also right-click with either a wand or spell in hand to read a short description of it.
h2. API
h3. @sorcery.register_wand(info)@
*Parameters:*
* info (table)
** name (string) - The item id of the wand, following the minetest item naming conventions.
** desc (string) - The readable name of the wand
** full_desc (string) - A short description of the wand, which will show up whenever a player right-clicks with it.
** image (string) - The texture of the wand.
** craft_recipe (table, optional) - Same as in "minetest.register_craft":https://dev.minetest.net/register_craft
** power (number) - An arbeitrary number which is passed to spells whenever they are executed.
*Example:*
bc. sorcery.register_wand({
name = "test:cool_wand",
desc = "Cool Wand",
full_desc = "A quick glance at the wand confirms that it is, indeed, very cool.",
image = "cool_wand.png",
power = 999,
craft_recipe = {
{"default:dirt"},
{"default:stick"},
{"default:stick"},
}
})
h3. @sorcery.register_spell(info)@
*Parameters:*
* info (table)
** name (string) - The item id of the spell, following the minetest item naming conventions.
** desc (string) - The readable name of the spell
** full_desc (string) - A short description of the spell, which will show up whenever a player right-clicks with it.
** image (string) - The texture of the spell.
** craft_recipe (table, optional) - Same as in "minetest.register_craft":https://dev.minetest.net/register_craft
** mana_cost (number) - The amount of mana required to execute the spell.
** on_use (function) - The function that executes whenever a player uses a wand while the spell is equipped. (arguments: itemstack, player, pointed_thing [the thing the player is pointing at while executing the spell], wand_power [the power of the equipped wand])
*Example:*
bc.. sorcery.register_spell({
name = "test:brag_spell",
desc = "Brag Spell",
full_desc = "Makes sure that everyone knows you're a sorcerer.",
image = "brag_spell.png",
mana_cost = 10,
craft_recipe = {
{"default:paper", "default:paper", "default:paper"},
{"default:apple", "default:apple", "default:apple"},
{"default:paper", "default:paper", "default:paper"}
},
on_use = function(itemstack, player, pointed_thing, wand_power)
minetest.chat_send_all(player:get_player_name() .. " has a tier " .. wand_power .. " wand!")
return true --always return true on success, or else the mana will not be subtracted!
end
})
h2. License Info
Code: zlib license (see LICENSE file)
Textures: "CC0":https://creativecommons.org/publicdomain/zero/1.0/deed.en