33 Commits

Author SHA1 Message Date
SX
1a6e893f09
Mitigate error if metadata is not valid (disconnected player) (#38) 2021-10-12 20:36:19 +02:00
OgelGames
9fa18c564b
Add hidden background texture (#35)
* Add hidden background texture

* Remove old texture
2020-12-28 11:30:24 +01:00
Thomas--S
b4519d13db
Fix error with latest Minetest-dev version by fixing the logical order (#34)
`stamina.set_saturation()` uses the hud id set for the player. Thus, the id should be set before calling this function.
Until now, it only worked because of undocumented behaviour. See minetest/minetest#10568
2020-10-31 13:06:45 +01:00
Thomas--S
e4e456a3c9
Fix error caused by outdated player reference (#32)
Previously, the player object was stored for later usage which leads to a crash when a player leaves the server while being poisoned.
2020-10-24 18:16:07 +02:00
Elia Argentieri
0dc0e2a226
Add a setting to allow players with fast privilege to sprint. (#31) 2020-04-13 20:46:21 +02:00
fluxionary
228f5d376e
Use new player metadata API when available (#29)
Make use of existing minetest.is_player() method

Don't store the stamina HUD ID as player metadata
2020-03-19 22:48:30 +01:00
fluxionary
6ee95f9bb8 Add nil check for replace_with_item (#28)
Needed because str:format in Lua5.1 will not interpret nil values, whereas LuaJIT will interpret them.
2019-11-26 19:24:30 +01:00
fluxionary
5bb5417867 Create an API for stamina with player_monoids compatbility (#26) 2019-07-31 19:45:37 +02:00
fluxionary
7a6b6f13c0 Fix privilege check (#25) 2019-07-29 19:08:27 +02:00
coil
e8a3aac671 Apply starvation damage only if player is not dead (#22)
This prevents on_dieplayer being called unnecessarily, causing problems such as repeated death messages.
2019-07-20 09:00:30 +02:00
Serhiy Zahoriya
27c8b40b6a Do not starve players without interact priv (#24)
No interact priv should only keep stamina below healing level
2019-07-20 08:58:30 +02:00
tenplus1
743fcec49a reset poisoned
this resets poisoned flag incae player signs out while poisoned and comes back only to find they never heal.
2018-02-26 11:48:48 -08:00
Auke Kok
dad5184d37 Add a screenshot. 2018-02-18 21:57:24 -08:00
Diogo Gomes
f43c6b5600 Add bower support 2017-06-20 13:02:24 -07:00
Auke Kok
43dd5438f7 Fix "Use player attribute storage for stats."
This was a mismerge, or a bad patch, it never passed luacheck.
2017-03-31 21:31:51 -07:00
tenplus1
b1485d2af4 Add particle effect when eating
Adds a particle effect when eating.
2017-03-31 21:27:00 -07:00
tenplus1
16f284eaf2 Tidy up set_sprinting
Tidied up set_sprinting function
2017-03-22 10:38:39 -07:00
Auke Kok
a7a5cbadcb Add .luacheckrc, and fix issues. 2017-03-14 21:20:51 -07:00
Auke Kok
a7829a7e5f Test for player by attribute function.
:is_player() is potentially unreliable because pipeworkds fakes
it, but if it does fake it, and it fakes :set_attribute() as well
then we should just consider it a real player. It doesn't of course.

Tested with pipeworks.

Removed one function indirection as well.
2017-03-11 13:45:00 -08:00
bewlay
4efa14179d Use player attribute storage for stats. 2017-02-21 10:27:15 -08:00
tenplus1
bb25e23917 Fix replacement stack bug (#8)
Found a bug where you would eat something that returns a bucket or glass and it wouldn't take the original item.
2016-07-20 10:47:20 -07:00
tenplus1
4b158d3102 Add global function stamina.change(player, change) 2016-07-20 10:44:31 -07:00
tenplus1
14b297a0cb dont heal while poisoned (#6)
dont heal while poisoned
2016-06-16 09:58:37 -07:00
tenplus1
c73317a607 Optimized Sprint Code
Optimied sprint code and general tidying.
2016-06-12 14:11:57 -07:00
tenplus1
95461cb965 Add Sprint function with support for 3d_armor (#4)
Added Sprint function with support for 3D armor physics (disabled
for players using 'fast')  Use E key to sprint.
2016-06-11 17:00:40 -07:00
Auke Kok
44e0943ad8 Remove unused field.
Fixes #2
2016-04-06 20:47:11 -07:00
Auke Kok
f538782290 Why I won't move the stamina bar. 2016-04-05 21:03:18 -07:00
Auke Kok
c610285972 Accidentally commited deletion of these.
This was supposed to remain in the mod.
2016-03-08 21:19:25 -08:00
Auke Kok
5303209afa Don't kill idle players.
We stop reducing stamina if players are idle and have lost most of
their available stamina. The stamina is reduced to a level where it
can't heal the player, but also doesn't hurt the player.
2016-03-05 14:45:55 -08:00
Auke Kok
8f8956e9b7 Update stamina max handling
There no longer is a real stamina cap. Any food eaten while stamina
is not at the visual max(20) will have its stamina value added
entirely to the stamina value, exceeding the visual max, so
no food value is ever lost. However, you can't eat foods anymore
when the stamina value is at or over the visual cap.
2016-02-16 22:04:43 -08:00
Auke Kok
96588a16ea Code cleanups, fix craft/punch exhaustion.
- add exhaustion for punhing players
- fix exhaustion for craftin (was not working)
- add more exhaustion when jumping (double of walking)

I radically made the action callers simpler by pushing
all the validity checks down, which removes a bunch of
functions that were just duplicating code. This makes
much of it a lot more straightforward and easier to
understand.
2016-02-16 19:59:44 -08:00
Auke Kok
7e8c00b1bc Style changes/fixes/typos to README.txt 2016-02-16 19:04:49 -08:00
Auke Kok
503a0f7b62 Stamina mod.
This mod implements a reduced version of BlockMen's hunger+hud
mod, implementing a player "stamina" stat that converts food
hp_change to stamina points. Stamina points heal the player
over time if they are available and higher than the HP amount.
2016-02-16 16:33:58 -08:00