Skip to content

Add a setting to allow players with fast privilege to sprint. #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ stamina.settings = {
sprint_lvl = get_setting("sprint_lvl", 6),
sprint_speed = get_setting("sprint_speed", 0.8),
sprint_jump = get_setting("sprint_jump", 0.1),
sprint_with_fast = minetest.settings:get_bool("stamina.sprint_with_fast", false),
tick = get_setting("tick", 800),
tick_min = get_setting("tick_min", 4),
health_tick = get_setting("health_tick", 4),
Expand Down Expand Up @@ -341,7 +342,7 @@ local function move_tick()
local can_sprint = (
controls.aux1 and
not player:get_attach() and
not minetest.check_player_privs(player, {fast = true}) and
(settings.sprint_with_fast or not minetest.check_player_privs(player, {fast = true})) and
stamina.get_saturation(player) > settings.sprint_lvl
)

Expand Down
1 change: 1 addition & 0 deletions settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ stamina.visual_max (hud bar only extends to 20)
stamina.sprint_speed (how much faster a player can run if satiated) float 0.8 0 2
stamina.sprint_jump (how much faster a player can jump if satiated) float 0.1 0 2
stamina.eat_particles (Whether to generate particles when eating) bool true
stamina.sprint_with_fast (Sprint when player has fast privilege?) bool false