Skip to content

monk-afk/grimoire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grimoire

ContentDB

A Powerful Book of Spells

(c) 2024 monk

MIT Licensed Source, CC0 Licensed Media


Summary

  • New to this version: grim_memory and page_memory

    • grim_memory: high-level local persistent context (until nil or shutdown)
    • page_memory: block-level local temporary context (until overrided)
  • Override Grimoire's on-callbacks with files named "page_*.lua"

    • Examples included: page_builder.lua and page_template.lua
    • Apply with the chat command, ex: /grimoire page builder
  • Single-use scripts are called from files named "invoke_*.lua"

    • Packaged examples: invoke_echo.lua and invoke_template.lua
    • Execute invoke pages with /grimoire invoke echo

Runtime Modifiable

Mod files can be edited or introduced during runtime without restarting Minetest.

The files within the pages folder are prefixed with either 'page_' or 'invoke_'.

Files named pages_ contain overriding callback methods used by the spellbook item.

Files named invoke_ contain functions to execute with the invoke chat command.

Grimoire Pages

The item grimoire:spellbook does nothing by default.

To use the spellbook, first use the chat command: /grimoire page builder.

This will select the file named page_builder.lua and will override the book's existing functions.

When a new page is added, or an existing page is modified, the page command can be used to apply the new functions.

You can use any callback functions such as on_use, on_place, on_secondary, on_drop, in combination with player controls (if they have been included in the function): up, down, left, right, jump, aux1, sneak, dig, place, LMB, RMB, and zoom.

  • Dropping and placing the spellbook won't drop or place the book
  • The book is destroyed if it is used by a player without the server privilege

Grimoire Invoke

Similar to pages, the invoke command will execute functions from file.

For example: /grimoire invoke echo will execute the function within invoke_echo.lua.

The functions will run only from chat command, and not added to the spellbook's functionality.

The invoke files can be modified and run again using the same command.

To add a new invoke command, a new file can be created from the invoke_template.lua template.

Grimoire Memory

The init.lua file contains a table grim_memory which is passed as a variable to pages or commands.

Using a new page or invoke command will not erase the grim_memory.

Each Grimoire page file can have a table for storing temporary variables to be used by the spellbook.

The page_memory table will be forgotten when a new page is selected.


Current Version 0.3.0

Discord monk.moe (ID:699370563235479624)

About

A book with runtime editable functions.

Resources

License

Stars

Watchers

Forks

Languages