From 70ed7e34a06d0c32fd24b245cca4795ec21349cd Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Sat, 26 Nov 2016 12:33:27 +0000 Subject: [PATCH] add API documentation for modding extension --- api.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 api.md diff --git a/api.md b/api.md new file mode 100644 index 0000000..a0fcae7 --- /dev/null +++ b/api.md @@ -0,0 +1,21 @@ +# API Extension + +Adding your protections to the HUD +---------------------------------- + +If you are providing an extra protection mod to work in cunjunction with the +HUD feature of `areas`, you can register a callback to add your mod's code to +display your protection's existence. For example + + local myhandler = function(pos,arealist) + local areaowner = find_my_protections(pos) + + if areaowner then + arealist["mymodname"] = { + name = "Protection name", + owner = areaowner, + } + end + end + + areas.register_hud_handler(myhandler)