37 Commits

Author SHA1 Message Date
Niklp
ef3e6616e9
Minor changes (#49)
- Optimize textures w/ optipng
- Remove mt 0.4 compatibility stuff
- Other minor stuff (play sounds ephemeral, tweak style of some comments, ...)
2024-06-05 17:56:45 +02:00
fluxionary
9f1acb4eaa
Behavior tweaks when eating "empty" food (#46)
- Allow eating food which doesn't restore saturation when the player is full
- Don't apply poison effect when eating food that isn't actually poisonous
2023-05-18 14:14:36 +02:00
fluxionary
b5df973174
Allow healing when max_hp is higher than max stamina (#45) 2023-05-14 14:51:49 +02:00
fluxionary
6e979b7cd8
Fix eaten item being replaced with copies of itself (#43) 2023-04-28 17:27:05 +02:00
fluxionary
78be994cab
Check that hp is less than hp_max when trying to heal (#44) 2023-03-18 08:53:50 +01:00
fluxionary
1b767e820b
Provide a proper reason table to set_hp instead of a string (#42) 2023-01-10 17:48:14 +01:00
fluxionary
86ac78d683
Add reasons to hp change calls (#41) 2023-01-04 14:36:06 +01:00
fluxionary
d2d2aef013
Show particles while eating foods without an inventory image (#40) 2022-10-29 21:36:04 +02:00
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
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
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
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