Go to file
sleepycrow 18122f990f Removed itemcount from README, added usage section 2019-08-16 16:57:21 +02:00
textures Changed wand textures to better reflect their crafting recipes 2019-08-16 14:26:53 +02:00
LICENSE Initial commit 2019-08-04 01:03:54 +02:00
README.textile Removed itemcount from README, added usage section 2019-08-16 16:57:21 +02:00
api.lua Move mana subtraction to api.lua 2019-08-05 13:12:22 +02:00
default_spells.lua Made crafting the curse spell harder 2019-08-16 14:50:10 +02:00
default_wands.lua bleh 2019-08-16 14:30:03 +02:00
depends.txt Initial commit 2019-08-04 01:03:54 +02:00
events.lua Initial commit 2019-08-04 01:03:54 +02:00
init.lua Initial commit 2019-08-04 01:03:54 +02:00

README.textile

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