30 Commits

Author SHA1 Message Date
a231a5fb82 Version 1.0.1 2022-08-01 14:21:57 +02:00
d6fe732528 Add French translation 2022-08-01 14:21:10 +02:00
3d53b43696 Add Wuzzy to mailmap 2022-08-01 13:59:05 +02:00
93d994cbad Version 1.0.0 2019-04-01 13:13:58 +02:00
e9568ccdae Update function call again 2019-04-01 12:42:17 +02:00
c126114237 Update README 2019-04-01 12:12:59 +02:00
5634463f01 Fix translation of armor format string 2019-04-01 11:49:59 +02:00
79e9343331 Update to 5.0.0 translation system 2019-03-30 14:11:17 +01:00
fa0ed391c6 Move metadata to mod.conf 2019-03-30 13:57:45 +01:00
e513aeb9cb Version 0.4.0 2017-09-18 16:47:43 +02:00
02e5de41c2 Add Italian locale by Hamlet 2017-09-18 16:35:16 +02:00
b71769f63f MIT License 2017-09-18 16:35:08 +02:00
2063945d5c Use new Minetest settings API syntax 2017-08-09 16:25:59 +02:00
ceb313e9ff Fix PNG problems 2017-07-08 20:05:19 +02:00
bfc5f8cbb5 Version 0.3.0 2017-03-08 01:04:00 +01:00
a4408d010f Make sure armor value is never outside of 0 or 100 2017-03-08 01:00:41 +01:00
878a351e9d Add maximum to hbarmor_tick 2016-12-04 01:52:54 +01:00
72aeb873d0 Move all code to init.lua 2016-12-04 01:49:34 +01:00
a493641f02 Fix Luacheck warnings 2016-12-04 01:44:34 +01:00
3d1b4b0a97 Use minetest.conf settings system 2016-12-04 01:41:47 +01:00
96a796cce7 Update legacy code check 2016-11-12 19:42:29 +01:00
71a30b5620 Version 0.2.0 2016-11-12 19:34:55 +01:00
41fbe9a0d0 Rewrite README and convert to Markdown 2016-11-12 19:34:41 +01:00
dd1bf4e74c Update outdated intllib boilerplate 2016-11-09 01:50:21 +01:00
2e3d5b7ca5 Add screenshot 2016-11-03 23:17:03 +01:00
72c96c25a4 Add description 2016-10-29 15:37:46 +02:00
556f91b5c6 Fix fail when damaged with 6 new armor pieces 2016-08-05 20:08:11 +02:00
3d36b82a00 Remove incorrect changelog 2016-08-05 17:01:23 +02:00
4f5e49e8b0 Add mod.conf 2016-08-05 17:01:09 +02:00
9ed25e212e Add intllib support and German 2016-08-05 17:00:45 +02:00
18 changed files with 117 additions and 198 deletions

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>

42
README.md Normal file
View File

@ -0,0 +1,42 @@
# HUD bar for `3d_armor` [`hbarmor`]
* Version: 1.0.1
## Description
This mod adds a simple HUD bar which displays the current damage
of the player's armor (from the 3D Armor [`3d_armor`] mod) as a percentage (rounded).
100% armor means the armor is in perfect shape. 0% means the armor is almost destroyed
or non-existant. Note that to reach 100%, the player must wear at least 4 different
pieces of armor in perfect shape.
The armor bar also does not tell anything about the armor's strength,
only how worn out it already is.
By default, the armor bar is hidden if the player wears no armor.
## Dependencies
* HUD bars [`hudbars`], major version 2
* 3D Armor [`3d_armor`] (tested with Minetest 5.0.0)
## Licensing
This mod is entirly free softare.
### Source code
* License: MIT License (see below)
* Authors: Wuzzy, forked from the mod “Better HUD (and hunger)” [`hud`] by BlockMen (2013-2014)
### Textures
* `hbarmor_icon.png`—Stu ([CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)), modified by BlockMen
* `hbarmor_bgicon.png`—Stu (CC BY-SA 3.0), modified by BlockMen
* `hbarmor_bar.png`—Wuzzy (MIT License)
Everything else is under the MIT License:
© Copyright BlockMen (2013-2014)
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the MIT License.
See <https://opensource.org/licenses/MIT> for more details.

View File

