[Mod] Sprint w. hudbars, hunger, monoids support [hbsprint]

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

[Mod] Sprint w. hudbars, hunger, monoids support [hbsprint]

by texmex » Post

License: LGPLv3/CC BY-SA 3.0. Particle code: copyright (c) 2017 Elijah Duffy, licensed MIT.

Description
A flexible sprint mod supporting stamina, hunger and coexistance with other physics altering mods.

Notes
hbSprint can be played with Minetest 0.4.16 or above.
It has no dependencies, but supports hudbars, hbhunger and player_monoids.

List of features
  • Displays and drains stamina (by default, if hudbars is present). Hides stamina bar if full.
  • Displays and drains satiation (by default, if hbhunger is present)
  • Drains air faster while sprinting on walkable ground but in water (by default)
  • Requires only forward key to be pressed, not left and right (by default)
  • Requires walkable ground (no water sprinting)
  • Particle spawning based on ground type (Thanks to octacian)
  • All variables customizable in Advanced settings or directly in minetest.conf
Known issues
  • Forward double tap support not implemented
Bug reports and suggestions
You can report bugs or suggest ideas by filing an issue.

Links
Last edited by texmex on Fri Sep 01, 2017 08:59, edited 4 times in total.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

My motivations for writing this mod are
  • that minetest-mod's stamina mod doesn't use hudbars
  • that GunsshipPenguin seem to have abandoned sprint
  • that octacian wanted to keep his mod light and not use hunger factors
  • to support player_monoids
  • the need of a customizable, optimized sprint mod
  • to learn writing a mod pretty much from scratch

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by Byakuren » Post

Thanks for the monoids support.
Every time a mod API is left undocumented, a koala dies.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Byakuren wrote:Thanks for the monoids support.
Thank you for making it. I have trouble with concurring speed events from another mod currently however. A speed potion gets cancelled out by this mod, in a similar way to the problems of the override method. Does anything look wrong with the code? Hbsprint works fine on its own.
Last edited by texmex on Wed Jul 12, 2017 16:42, edited 1 time in total.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by Byakuren » Post

texmex wrote:
Byakuren wrote:Thanks for the monoids support.
Thank you for making it. I have trouble with concurring speed events from another mod currently however. A speed potion gets cancelled out by this mod, in a similar way to the problems of the override method. Does anything look wrong with the code? Hbsprint works fine on its own.
What's the mod? player_monoids only ensures compatibility between mods that use player_monoids. Ideally I would be able to override stuff like set_physics_override, but I can't because you can't tell what mod the call is coming from.
Every time a mod API is left undocumented, a koala dies.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Byakuren wrote:What's the mod? player_monoids only ensures compatibility between mods that use player_monoids. Ideally I would be able to override stuff like set_physics_override, but I can't because you can't tell what mod the call is coming from.
The mod is herbs (also supports player_monoids). Its green tincture is supposed to increase speed sixfold, but it gets cancelled out shortly after activating it. It also works fine on its own, without hbsprint.

Update: I added a boolean check to not do monoid calls unnecessarily. This made the tincture speed cancellation happen a bit less and is now only invoked whenever that boolean is changed. So whenever hbsprint's monoid is updated, the tincture speed monoid is cancelled. "Simple sprinting" mod has the same issue.


All fine now! I was a clutz.
Last edited by texmex on Wed Jul 12, 2017 16:43, edited 3 times in total.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by azekill_DIABLO » Post

+1 seems very good!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Now drains air faster while sprinting on walkable ground but in water (by default).

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by Lone_Wolf » Post

Nice! Didn't see this one.
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by Stix » Post

i wish you would add double-tap support so this could work with your item-drop mod
Hey, what can i say? I'm the bad guy.

User avatar
AntumDeluge
Member
Posts: 213
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by AntumDeluge » Post

+1 Great mod.
Stix wrote:i wish you would add double-tap support so this could work with your item-drop mod
I think it's a good idea too.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Stix wrote:i wish you would add double-tap support so this could work with your item-drop mod
The mod already works with item-drop. Either by using Use key for both or by reconfiguring the item-drop pickup key in its settings.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

A multiplayer bug was fixed (caused everyone to sprint once one player sprinted). 3 fine PRs by Antum were merged.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by azekill_DIABLO » Post

texmex wrote:A multiplayer bug was fixed (caused everyone to sprint once one player sprinted).
and the effect stacked or not?
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

