> For the complete documentation index, see [llms.txt](https://botiv.gitbook.io/rdr2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://botiv.gitbook.io/rdr2/metabolism.md).

# Metabolism

### ⚡ Getting Started

The script is pre-configured in `config.lua`.\
To customize, remove lines 14–28 and adjust with your own system as needed.

***

### 🟦 Client Side

#### 💬 Events

* **Add Calories to Metabolism:**

  ```lua
  -- Client
  TriggerEvent("bt_metabolism:addToMetabolism", 100) 
  -- Server
  TriggerClientEvent("bt_metabolism:addToMetabolism", source, 100)
  ```
* **Remove Calories from Metabolism:**

  ```lua
  -- Client
  TriggerEvent("bt_metabolism:removeToMetabolism", 150) 
  -- Server
  TriggerClientEvent("bt_metabolism:removeToMetabolism", source, 150)
  ```
* **Set Metabolism Directly:**

  ```lua
  -- Client
  TriggerEvent("bt_metabolism:setMetabolism", 2100.0) 
  -- Server
  TriggerClientEvent("bt_metabolism:setMetabolism", source, 2100.0)
  ```

#### 🔌 Client Exports

* **Get current metabolism:**

  ```lua
  exports.bt_metabolism:getMetabolism() -- returns current Calories (e.g. 1450.0)
  ```
* **Add/Remove/Set metabolism:**

  ```lua
  exports.bt_metabolism:addToMetabolism(100)
  exports.bt_metabolism:removeToMetabolism(150)
  exports.bt_metabolism:setMetabolism(2100.0)
  ```

***

### ⚙️ Configuration Example (`config.lua`)

```lua
Config = {
    DEFAULT_METABOLISM   = 1500,   -- Starting Calories at character creation
    MAX_METABOLISM       = 3000,   -- Max metabolism before losing endurance
    MIN_METABOLISM       = 100,    -- Min metabolism before losing health

    -- Weight thresholds (visual body changes)
    WEIGHT_ONE        = 800,       -- Skinny
    WEIGHT_TWO        = 1200,      -- Skinny > normal
    WEIGHT_THREE      = 1700,      -- Normal > fat
    WEIGHT_FOUR       = 1800,      -- Fat > big
    WEIGHT_FIVE       = 2000,      -- Big

    ALLOW_PENALITY    = true,      -- Penalties for underweight/overweight (health/stamina)
    
    -- Calorie burning rates
    BASE_BURN_METABOLISM = 0.01,   -- At rest
    ON_HORSE_METABOLISM  = 0.015,  -- On horseback
    MOVE_BURN_METABOLISM = 0.02,   -- Walking
    RUN_BURN_METABOLISM  = 0.04,   -- Running/swimming

    REFRESH_METABOLISM   = 1,      -- Burn interval (seconds)
    REFRESH_SAVE_TIME    = 60,     -- How often metabolism is saved (seconds)
    HUNGRY_MSG           = "La faim vous brûle l'estomac...", -- Message at minimum metabolism
}
```

***

### 📌 Notes

* **Visual weight changes**: Player appearance adjusts at each threshold (skinny, normal, fat, etc).
* **Penalties**: Stamina drops if too fat, health drops if too skinny (if enabled).
* **Fully dynamic**: Calories change over time, with activity, and through events/items.
* **Multilingual**: Customize warning messages and thresholds in your config.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://botiv.gitbook.io/rdr2/metabolism.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
