2017-02-16 17:25:07 +03:00
|
|
|
# API information (WIP)
|
2019-02-06 23:23:05 +03:00
|
|
|
This API information is not complete yet.
|
|
|
|
The mod API is still pretty much unofficial; this mod is mostly seen
|
|
|
|
as standalone for now.
|
|
|
|
|
2017-02-16 17:25:07 +03:00
|
|
|
This may change in the future development of MineClone 2. Hopefully.
|
|
|
|
|
2019-02-06 23:23:05 +03:00
|
|
|
## 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.
|
|
|
|
|
|
|
|
If the hunger is disabled, most of the functions are no-ops or return
|
|
|
|
default values.
|
2017-02-22 15:33:45 +03:00
|
|
|
|
2019-02-06 23:23:05 +03:00
|
|
|
## Player values
|
|
|
|
### Hunger level
|
2017-02-21 17:58:51 +03:00
|
|
|
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.
|
|
|
|
|
2019-02-06 23:23:05 +03:00
|
|
|
### Saturation
|
|
|
|
To be written ...
|
|
|
|
|
|
|
|
### Exhaustion
|
|
|
|
To be written ...
|
|
|
|
|
2017-02-21 17:58:51 +03:00
|
|
|
## Functions
|
2019-02-06 23:23:05 +03:00
|
|
|
This API documentation is not complete yet, more documentation will
|
|
|
|
come.
|
|
|
|
|
2017-02-21 17:58:51 +03:00
|
|
|
### `mcl_hunger.get_hunger(player)`
|
|
|
|
Returns the current hunger level of `player` (ObjectRef).
|
|
|
|
|
|
|
|
### `mcl_hunger.set_hunger(player, hunger)`
|
|
|
|
Sets the hunger level of `player` (ObjectRef) to `hunger` immediately.
|
|
|
|
`hunger` ***must*** be between 0 and 20 inclusive.
|
|
|
|
|
2019-02-06 23:23:05 +03:00
|
|
|
### `mcl_hunger.exhaust(player, exhaust)`
|
|
|
|
Increase exhaustion of player by `exhaust`.
|
|
|
|
|
|
|
|
### `mcl_hunger.stop_poison(player)`
|
2020-08-13 19:44:33 +03:00
|
|
|
Immediately stops food poisoning for player.
|
2019-02-06 23:23:05 +03:00
|
|
|
|
|
|
|
### More functions ...
|
|
|
|
There are more functions (of less importance) available, see `api.lua`.
|
|
|
|
|
2017-02-16 17:25:07 +03:00
|
|
|
## 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,
|
|
|
|
based on the inventory image or wield image (whatever is available first).
|
|
|
|
|
|
|
|
## Suppressing food particles
|
|
|
|
Normally, all food items considered food (not drinks) make food particles.
|
|
|
|
You can suppress the food particles by adding the field
|
|
|
|
`_food_particles=false` to the item definition.
|