@ -1,49 +0,0 @@
Minetest mod: HUD bar for armor [hbarmor]
=========================================
Version: 0.1.0
License of source code: WTFPL
-----------------------------
By Wuzzy,
forked from the mod “Better HUD (and hunger)” [hud]
by BlockMen (2013-2014).
Using the mod:
--------------
This mod adds a simple HUD bar which displays the current
damage of the player's armor (from the 3D Armor mod) as a percentage,
this number is of course rounded.
100% means the armor is in perfect shape, 0% means the armor
is almost destroyed or non-existant.
Note that to reach 100%, the player must wear at least 4 different
pieces of armor in perfect shape.
The armor bar also does not tell anything about the armor's strength,
only how worn out it already is.
By default, the armor bar is hidden if the player wears no armor.
Dependencies:
- HUD bars [hudbars], major version 1
- 3D Armor [3d_armor] (tested with 0.4.3)
License of textures:
--------------------
hbarmor_icon.png - Stu (CC BY-SA 3.0), modified by BlockMen
hbarmor_bgicon.png - Stu (CC BY-SA 3.0), modified by BlockMen
hbarmor_bar.png - Wuzzy (WTFPL)
everything else is WTFPL:
(c) Copyright BlockMen (2013-2014)
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

View File

@ -1,37 +0,0 @@
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 hbarmor.get_armor(player)
if not player or not armor.def then
return false
end
local name = player:get_player_name()
local def = armor.def[name] or nil
if def and def.state and def.count then
hbarmor.set_armor(name, def.state, def.count)
else
return false
end
return true
end
function hbarmor.set_armor(player_name, ges_state, items)
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
hbarmor.armor[player_name] = lvl* (items * (100 / max_items))
end

View File

@ -1,88 +0,0 @@
0.2 Beta
--------
- added support of custom config files
- you can eat max. 50% more than before (although it isnt shown in hunger bar)
- you get healed with 8 breads and more (in hunger bar) now
- a bread (from farming) == 2 breads in hunger bar
0.2.1 Beta
----------
- tweaked override of food
- added support for food of dwares, moretrees and simple mobs
0.2.2 Beta
----------
- added support for food of animalmaterials (mobf modpack),fishing
0.2.3 Beta
----------
- added support for food of glooptest and bushes (commit by CheeseKeg)
0.3 Beta
----------
- added fancy borders of hud inventory bar (only for screenheight <= 800)
0.4 Beta
----------
- enabled drowning
0.5 Beta
----------
- removed the fancy borders of hud inventory bar and moved to new native support
- moved crosshair to native support too
1.0
---
- hunger is reset after death
- health and hunger bar is shown correct on all screen resolutions now
- switched to changed native hotbar image support
- fixed revival of player when drown
- hunger bar is not shown anymore if hunger is disabled
- hunger can be disabled by minetest.conf ("hud_hunger_enable = false")
1.1
---
- added support for stu's 3darmor mod
- restructured and cleaned up code
- added support for poisen food (damages player, but does not kill)
1.2
---
- Send statbar values only to client when changed
- Hide armor bar if not wearing armor
- More reliable food overrides (by CiaranG)
- Support for bushes_classic foods (plantlife modpack) (by CiaranG)
- Add support for mushroom mod food/poison (by CiaranG)
- Add support for mods: fruit and mush45
- New images for hotbar, smaller armor icons
1.3
---
- New way hunger is saved (all old files in world dirctory can get deleted [e.g. hud_BlockMen_hunger])
- Fixed healing (not while drowning, fix after death)
- Add support for mods: seaplants[sea] and mobfcooking (by Xanthin)
- Tweaked hand image
- Player can die caus of starving now
1.3.1
-----
- Add compatibility for statbar scaling
- Fix typo in depends.txt
- Lower maintimer tick
1.3.2
-----
- Fix dependecies (by Chris Beelby)
- Add support for creatures mod
- Add optional healing for food (by TenPlus1)
1.3.3
-----
- Prevent crash with armor mod and missing player
- Add support for ethereal mod (by TenPlus1)
1.4
---
- New hunger mechanics/added experimental player-action based hunger
- Better crosshair texture, switched to "new" default hand
- Added support for farming redo mod, kpgmobs and jkmod

View File

@ -1,2 +0,0 @@
hudbars
3d_armor

View File

@ -1,9 +0,0 @@
-- If true, automatically hides the armor when the player wears no armor.
-- Otherwise, the armor bar shows “0%”.
--hbarmor.autohide = true
-- Time difference in seconds between updates to the HUD armor bar.
-- Increase this number for slow servers.
-- hbarmor.tick = 0.1

View File

