PLAYER stamina mod
Go to file
mckaygerhard 3ae96044a6 upstream merge sync: fix redundant checks for players, backguard compatibility
* sync commit "added 0.4.x support and fake player check function"
2023-07-24 05:54:49 -04:00
sounds replace sip sound with licensed one 2022-11-24 08:36:52 +00:00
textures add particle effects for being drunk and poisoned 2021-06-21 12:24:41 +01:00
README.md Improve the readme for minenux 2022-01-21 10:06:44 -04:00
README.txt sync player nil checks; add settings for stamina speed, jump and drain 2023-07-23 18:37:50 -04:00
depends.txt tweak lucky blocks and update readme 2022-07-30 07:45:07 +01:00
description.txt update mod.conf info 2021-01-21 10:46:04 +00:00
init.lua upstream merge sync: fix redundant checks for players, backguard compatibility 2023-07-24 05:54:49 -04:00
license.txt add license.txt file 2022-11-29 08:12:54 +00:00
lucky_block.lua it was not a bug at lucky_block.lua 2023-07-24 05:41:16 -04:00
mod.conf add stamina.mod = "redo" flag, add lucky blocks 2021-06-08 18:27:28 +01:00
screenshot.png add screenshot 2019-03-02 19:37:37 +00:00
settingtypes.txt sync code with MR and comment on performance issues 2023-07-23 21:01:21 -04:00

README.md

Minetest mod "Stamina"

It adds a stamina, or "hunger" mechanic to Minetest

Information:

This mod adds a stamina, or "hunger" mechanic to Minetest. Actions like crafting, walking, digging or fighting make the player exhausted. When enough exhaustion has been accumulated, the player gets more hungry, and loses stamina.

If a player is low on stamina, they start taking periodical damage, and ultimately will die if they do not eat food.

Eating food no longer heals the player. Instead, it increases the stamina of the player. The stamina bar shows how well fed the player is. More bread pieces means more stamina.

Walking while holding down Aux1 (usually E key) will make player sprint so long as their stamina bar is 3 or more bread. This will make the player run that bit faster and jump a tiny bit higher.

Q&A time: Why won't I move the stamina bar to the right?

Answer: this conflicts with the builtin breath bar. To move the builtin breath bar, I basically have to entirely re-implement it in lua including timers to catch breath changes for each online player, which is all a waste of time, just to move a few pixels around.

Downloads

Original mod is at github on https://github.com/minetest-mods/stamina, this version is a fork over the Tenplus1 version (Check the tech info below), you can download at https://codeberg.org/minenux/minetest-mod-stamina .

This version just try to be sure works over minetst 0.4 and also 5.X, with some checks focused on olders versions like 5.0, 5.2 and 0.4.17

Technical information:

This mod intercepts minetest.item_eat(), and applies the hp_change as stamina change. The value can be positive (increase stamina) or negative (periodically damage the player by 1 hp).

Depends

  • default
  • 3d_armor (optional)
  • player_monoids/pova (both alternative it, both optionally)

TenPlus1 Additions:

  • Added support for POVA and player_monoids
  • Added Pipeworks checks for fake players
  • Added 60 second drunk effect when foods have {alcohol=1} group (eat 4 or more)
  • Moved exhaustion and hud_id to player table instead of player attributes

The player phishics are set on Pova or Player_monoids but not both at the same time, only the first detected is apply.

Callbacks

Callbacks that are registered via minetest.register_on_item_eat() are called after this mod, so the itemstack will have changed already when callbacks are called. You can get the original itemstack as 6th parameter of your function then.

A global function is available for mods to change player stamina levels:

stamina.change(player, change)

License:

(C) 2015 - BlockMen (C) 2016 - Auke Kok sofar@foo-projects.org

Code:

stamina_burp.ogg - https://www.freesfx.co.uk/sfx/burp (small burp) stamina_sip.ogg - https://elements.envato.com/sip-16081-C7V5YLG