diff --git a/README.md b/README.md index 63444bcb..28a21461 100644 --- a/README.md +++ b/README.md @@ -548,7 +548,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m [patch.gems_encrustable]: https://github.com/AntumMT/mod-gems_encrustable/tree/a043b9c [patch.gems_tools]: https://github.com/AntumMT/mod-gems_tools/tree/cc86c61 [patch.hbarmor]: https://github.com/AntumMT/mod-hbarmor/tree/587dae9 -[patch.hbsprint]: https://github.com/AntumMT/mod-hbsprint/tree/4961941 +[patch.hbsprint]: https://github.com/AntumMT/mod-hbsprint/tree/f406038 [patch.helicopter]: https://github.com/AntumMT/mod-helicopter/tree/9ffee1f [patch.home_gui]: https://github.com/AntumMT/mod-home_gui/tree/588e78f [patch.homedecor]: https://github.com/AntumMT/mp-homedecor/tree/d0d79dc diff --git a/minetest.conf.example b/minetest.conf.example index 877cee2c..b1db0a24 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1945,6 +1945,82 @@ mobs_animal:sheep_white = 0 +################### +## PLAYER ACTION ## +################### + +# *** hbsprint *** + +## If enabled (default), the stamina indicators in the HUD +# will be automatically hidden shortly after stamina has +# filled up. Otherwise, stamina will always be displayed. +# type: bool +# default: true +#hudbars_autohide_stamina = true + +## Sprint speed multiplier. +# type: float +# default: 1.5 +#sprint_speed = 1.5 + +## Sprint jump multiplier. +# type: float +# default: 1.3 +#sprint_jump = 1.3 + +## Which key to use for sprint. +# type: enum +# values: Use +# default: Use ("E" key by default) +#sprint_key = Use + +## Require player to move forward only to be able to sprint. +# type: bool +# default: true +#sprint_forward_only = true + +## The amount of particles to spawn behind a sprinting player. +# type: float +# default: 2 +#sprint_particles = 2 + +## Drain stamina while sprinting +# type: bool +# default: true +#sprint_stamina = true + +## The amount of stamina to drain while sprinting +# type: float +# default: 2 +#sprint_stamina_drain = 2 + +## The amount of seconds before starting to replenish stamina. +# type: float +# default: 2 +#sprint_stamina_replenish = 2 + +## Drain satiation while sprinting. +# type: bool +# default: true +#sprint_starve = true + +## The amount of satiation to drain while sprinting. +# type: float +# default: 0.5 +#sprint_starve_drain = 0.5 + +## Drain air while sprinting under water. +# type: bool +# default: true +#sprint_breath = true + +## The amount of air to drain while sprinting under water. +# type: float +# default: 1 +#sprint_breath_drain = 1 + + + #################### ## PLAYER VISUALS ## #################### diff --git a/mods/player/action/hbsprint/README.md b/mods/player/action/hbsprint/README.md index e2b912a9..c080bd7d 100644 --- a/mods/player/action/hbsprint/README.md +++ b/mods/player/action/hbsprint/README.md @@ -1,9 +1,15 @@ # hbSprint -License: LGPLv2.1/CC BY-SA 3.0. Particle code: copyright (c) 2017 Elijah Duffy. ## Description A flexible sprint mod supporting stamina, hunger and coexistance with other physics altering mods. +## Licensing +- LGPLv2.1/CC BY-SA 3.0. Particle code: copyright (c) 2017 Elijah Duffy. +- sprint_stamina_\*icon textures: + - CC0 + - Created by Jordan Irwin (AntumDeluge) + - Based on [Running man icon by manio1](https://openclipart.org/detail/254287) + ## Notes hbSprint can be played with Minetest 0.4.16 or above. It has no dependencies, but it supports on [hudbars](http://repo.or.cz/w/minetest_hudbars.git), [hbhunger](http://repo.or.cz/w/minetest_hbhunger.git) and [player_monoids](https://github.com/minetest-mods/player_monoids). @@ -18,6 +24,7 @@ It has no dependencies, but it supports on [hudbars](http://repo.or.cz/w/minetes - Particle spawning based on ground type (Thanks to [octacian](https://github.com/octacian/sprint/)) - All variables customizable in Advanced settings or directly in minetest.conf + ## Known issues - Forward double tap support not implemented diff --git a/mods/player/action/hbsprint/init.lua b/mods/player/action/hbsprint/init.lua index 20929018..5ba1494c 100644 --- a/mods/player/action/hbsprint/init.lua +++ b/mods/player/action/hbsprint/init.lua @@ -12,6 +12,7 @@ local starve = minetest.settings:get_bool("sprint_starve") local starve_drain = tonumber(minetest.settings:get("sprint_starve_drain")) or 0.5 local breath = minetest.settings:get_bool("sprint_breath") local breath_drain = tonumber(minetest.settings:get("sprint_breath_drain")) or 1 +local autohide = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false if dir ~= false then dir = true end if stamina ~= false then stamina = true end if starve ~= false then starve = true end @@ -61,7 +62,7 @@ local function drain_stamina(player) player:set_attribute("stamina", player_stamina - stamina_drain) end if hudbars then - if player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end + if autohide and player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end hb.change_hudbar(player, "stamina", player_stamina) end end @@ -73,7 +74,7 @@ local function replenish_stamina(player) end if hudbars then hb.change_hudbar(player, "stamina", player_stamina) - if 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 @@ -124,7 +125,9 @@ if minetest.get_modpath("hudbars") ~= nil and stamina then player_stamina, player_stamina, false, "%s: %.1f/%.1f") hudbars = true - hb.hide_hudbar(player, "stamina") + if autohide then + hb.hide_hudbar(nil, "stamina") + end end minetest.register_on_joinplayer(function(player) diff --git a/mods/player/action/hbsprint/settingtypes.txt b/mods/player/action/hbsprint/settingtypes.txt index 885b8099..affe8f78 100644 --- a/mods/player/action/hbsprint/settingtypes.txt +++ b/mods/player/action/hbsprint/settingtypes.txt @@ -33,3 +33,7 @@ sprint_breath (Breath) bool true #The amount of air to drain while sprinting under water sprint_breath_drain (Breath drain) float 1 + +#If enabled (default), the stamina indicators in the HUD will be automatically hidden shortly +#after stamina has filled up. Otherwise, stamina will always be displayed. +hudbars_autohide_stamina (Automatically hide staminal indicator) bool true diff --git a/mods/player/action/hbsprint/textures/sprint_stamina_bgicon.png b/mods/player/action/hbsprint/textures/sprint_stamina_bgicon.png index baade325..8e562951 100644 Binary files a/mods/player/action/hbsprint/textures/sprint_stamina_bgicon.png and b/mods/player/action/hbsprint/textures/sprint_stamina_bgicon.png differ diff --git a/mods/player/action/hbsprint/textures/sprint_stamina_icon.png b/mods/player/action/hbsprint/textures/sprint_stamina_icon.png index f37fd300..89fce3b0 100644 Binary files a/mods/player/action/hbsprint/textures/sprint_stamina_icon.png and b/mods/player/action/hbsprint/textures/sprint_stamina_icon.png differ diff --git a/settingtypes.txt b/settingtypes.txt index 9fd75979..3ed6b618 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -93,40 +93,44 @@ hbarmor_tick (Armor HUD bar update frequency) float 0.1 0.0 4.0 [*hbsprint] -#Sprint speed multiplier +# If enabled (default), the stamina indicators in the HUD will be automatically hidden shortly +# after stamina has filled up. Otherwise, stamina will always be displayed. +hudbars_autohide_stamina (Automatically hide staminal indicator) bool true + +# Sprint speed multiplier. sprint_speed (Sprint speed multiplier) float 1.5 -#Sprint jump multiplier +# Sprint jump multiplier. sprint_jump (Sprint jump multiplier) float 1.3 -#Use a key to sprint +# Which key to use for sprint. Default: "Use" ("E" key by default). sprint_key (Sprint key) enum Use Use -#Require player to move forward only to be able to sprint +# Require player to move forward only to be able to sprint. sprint_forward_only (Sprint forward only) bool true -#The amount of particles to spawn behind a sprinting player +# The amount of particles to spawn behind a sprinting player. sprint_particles (Particles) float 2 -#Drain stamina while sprinting +# Drain stamina while sprinting. 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 -#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 -#Drain satiation while sprinting +# Drain satiation while sprinting. sprint_starve (Starve) bool true -#The amount of satiation to drain while sprinting +# The amount of satiation to drain while sprinting. sprint_starve_drain (Starve drain) float 0.5 -#Drain air while sprinting under water +# Drain air while sprinting under water. sprint_breath (Breath) bool true -#The amount of air to drain while sprinting under water +# The amount of air to drain while sprinting under water. sprint_breath_drain (Breath drain) float 1