Apply eat effect when hunger disabled

This commit is contained in:
Wuzzy 2019-02-06 21:23:05 +01:00
parent 93c86207d9
commit 4bd9be22e0
6 changed files with 247 additions and 158 deletions

View file

@ -1,19 +1,35 @@
# API information (WIP)
This API information is WIP. The mod API is still pretty much unofficial;
this mod is mostly seen as standalone for now.
This API information is not complete yet.
The mod API is still pretty much unofficial; this mod is mostly seen
as standalone for now.
This may change in the future development of MineClone 2. Hopefully.
## Before using this mod
This mod is a no-op when the game is started with damage disabled.
Before using any of the functions, first check if global variable
`mcl_hunger`” is present.
## Mod state
The hunger mechanic is disabled when damage is disabled
(setting `enable_damage=false`).
You can check the hunger state with `mcl_hunger.active`. If it's true,
then hunger is active.
## Hunger level
If the hunger is disabled, most of the functions are no-ops or return
default values.
## Player values
### Hunger level
The hunger level of the player is a whole number between 0 and 20 inclusive.
0 is starving and 20 is full. The hunger level is represented in
the HUD by a statbar with 20 half-icons.
### Saturation
To be written ...
### Exhaustion
To be written ...
## Functions
This API documentation is not complete yet, more documentation will
come.
### `mcl_hunger.get_hunger(player)`
Returns the current hunger level of `player` (ObjectRef).
@ -21,6 +37,15 @@ Returns the current hunger level of `player` (ObjectRef).
Sets the hunger level of `player` (ObjectRef) to `hunger` immediately.
`hunger` ***must*** be between 0 and 20 inclusive.
### `mcl_hunger.exhaust(player, exhaust)`
Increase exhaustion of player by `exhaust`.
### `mcl_hunger.stop_poison(player)`
Immediately stops all poisonings for player.
### More functions ...
There are more functions (of less importance) available, see `api.lua`.
## Groups
Items in group `food=3` will make a drinking sound and no particles.
Items in group `food` with any other rating will make an eating sound and particles,