minetest/mods/stamina/depends.txt
Auke Kok d905f66d30 ~~~Hunger.~~~ Stamina
This code adds ~~~hunger~~~ stamina to minetest_game.

This code is entirely derived from Blockmen's hunger+hud mod.  Credits
and copyright are preserved as they are compatible with minetest_game.

gameplay:

The player stat 'stamina' is added. The higher the value, the better. A
value of 5 or higher causes the player to slowly get healed over time,
at the cost of stamina. One can only be healed if the stamina value is
higher than, or equal to the health value.

Eating food causes 'stamina' to increase. The visual range of stamina
is 0-20, but one can eat slightly over that. If the stamina is at max,
items are not eaten anymore.

At stamina 2 or lower, the player is damaged periodically, and will
die if the stamina value isn't increased due to eating.

If eating a food that has a negative hp_change value, such as red
mushrooms, the player takes periodical damage to the amount of the
hp_change value. During this time, the player is "poisoned". This
poison damage can not kill the player.

Added by me is code to add exhaustion on crafting, and on player
combat. I also added extra exhaustion when the player is jumping

code:

This mod started as BlockMen's hunger+hud mod. I trimmed the entire
hud mod away and placed the stamina bar on top of the hp hud element,
which will make the relation between stamina and hp a bit more clear,
and doesn't require moving the air hud element.

The stamina mod was reduced to fit a single file. I trimmed some
legacy code, revised all local/global usage. Renamed most internal
variables, and generally did a lot of removals of needlessly complex
code favoring simplicity.

The food registration code is entirely removed. Instead we assume food
just adds stamina or ticks damage as poison. Food eating callbacks are
still called. Subsequently, this mod will likely not properly work
with BlockMen's hud code anymore, nor is that intended to work. Food
mods just have to call item_eat().

I've moved and credited authors for the used textures. I replaced
the food sound of this mod with 3 different sounds.

The code points out several issues with core: There's no decent
place to store player stats. This mod solves it by creating a per
player inventory purely for storing an integer value. Intercepting
core.do_item_eat() also isn't the nicest way to make this work.
2016-02-17 07:16:02 -08:00

1 line
8 B
Text