summaryrefslogtreecommitdiff
path: root/armor.lua
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2013-09-13 20:18:16 +0200
committerBlockMen <nmuelll@web.de>2013-09-13 20:18:16 +0200
commit09fc5ee48ae2a9adc7752e8521302b3263573436 (patch)
tree9839bfb14c1404a02ffbb87876faa92126a64d08 /armor.lua
parent01e267e99a0f52af55c177ee8956f0fe28a22764 (diff)
Add support for 3darmor mod, add poisen food and restructure code
Diffstat (limited to 'armor.lua')
-rw-r--r--armor.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/armor.lua b/armor.lua
new file mode 100644
index 0000000..2030c42
--- /dev/null
+++ b/armor.lua
@@ -0,0 +1,31 @@
+minetest.after(0, function()
+ if not armor.def then
+ minetest.after(2,minetest.chat_send_all,"#Better HUD: Please update your version of 3darmor")
+ HUD_SHOW_ARMOR = false
+ end
+end)
+
+function hud.get_armor(player)
+ if not player or not armor.def then
+ return
+ end
+ local name = player:get_player_name()
+ hud.set_armor(player, armor.def[name].state, armor.def[name].count)
+end
+
+function hud.set_armor(player, ges_state, items)
+ if not player then return end
+
+ local max_items = 4
+ if items == 5 then max_items = items end
+ local max = max_items*65535
+ local lvl = max - ges_state
+ lvl = lvl/max
+ if ges_state == 0 and items == 0 then
+ lvl = 0
+ end
+
+ hud.armor[player:get_player_name()] = lvl*(items*(20/max_items))
+
+
+end \ No newline at end of file