diff options
author | BlockMen <nmuelll@web.de> | 2015-04-02 16:08:02 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2015-04-03 12:33:53 +0200 |
commit | 1071c7f13e491b2f3bc09bbbcb1bd6aaed6071c5 (patch) | |
tree | fbc4937b87c213cea5822d8b86eff2cafee36965 /API.txt | |
parent | 69a993861ef19f17626c72f6b0f9c03e137c5051 (diff) |
Rewrite mod, push to 2.0
- Seperated hunger -> https://github.com/BlockMen/hunger
- Added API
Diffstat (limited to 'API.txt')
-rw-r--r-- | API.txt | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +function hud.register(name, def) + -- name: statbar name (health, air, hunger, armor already used by default) + -- def: <HUD item definition> (see below) + +hud.change_item(player, name, def) + -- player: player object + -- name: statbar name (health, air, hunger, armor already used by default) + -- def: table containing new values + -- currently supported: number, text and offset + +hud.remove_item(player, name) + +HUD item definition +{ + hud_elem_type = "statbar", -- currently only supported type (same as in lua-api.txt) + position = {x=<x>, y=<y>}, -- position of statbar (same as in lua-api.txt) + size = {x=24, y=24}, -- statbar texture size (default 24x24), needed to be scaled correctly + text = "hud_heart_fg.png", -- texture name (same as in lua-api.txt) + number = 20, -- number/2 = number of full textures(e.g. hearts) + max = 20, -- used to prevent "overflow" of statbars + alignment = {x=-1,y=-1}, -- alignment on screen (same as in lua-api.txt) + offset = HUD_HEALTH_OFFSET, + background = "hud_heart_bg.png", -- statbar background texture name + autohide_bg = false, -- hide statbar background textures when number = 0 + events = { -- called on events "damage" and "breath_changed" of players + { + type = "damage", + func = function(player) + -- do something here + end + } + }, +} |