mirror of
https://github.com/minetest-mods/hbsprint.git
synced 2024-12-22 21:32:24 +01:00
Add starve_limit setting
This commit is contained in:
parent
4539d965ed
commit
f5d61f4a5b
3
init.lua
3
init.lua
@ -10,6 +10,7 @@ local stamina_drain = tonumber(minetest.settings:get("sprint_stamina_drain")) or
|
|||||||
local replenish = tonumber(minetest.settings:get("sprint_stamina_replenish")) or 2
|
local replenish = tonumber(minetest.settings:get("sprint_stamina_replenish")) or 2
|
||||||
local starve = minetest.settings:get_bool("sprint_starve") ~= false
|
local starve = minetest.settings:get_bool("sprint_starve") ~= false
|
||||||
local starve_drain = tonumber(minetest.settings:get("sprint_starve_drain")) or 0.5
|
local starve_drain = tonumber(minetest.settings:get("sprint_starve_drain")) or 0.5
|
||||||
|
local starve_limit = tonumber(minetest.settings:get("sprint_starve_limit")) or 6
|
||||||
local breath = minetest.settings:get_bool("sprint_breath") ~= false
|
local breath = minetest.settings:get_bool("sprint_breath") ~= false
|
||||||
local breath_drain = tonumber(minetest.settings:get("sprint_breath_drain")) or 1
|
local breath_drain = tonumber(minetest.settings:get("sprint_breath_drain")) or 1
|
||||||
local autohide = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false
|
local autohide = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false
|
||||||
@ -178,7 +179,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
walkable = minetest.registered_nodes[ground.name].walkable
|
walkable = minetest.registered_nodes[ground.name].walkable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if player_stamina > 0 and hunger > 6 and walkable then
|
if player_stamina > 0 and hunger > starve_limit and walkable then
|
||||||
start_sprint(player)
|
start_sprint(player)
|
||||||
player:set_attribute("hbsprint:sprinting", "true")
|
player:set_attribute("hbsprint:sprinting", "true")
|
||||||
if stamina then drain_stamina(player) end
|
if stamina then drain_stamina(player) end
|
||||||
|
Loading…
Reference in New Issue
Block a user