| 
						 
						
						
						
						 
					 | 
					 | 
					@@ -1,44 +1,51 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					-- Vars
 | 
					 | 
					 | 
					 | 
					-- Vars
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local speed         = tonumber(minetest.settings:get ("sprint_speed")) or 1.3
 | 
					 | 
					 | 
					 | 
					local function setting_get(name, default)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local jump          = tonumber(minetest.settings:get ("sprint_jump")) or 1.1
 | 
					 | 
					 | 
					 | 
						return minetest.settings:get(name) or default
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local key           = minetest.settings:get ("sprint_key") or "Use"
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local dir           = minetest.settings:get_bool("sprint_forward_only") ~= false
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local particles     = tonumber(minetest.settings:get ("sprint_particles")) or 2
 | 
					 | 
					 | 
					 | 
					local speed         = tonumber(setting_get("sprint_speed", "1.3"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local stamina       = minetest.settings:get_bool("sprint_stamina") ~= false
 | 
					 | 
					 | 
					 | 
					local jump          = tonumber(setting_get("sprint_jump", "1.1"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local stamina_drain = tonumber(minetest.settings:get ("sprint_stamina_drain")) or 2
 | 
					 | 
					 | 
					 | 
					local dir           = minetest.is_yes(setting_get("sprint_forward_only", "false"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local replenish     = tonumber(minetest.settings:get ("sprint_stamina_replenish")) or 2
 | 
					 | 
					 | 
					 | 
					local particles     = tonumber(setting_get("sprint_particles", "2"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local starve        = minetest.settings:get_bool("sprint_starve") ~= false
 | 
					 | 
					 | 
					 | 
					local stamina       = minetest.is_yes(setting_get("sprint_stamina", "true"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local starve_drain  = tonumber(minetest.settings:get ("sprint_starve_drain")) or 0.5
 | 
					 | 
					 | 
					 | 
					local stamina_drain = tonumber(setting_get("sprint_stamina_drain", "2"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local starve_limit  = tonumber(minetest.settings:get ("sprint_starve_limit")) or 6
 | 
					 | 
					 | 
					 | 
					local replenish     = tonumber(setting_get("sprint_stamina_replenish", "2"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local breath        = minetest.settings:get_bool("sprint_breath") ~= false
 | 
					 | 
					 | 
					 | 
					local starve        = minetest.is_yes(setting_get("sprint_starve", "true"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local breath_drain  = tonumber(minetest.settings:get ("sprint_breath_drain")) or 1
 | 
					 | 
					 | 
					 | 
					local starve_drain  = tonumber(setting_get("sprint_starve_drain", "0.5"))
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local autohide      = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false
 | 
					 | 
					 | 
					 | 
					local starve_limit  = tonumber(setting_get("sprint_starve_limit", "6"))
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					local breath        = minetest.is_yes(setting_get("sprint_breath", "true"))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					local breath_drain  = tonumber(setting_get("sprint_breath_drain", "1"))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					local autohide      = minetest.is_yes(setting_get("hudbars_autohide_stamina", "true"))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local sprint_timer_step = 0.5
 | 
					 | 
					 | 
					 | 
					local sprint_timer_step = 0.5
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local sprint_timer = 0
 | 
					 | 
					 | 
					 | 
					local sprint_timer = 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local stamina_timer = 0
 | 
					 | 
					 | 
					 | 
					local sprinting = {}
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local breath_timer = 0
 | 
					 | 
					 | 
					 | 
					local stamina_timer = {}
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					local breath_timer = {}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local mod_hudbars = minetest.get_modpath("hudbars") or false
 | 
					 | 
					 | 
					 | 
					local mod_hudbars = minetest.get_modpath("hudbars") ~= nil
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local mod_player_monoids = minetest.get_modpath("player_monoids") or false
 | 
					 | 
					 | 
					 | 
					local mod_player_monoids = minetest.get_modpath("player_monoids") ~= nil
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local mod_playerphysics = minetest.get_modpath("playerphysics") or false
 | 
					 | 
					 | 
					 | 
					local mod_playerphysics = minetest.get_modpath("playerphysics") ~= nil
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local starve
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					if minetest.get_modpath("hbhunger") then
 | 
					 | 
					 | 
					 | 
					if starve then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  starve = "hbhunger"
 | 
					 | 
					 | 
					 | 
					  if minetest.get_modpath("hbhunger") then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					elseif minetest.get_modpath("hunger_ng") then
 | 
					 | 
					 | 
					 | 
					    starve = "hbhunger"
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  starve = "hunger_ng"
 | 
					 | 
					 | 
					 | 
					  elseif minetest.get_modpath("hunger_ng") then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  --starve_drain = starve_drain * -1
 | 
					 | 
					 | 
					 | 
					    starve = "hunger_ng"
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					else
 | 
					 | 
					 | 
					 | 
					  else
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  starve = false
 | 
					 | 
					 | 
					 | 
					    starve = false
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					if minetest.settings:get_bool("creative_mode") then
 | 
					 | 
					 | 
					 | 
					if minetest.settings:get_bool("creative_mode") then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  starve = false
 | 
					 | 
					 | 
					 | 
					  starve = false
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					-- Functions
 | 
					 | 
					 | 
					 | 
					-- Functions
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function start_sprint(player)
 | 
					 | 
					 | 
					 | 
					local function start_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if player:get_meta():get("hbsprint:sprinting") == "false" then
 | 
					 | 
					 | 
					 | 
					  local name = player:get_player_name()
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if not sprinting[name] then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if mod_player_monoids then
 | 
					 | 
					 | 
					 | 
					    if mod_player_monoids then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player_monoids.speed:add_change(player, speed, "hbsprint:speed")
 | 
					 | 
					 | 
					 | 
					      player_monoids.speed:add_change(player, speed, "hbsprint:speed")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player_monoids.jump:add_change(player, jump, "hbsprint:jump")
 | 
					 | 
					 | 
					 | 
					      player_monoids.jump:add_change(player, jump, "hbsprint:jump")
 | 
				
			
			
		
	
	
		
		
			
				
					
					| 
						
					 | 
					 | 
					@@ -48,11 +55,13 @@ local function start_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    else
 | 
					 | 
					 | 
					 | 
					    else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player:set_physics_override({speed = speed, jump = jump})
 | 
					 | 
					 | 
					 | 
					      player:set_physics_override({speed = speed, jump = jump})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    sprinting[name] = true
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function stop_sprint(player)
 | 
					 | 
					 | 
					 | 
					local function stop_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if player:get_meta():get("hbsprint:sprinting") == "true" then
 | 
					 | 
					 | 
					 | 
					  local name = player:get_player_name()
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if sprinting[name] then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if mod_player_monoids then
 | 
					 | 
					 | 
					 | 
					    if mod_player_monoids then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player_monoids.speed:del_change(player, "hbsprint:speed")
 | 
					 | 
					 | 
					 | 
					      player_monoids.speed:del_change(player, "hbsprint:speed")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player_monoids.jump:del_change(player, "hbsprint:jump")
 | 
					 | 
					 | 
					 | 
					      player_monoids.jump:del_change(player, "hbsprint:jump")
 | 
				
			
			
		
	
	
		
		
			
				
					
					| 
						
					 | 
					 | 
					@@ -62,13 +71,15 @@ local function stop_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    else
 | 
					 | 
					 | 
					 | 
					    else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player:set_physics_override({speed = 1, jump = 1})
 | 
					 | 
					 | 
					 | 
					      player:set_physics_override({speed = 1, jump = 1})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    sprinting[name] = false
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function drain_stamina(player)
 | 
					 | 
					 | 
					 | 
					local function drain_stamina(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  local player_stamina = tonumber(player:get_meta():get("hbsprint:stamina"))
 | 
					 | 
					 | 
					 | 
					  local player_stamina = player:get_meta():get_float("hbsprint:stamina")
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if player_stamina > 0 then
 | 
					 | 
					 | 
					 | 
					  if player_stamina > 0 then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    player:get_meta():set_float("hbsprint:stamina", player_stamina - stamina_drain)
 | 
					 | 
					 | 
					 | 
					    player_stamina = math.max(0, player_stamina - stamina_drain)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    player:get_meta():set_float("hbsprint:stamina", player_stamina)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if mod_hudbars then
 | 
					 | 
					 | 
					 | 
					  if mod_hudbars then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if autohide and player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end
 | 
					 | 
					 | 
					 | 
					    if autohide and player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end
 | 
				
			
			
		
	
	
		
		
			
				
					
					| 
						
					 | 
					 | 
					@@ -77,55 +88,62 @@ local function drain_stamina(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function replenish_stamina(player)
 | 
					 | 
					 | 
					 | 
					local function replenish_stamina(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  local player_stamina = tonumber(player:get_meta():get("hbsprint:stamina"))
 | 
					 | 
					 | 
					 | 
					  local player_stamina = player:get_meta():get_float("hbsprint:stamina")
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if player_stamina < 20 then
 | 
					 | 
					 | 
					 | 
					  if player_stamina < 20 then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    player:get_meta():set_float("hbsprint:stamina", player_stamina + stamina_drain)
 | 
					 | 
					 | 
					 | 
					    player_stamina = math.min(20, player_stamina + stamina_drain)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    player:get_meta():set_float("hbsprint:stamina", player_stamina)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if mod_hudbars then
 | 
					 | 
					 | 
					 | 
					  if mod_hudbars then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hb.change_hudbar(player, "stamina", player_stamina)
 | 
					 | 
					 | 
					 | 
					    hb.change_hudbar(player, "stamina", player_stamina)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if autohide and player_stamina == 20 then hb.hide_hudbar(player, "stamina") end
 | 
					 | 
					 | 
					 | 
					    if autohide and player_stamina >= 20 then hb.hide_hudbar(player, "stamina") end
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function drain_hunger(player, hunger, name)
 | 
					 | 
					 | 
					 | 
					local function drain_hunger(player, name)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if hunger > 0 then
 | 
					 | 
					 | 
					 | 
					  if starve == "hbhunger" then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local newhunger = hunger - starve_drain
 | 
					 | 
					 | 
					 | 
					    local hunger = tonumber(hbhunger.hunger[name]) - starve_drain
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if starve == "hbhunger" then
 | 
					 | 
					 | 
					 | 
					    hbhunger.hunger[name] = math.max(0, hunger)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hbhunger.hunger[name] = newhunger
 | 
					 | 
					 | 
					 | 
					    hbhunger.set_hunger_raw(player)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hbhunger.set_hunger_raw(player)
 | 
					 | 
					 | 
					 | 
					  elseif starve == "hunger_ng" then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    elseif starve == "hunger_ng" then
 | 
					 | 
					 | 
					 | 
					    hunger_ng.alter_hunger(name, -starve_drain, "Sprinting")
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hunger_ng.alter_hunger(name, - starve_drain, "Sprinting")
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function drain_breath(player)
 | 
					 | 
					 | 
					 | 
					local function drain_breath(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  local player_breath = player:get_breath()
 | 
					 | 
					 | 
					 | 
					  local player_breath = player:get_breath()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if player_breath < 11 then
 | 
					 | 
					 | 
					 | 
					  if player_breath < player:get_properties().breath_max then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    player_breath = player_breath - breath_drain
 | 
					 | 
					 | 
					 | 
					    player_breath = math.max(0, player_breath - breath_drain)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if player_breath > 0 then
 | 
					 | 
					 | 
					 | 
					    player:set_breath(player_breath)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      player:set_breath(player_breath)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local function create_particles(player, name, pos, ground)
 | 
					 | 
					 | 
					 | 
					local function is_walkable(ground)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if ground and ground.name ~= "air" and ground.name ~= "ignore" then
 | 
					 | 
					 | 
					 | 
					  local ground_def = minetest.registered_nodes[ground.name]
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local def = minetest.registered_nodes[ground.name]
 | 
					 | 
					 | 
					 | 
					  return ground_def and (ground_def.walkable and ground_def.liquidtype == "none")
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local tile = def.tiles[1] or def.inventory_image or ""
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if type(tile) == "string" then
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      for i = 1, particles do
 | 
					 | 
					 | 
					 | 
					local function create_particles(player, name, ground)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minetest.add_particle({
 | 
					 | 
					 | 
					 | 
					  local def = minetest.registered_nodes[ground.name]
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          pos = {x = pos.x + math.random(-1,1) * math.random() / 2, y = pos.y + 0.1, z = pos.z + math.random(-1,1) * math.random() / 2},
 | 
					 | 
					 | 
					 | 
					  local tile = def.tiles[1] or def.inventory_image
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          velocity = {x = 0, y = 5, z = 0},
 | 
					 | 
					 | 
					 | 
					  if type(tile) == "table" then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          acceleration = {x = 0, y = -13, z = 0},
 | 
					 | 
					 | 
					 | 
					    tile = tile.name
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          expirationtime = math.random(),
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          size = math.random() + 0.5,
 | 
					 | 
					 | 
					 | 
					  if not tile then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          vertical = false,
 | 
					 | 
					 | 
					 | 
					    return
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          texture = tile,
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        })
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      end
 | 
					 | 
					 | 
					 | 
					  local pos = player:get_pos()
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					  local rand = function() return math.random(-1,1) * math.random() / 2 end
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  for i = 1, particles do
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    minetest.add_particle({
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      pos = {x = pos.x + rand(), y = pos.y + 0.1, z = pos.z + rand()},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      velocity = {x = 0, y = 5, z = 0},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      acceleration = {x = 0, y = -13, z = 0},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      expirationtime = math.random(),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      size = math.random() + 0.5,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      vertical = false,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      texture = tile,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    })
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					
					| 
						
					 | 
					 | 
					@@ -147,71 +165,90 @@ if mod_hudbars and stamina then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end
 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					minetest.register_on_joinplayer(function(player)
 | 
					 | 
					 | 
					 | 
					minetest.register_on_joinplayer(function(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if mod_hudbars and stamina then hb.init_hudbar(player, "stamina", 20, 20, autohide) end
 | 
					 | 
					 | 
					 | 
					  if stamina then
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  player:get_meta():set_float("hbsprint:stamina", 20)
 | 
					 | 
					 | 
					 | 
					    if mod_hudbars then
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      hb.init_hudbar(player, "stamina", 20, 20, autohide)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    player:get_meta():set_float("hbsprint:stamina", 20)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end)
 | 
					 | 
					 | 
					 | 
					end)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					local function sprint_step(player, dtime)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local name = player:get_player_name()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if minetest.get_player_privs(name).fast then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    return
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if stamina then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    stamina_timer[name] = (stamina_timer[name] or 0) + dtime
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if breath then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    breath_timer[name] = (breath_timer[name] or 0) + dtime
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local ctrl = player:get_player_control()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local key_press
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if dir then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    key_press = ctrl.aux1 and ctrl.up and not ctrl.left and not ctrl.right
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    key_press = ctrl.aux1
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if not key_press then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    stop_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if stamina and stamina_timer[name] >= replenish then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      replenish_stamina(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      stamina_timer[name] = 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    return
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local ground_pos = player:get_pos()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  ground_pos.y = math.floor(ground_pos.y)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  -- check if player is reasonably near a walkable node
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local ground
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  for _, y_off in ipairs({0, -1, -2}) do
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    local testpos = vector.add(ground_pos, {x=0, y=y_off, z=0})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    local testnode = minetest.get_node_or_nil(testpos)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if testnode ~= nil and is_walkable(testnode) then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      ground = testnode
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      break
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local player_stamina = 1
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if stamina then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    player_stamina = player:get_meta():get_float("hbsprint:stamina")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  local hunger = 30
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if starve == "hbhunger" then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    hunger = tonumber(hbhunger.hunger[name])
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  elseif starve == "hunger_ng" then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    hunger = hunger_ng.get_hunger_information(name).hunger.exact
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if player_stamina > 0 and hunger > starve_limit and ground then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    start_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if stamina then drain_stamina(player) end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if starve then drain_hunger(player, name) end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if breath and breath_timer[name] >= 2 then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      drain_breath(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      breath_timer[name] = 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if particles then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      create_particles(player, name, ground)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    stop_sprint(player)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					minetest.register_globalstep(function(dtime)
 | 
					 | 
					 | 
					 | 
					minetest.register_globalstep(function(dtime)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  sprint_timer = sprint_timer + dtime
 | 
					 | 
					 | 
					 | 
					  sprint_timer = sprint_timer + dtime
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  stamina_timer = stamina_timer + dtime
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  breath_timer = breath_timer + dtime
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if sprint_timer >= sprint_timer_step then
 | 
					 | 
					 | 
					 | 
					  if sprint_timer >= sprint_timer_step then
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for _,player in ipairs(minetest.get_connected_players()) do
 | 
					 | 
					 | 
					 | 
					    for _, player in ipairs(minetest.get_connected_players()) do
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      local ctrl = player:get_player_control()
 | 
					 | 
					 | 
					 | 
					      sprint_step(player, sprint_timer)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      local key_press = false
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if key == "Use" and dir then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        key_press = ctrl.aux1 and ctrl.up and not ctrl.left and not ctrl.right
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      elseif key == "Use" and not dir then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        key_press = ctrl.aux1
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      -- if key == "W" and dir then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      --   key_press = ctrl.aux1 and ctrl.up or key_press and ctrl.up
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      -- elseif key == "W" then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      --   key_press = ctrl.aux1 or key_press and key_tap
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      -- end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if key_press then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local name = player:get_player_name()
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local hunger = 30
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local pos = player:get_pos()
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local ground = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local walkable = false
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local player_stamina = tonumber(player:get_meta():get("hbsprint:stamina"))
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if starve == "hbhunger" then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          hunger = tonumber(hbhunger.hunger[name])
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        elseif starve == "hunger_ng" then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          hunger = hunger_ng.get_hunger_information(name).hunger.exact
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ground ~= nil then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          local ground_def = minetest.registered_nodes[ground.name]
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if ground_def then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            walkable = minetest.registered_nodes[ground.name].walkable
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if player_stamina > 0 and hunger > starve_limit and walkable then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          start_sprint(player)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          player:get_meta():set_string("hbsprint:sprinting", "true")
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if stamina then drain_stamina(player) end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if starve then drain_hunger(player, hunger, name) end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if breath then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if breath_timer >= 2 then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					              drain_breath(player)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					              breath_timer = 0
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if particles then create_particles(player, name, pos, ground) end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          stop_sprint(player)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          player:get_meta():set_string("hbsprint:sprinting", "false")
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      else
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        stop_sprint(player)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        player:get_meta():set_string("hbsprint:sprinting", "false")
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if stamina_timer >= replenish then
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if stamina then replenish_stamina(player) end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          stamina_timer = 0
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      end
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    sprint_timer = 0
 | 
					 | 
					 | 
					 | 
					    sprint_timer = 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
	
		
		
			
				
					
					| 
						
					 | 
					 | 
					 
 |