Compare commits
2 Commits
37237ec359
...
9489ee052d
Author | SHA1 | Date | |
---|---|---|---|
9489ee052d | |||
047649d519 |
@ -20,7 +20,7 @@ this mod will place them accordingly.
|
||||
* Eating an apple (from Minetest Game) increases your satiation by 2
|
||||
|
||||
> Warning: Eating food will not directly increase your health anymore, as long as the food
|
||||
item is supported by this mod (see below).
|
||||
item is supported by this mod and direct healing is not configured (see below).
|
||||
|
||||
> Warning: ! Some foods may be poisoned. If you eat a poisoned item, you may still get a satiation
|
||||
boost, but for a brief period you lose health points because of food poisoning. However,
|
||||
@ -55,6 +55,7 @@ This mod adds a hunger buildin mechanic to the game. Players get a new attribute
|
||||
* At 1 or 0 satiation you will suffer damage and die in case you don't eat something
|
||||
* If your satiation is 16 or higher, you will slowly regenerate health points
|
||||
* Eating food will increase your satiation (Duh!)
|
||||
* Eating food will randomly give you healt life if you configured (see below)
|
||||
|
||||
All mods which add food through standard measures (`minetest.item_eat`) are already
|
||||
supported automatically. Poisoned food needs special support.
|
||||
@ -124,6 +125,7 @@ Use the advanced settings menu in Minetest for detailed configuration.
|
||||
| hudbars_hp_player_maximun | set the maximun hp of the player healt | int | 10 20 60 |
|
||||
| hudbars_br_player_maximun | set the maximun player breath value | int | 10 10 30 |
|
||||
| hbarmor_autohide | Automatically hide armor HUD bar | bool | false |
|
||||
| hbarmor_permitgainhp | Randomly gain healt too when eating | bool | true |
|
||||
| hbhunger_satiation_tick | Time in seconds which 1 saturation point is taken | float | 800 |
|
||||
| hbhunger_satiation_sprint_dig | exhaustion increased this value after digged node | float | 3 |
|
||||
| hbhunger_satiation_sprint_place | exhaustion increased this value after placed | float | 1 |
|
||||
|
@ -52,6 +52,8 @@ hb.settings.br_player_maximun = hb.load_setting("hudbars_br_player_maximun", "nu
|
||||
|
||||
hbarmor.autohide = (true and not hb.settings.forceload_default_hudbars)
|
||||
|
||||
hbhunger.permitgainhp = true
|
||||
|
||||
hbhunger.HUD_TICK = 0.2
|
||||
|
||||
hbhunger.HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken
|
||||
@ -65,6 +67,7 @@ hbhunger.SAT_HEAL = 15 -- required satiation points to start healing
|
||||
|
||||
local set
|
||||
|
||||
set = minetest.settings:get_bool("hbhunger_permitgainhp") if set ~= nil then hbhunger.permitgainhp = set end
|
||||
set = minetest.settings:get_bool("hbarmor_autohide") if set ~= nil then hbarmor.autohide = set end
|
||||
set = minetest.settings:get("hbhunger_satiation_tick") if set ~= nil then hbhunger.HUNGER_TICK = tonumber(set) end
|
||||
set = minetest.settings:get("hbhunger_satiation_dig") if set ~= nil then hbhunger.HUNGER_DIG = tonumber(set) end
|
||||
|
@ -1,6 +1,9 @@
|
||||
default?
|
||||
intllib?
|
||||
3d_armor?
|
||||
3d_armor_gloves?
|
||||
shields?
|
||||
wieldview?
|
||||
flowers?
|
||||
animalmaterials?
|
||||
bucket?
|
||||
|
@ -112,7 +112,13 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound
|
||||
-- heal is not defines due way of hbhunger.register_food
|
||||
if not heal then heal = 1 end
|
||||
-- eating something not give you inmediate life, give you statiation to get recovery
|
||||
if hp < 6 and heal > 0 then hp = hp + heal end
|
||||
if hp < 6 and hp > 0 and heal > 0 then hp = hp + heal end
|
||||
-- so if you are in good shape and losing healt just give it only for one chance, NSSM specific
|
||||
if hbhunger.permitgainhp then
|
||||
local hpreca = math.random (6, 10)
|
||||
local hprecb = math.random (11, hb.settings.hp_player_maximun - 1)
|
||||
if hp < hprecb and hp > hpreca then hp = hp + 1 end
|
||||
end
|
||||
-- so do not hardcoded hp to 20 when eating
|
||||
if hp > max_hp then hp = max_hp end
|
||||
-- this will work only when valid then
|
||||
|
7
init.lua
7
init.lua
@ -623,6 +623,7 @@ if not modhbarm and modarmors then
|
||||
|
||||
function hbarmor.get_armor(player)
|
||||
if not player or not armor.def then
|
||||
minetest.log("error", "[hbarmor] Call to hbarmor.get_armor cannot do it cos the payer armor definition its not set at this moment!")
|
||||
return false
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
@ -631,7 +632,7 @@ if not modhbarm and modarmors then
|
||||
if def and def.state and def.count then
|
||||
hbarmor.set_armor(name, def.state, def.count)
|
||||
else
|
||||
minetest.log("error", "[hudbars] Call to hbarmor.get_armor returned with false!")
|
||||
minetest.log("error", "[hudbars] Call to hbarmor.get_armor returned with false! armor.def[player] invalid")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@ -669,11 +670,9 @@ local function custom_hud(player)
|
||||
hb.init_hudbar(player, "breath", math.min(breath, breath_max), breath_max, hide_breath)
|
||||
|
||||
if not modhbarm and modarmors then
|
||||
local arm = tonumber(hbarmor.armor[name])
|
||||
if not arm then arm = 0 end
|
||||
local arm = tonumber(hbarmor.armor[name] or 0)
|
||||
local hide_ar = hbarmor.autohide and must_hide(name, arm)
|
||||
hbarmor.get_armor(player)
|
||||
arm = tonumber(hbarmor.armor[name])
|
||||
hb.init_hudbar(player, "armor", arm_printable(arm), 100, hide_ar)
|
||||
end
|
||||
|
||||
|
@ -128,6 +128,8 @@ hudbars_br_player_maximun (maximun value of braeth of player) int 20
|
||||
#armor. Otherwise, the armor bar shows “0%”.
|
||||
hbarmor_autohide (Automatically hide armor HUD bar) bool false
|
||||
|
||||
hbhunger_permitgainhp (Permit slowly to gain hp when eating food and not only using satiation) bool true
|
||||
|
||||
hbhunger_satiation_tick (Time in seconds after which 1 saturation point is taken) float 800
|
||||
|
||||
hbhunger_satiation_sprint_dig (exhaustion increased this value after digged node) float 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user