@ -1,4 +1,11 @@
hbarmor = {}
local S = minetest.get_translator("hbarmor")
local N = function(s) return s end
if (not armor) or (not armor.def) then
minetest.log("error", "[hbarmor] Outdated 3d_armor version. Please update your version of 3d_armor!")
end
local hbarmor = {}
-- HUD statbar values
hbarmor.armor = {}
@ -6,21 +13,25 @@ hbarmor.armor = {}
-- Stores if player's HUD bar has been initialized so far.
hbarmor.player_active = {}
-- HUD item ids
local armor_hud = {}
-- Time difference in seconds between updates to the HUD armor bar.
-- Increase this number for slow servers.
hbarmor.tick = 0.1
-- If true, the armor bar is hidden when the player does not wear any armor
hbarmor.autohide = true
--load custom settings
local set = io.open(minetest.get_modpath("hbarmor").."/hbarmor.conf", "r")
if set then
dofile(minetest.get_modpath("hbarmor").."/hbarmor.conf")
set:close()
local set = minetest.settings:get_bool("hbarmor_autohide")
if set ~= nil then
hbarmor.autohide = set
end
set = minetest.settings:get("hbarmor_tick")
if tonumber(set) ~= nil then
hbarmor.tick = tonumber(set)
end
local must_hide = function(playername, arm)
return ((not armor.def[playername].count or armor.def[playername].count == 0) and arm == 0)
end
@ -32,7 +43,7 @@ end
local function custom_hud(player)
local name = player:get_player_name()
if minetest.setting_getbool("enable_damage") then
if minetest.settings:get_bool("enable_damage") then
local ret = hbarmor.get_armor(player)
if ret == false then
minetest.log("error", "[hbarmor] Call to hbarmor.get_armor in custom_hud returned with false!")
@ -50,15 +61,41 @@ local function custom_hud(player)
end
--register and define armor HUD bar
hb.register_hudbar("armor", 0xFFFFFF, "Armor", { icon = "hbarmor_icon.png", bgicon = "hbarmor_bgicon.png", bar = "hbarmor_bar.png" }, 0, 100, hbarmor.autohide, "%s: %d%%")
hb.register_hudbar("armor", 0xFFFFFF, S("Armor"), { icon = "hbarmor_icon.png", bgicon = "hbarmor_bgicon.png", bar = "hbarmor_bar.png" }, 0, 100, hbarmor.autohide, N("@1: @2%"), { order = { "label", "value" }, textdomain = "hbarmor" } )
dofile(minetest.get_modpath("hbarmor").."/armor.lua")
function hbarmor.get_armor(player)
if not player or not armor.def then
return false
end
local name = player:get_player_name()
local def = armor.def[name] or nil
if def and def.state and def.count then
hbarmor.set_armor(name, def.state, def.count)
else
return false
end
return true
end
function hbarmor.set_armor(player_name, ges_state, items)
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
hbarmor.armor[player_name] = math.max(0, math.min(lvl* (items * (100 / max_items)), 100))
end
-- update hud elemtens if value has changed
local function update_hud(player)
local name = player:get_player_name()
--armor
--armor
local arm = tonumber(hbarmor.armor[name])
if not arm then
arm = 0
@ -94,7 +131,7 @@ minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime
timer = timer + dtime
if main_timer > hbarmor.tick or timer > 4 then
if minetest.setting_getbool("enable_damage") then
if minetest.settings:get_bool("enable_damage") then
if main_timer > hbarmor.tick then main_timer = 0 end
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()

3
locale/hbarmor.de.tr Normal file
View File

@ -0,0 +1,3 @@
# textdomain:hbarmor
Armor=Panzerung
@1: @2%=@1: @2%

2
locale/hbarmor.fr.tr Normal file
View File

@ -0,0 +1,2 @@
# textdomain:hbarmor
Armor=Armure

3
locale/hbarmor.it.tr Normal file
View File

@ -0,0 +1,3 @@
# textdomain:hbarmor
Armor=Armatura
@1: @2%=@1:@2%

5
locale/template.txt Normal file
View File

@ -0,0 +1,5 @@
# textdomain:hbarmor
Armor=
# Format string for displaying the armor. E.g. "Armor: 100%"
@1: @2%=

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = hbarmor
description = Adds a HUD bar displaying the current damage of the player's armor.
depends = hudbars, 3d_armor

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

7
settingtypes.txt Normal file
View File

@ -0,0 +1,7 @@
#If true, automatically hides the armor HUD bar when the player wears no
#armor. Otherwise, the armor bar shows “0%”.
hbarmor_autohide (Automatically hide armor HUD bar) bool true
#Time difference in seconds between updates to the armor HUD bar.
#Increase this number for slow servers.
hbarmor_tick (Armor HUD bar update frequency) float 0.1 0.0 4.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 361 B