Add sprint_stamina_heal.

This sets the amount to heal when not sprinting.
This commit is contained in:
orbea 2020-04-01 14:57:36 -07:00 committed by texmex
parent 19b4e25017
commit 5be91db7bc
2 changed files with 5 additions and 1 deletions

@ -10,6 +10,7 @@ local dir = minetest.is_yes(setting_get("sprint_forward_only", "false"
local particles = tonumber(setting_get("sprint_particles", "2")) local particles = tonumber(setting_get("sprint_particles", "2"))
local stamina = minetest.is_yes(setting_get("sprint_stamina", "true")) local stamina = minetest.is_yes(setting_get("sprint_stamina", "true"))
local stamina_drain = tonumber(setting_get("sprint_stamina_drain", "2")) local stamina_drain = tonumber(setting_get("sprint_stamina_drain", "2"))
local stamina_heal = tonumber(setting_get("sprint_stamina_heal", "2"))
local replenish = tonumber(setting_get("sprint_stamina_replenish", "2")) local replenish = tonumber(setting_get("sprint_stamina_replenish", "2"))
local starve = minetest.is_yes(setting_get("sprint_starve", "true")) local starve = minetest.is_yes(setting_get("sprint_starve", "true"))
local starve_drain = tonumber(setting_get("sprint_starve_drain", "0.5")) local starve_drain = tonumber(setting_get("sprint_starve_drain", "0.5"))
@ -90,7 +91,7 @@ end
local function replenish_stamina(player) local function replenish_stamina(player)
local player_stamina = player:get_meta():get_float("hbsprint:stamina") local player_stamina = player:get_meta():get_float("hbsprint:stamina")
if player_stamina < 20 then if player_stamina < 20 then
player_stamina = math.min(20, player_stamina + stamina_drain) player_stamina = math.min(20, player_stamina + stamina_heal)
player:get_meta():set_float("hbsprint:stamina", player_stamina) player:get_meta():set_float("hbsprint:stamina", player_stamina)
end end
if mod_hudbars then if mod_hudbars then

@ -16,6 +16,9 @@ sprint_stamina (Stamina) bool true
#The amount of stamina to drain while sprinting #The amount of stamina to drain while sprinting
sprint_stamina_drain (Stamina drain) float 2 sprint_stamina_drain (Stamina drain) float 2
#The amount of stamina to heal while not sprinting
sprint_stamina_heal (Stamina heal) float 2
#The amount of seconds before starting to replenish stamina #The amount of seconds before starting to replenish stamina
sprint_stamina_replenish (Stamina replenish) float 2 sprint_stamina_replenish (Stamina replenish) float 2