diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-01-31 19:39:31 -0500 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-01-31 19:39:31 -0500 |
commit | 39f5cba27eef35877c91291f518974f34130fcb6 (patch) | |
tree | 117a9d1b7d4ee5f78f73e1216e982c366ed9ecc6 /areas/api.md | |
parent | 2922421f4a88e56a0a1c819f62bf2bc287835388 (diff) | |
download | dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.gz dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.bz2 dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.xz dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.zip |
Huge update - lots of mods:
areas, biome_lib, blox, bobblocks, boost_cart, homedecor, mobs,
coloredwood, ilights, inbox, item_tweaks, moreblocks, moreores,
pipeworks, plasticbox, signs_lib, stainedglass, roads, unifieddyes,
vines, worldedit, xban2, maybe some others I didn't think about ;-)
Diffstat (limited to 'areas/api.md')
-rw-r--r-- | areas/api.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/areas/api.md b/areas/api.md new file mode 100644 index 0000000..c74b4c7 --- /dev/null +++ b/areas/api.md @@ -0,0 +1,45 @@ +Areas mod API +=== + +API list +--- + + * `areas.registerHudHandler(handler)` - Registers a handler to add items to the Areas HUD. See [HUD](#hud). + + +HUD +--- + +If you are making a protection mod or a similar mod that adds invisible regions +to the world, and you would like then to show up in the areas HUD element, you +can register a callback to show your areas. + +HUD handler specification: + + * `handler(pos, list)` + * `pos` - The position to check. + * `list` - The list of area HUD elements, this should be modified in-place. + +The area list item is a table containing a list of tables with the following fields: + + * `id` - An identifier for the area. This should be a unique string in the format `mod:id`. + * `name` - The name of the area. + * `owner` - The player name of the region owner, if any. + +All of the fields are optional but at least one of them must be set. + +### Example + + local function areas_hud_handler(pos, areas) + local val = find_my_protection(pos) + + if val then + table.insert(areas, { + id = "mod:"..val.id, + name = val.name, + owner = val.owner, + }) + end + end + + areas:registerHudHandler(areas_hud_handler) |