azekill_DIABLO wrote:
texmex wrote:A multiplayer bug was fixed (caused everyone to sprint once one player sprinted).
and the effect stacked or not?
Fixed since forever.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by azekill_DIABLO » Post

But did the effect staked? would have been fun to put on a server
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

John_Constructor
Member
Posts: 76
Joined: Thu Jun 01, 2017 20:06
GitHub: John-Constructor
In-game: Nooberton
Location: On Minetest 24/7

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by John_Constructor » Post

Tried it out, I found it slightly unnoticeable when I first tested it and a little later it seemed to work, but for some reason it seems not to last for more than about 5 to 10 blocks, this might be an illusion/something I am missing though.
Constructing mechs and wingless aircraft since 2016.

User avatar
AntumDeluge
Member
Posts: 213
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by AntumDeluge » Post

You can set sprint_speed & sprint_jump in minetest.conf.

I changed the default values to my liking:
  • Speed: 1.5 (instead of 1.3)
  • Jump: 1.3 (instead of 1.1)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

John_Constructor wrote:Tried it out, I found it slightly unnoticeable when I first tested it and a little later it seemed to work, but for some reason it seems not to last for more than about 5 to 10 blocks, this might be an illusion/something I am missing though.
It could be that you ran out of stamina (on by default) or that you ran out of food when using hudbars + hbhunger.

turducken
Member
Posts: 23
Joined: Fri Feb 02, 2018 01:43

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by turducken » Post

Having similar issues. I sprint for a few blocks, then it returns to normal speed. If I continue to hold the use key my stamina drains, as well as my food simultaneously, but there is no sprinting.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Both issues probably relatera to both of you using other mod(s) that use minetest.physics_override continously, therefore not playing nice with other physics mods. Turn those off and you should be able to use it again.

On that note, this mod actually does play nice with other physics mods by using player_monoids, given that those other mods also use player_monoids.

turducken
Member
Posts: 23
Joined: Fri Feb 02, 2018 01:43

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by turducken » Post

texmex wrote:Both issues probably relatera to both of you using other mod(s) that use minetest.physics_override continously, therefore not playing nice with other physics mods. Turn those off and you should be able to use it again.

On that note, this mod actually does play nice with other physics mods by using player_monoids, given that those other mods also use player_monoids.
It seems that the "playerplus" mod is the culprit. It adds nice effects like knockback, cactus hurting, slow walking on snow and suffocation when inside a node. I'm attempting to make it player_monoids compatible now.

EDIT: I went to go submit a patch for playerplus, and see you beat me to it on github. :)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

turducken wrote:I went to go submit a patch for playerplus, and see you beat me to it on github. :)
Heh, good to hear of more people who care. There's many minetest.physics_override based mods out there that also need love btw. :D

turducken
Member
Posts: 23
Joined: Fri Feb 02, 2018 01:43

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by turducken » Post

texmex wrote:
turducken wrote:I went to go submit a patch for playerplus, and see you beat me to it on github. :)
Heh, good to hear of more people who care. There's many minetest.physics_override based mods out there that also need love btw. :D
Yeah, I do care. It's a fun game with a good variety of mods.

I have noticed a lag when attempting to jump in caves (that extra boost needed to make the next block.) It would be nice to have a "lunge" option. To that effect I've been messing around with sprint_timer_step and noticed another physics issue.

If I set sprint_timer_step to 0.1, and adjust the drain and replenish values, while jumping it will stop sprinting. This slows you midair, where one would think your momentum would keep you at the faster speed until landing (I guess ignoring things like changing direction midair as possible :)

So part of the problem with lunging is the large step timer and check for walkable I believe. I suppose one would have to check if initiated on walkable, then check for air nodes, wait until not an air node and stop the sprint after touch down. One would have to stop the stamina drain during air time as well (since you aren't pushing off anything.)

I'm talking to myself I suppose here... I see in the sprint mod they simply decrease the stamina by dtime in global step, but is dtime variable, as that would throw a wrench into reducing hunger in predictable ways.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

by texmex » Post

Good spotting, turducken. This relates to the the walkable check, correct. It was mainly implemented with water in mind, so that you can't sprint run in or on the water surface which you can do with the other sprint mods available. I suppose I could check for walkable or air nodes instead of just walkables.
decrease the stamina by dtime in global step, but is dtime variable, as that would throw a wrench into reducing hunger in predictable ways
I agree, stamina should be independent of dtime, with its own timer. I'll se if I can get around to it.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests