Metabolism System

CAS Metabolism - Configuration & Exports Guide

Table of Contents

  1. Configuration Files

    • Client Config

    • Server Config

    • Shared Config

    • Item Configuration

  2. Client Exports

  3. Server Exports


Configuration Files

Client Config

File: config/client_config.lua

Basic Settings

Config.SettingsMenuCommand = "hudsettings"

Command to open the HUD settings menu.

Command to toggle HUD visibility on/off.

Command to show HUD while sprinting.

Voice system for microphone display. Options: "pma", "salty", "mumble", "auto"

Notification system to use. Options: "cas-simplenotify", "cas-notification", "vorp", "rsg"

Use CAS progress bar for item consumption animations.

Maximum health value (framework dependent). Used for health bar calculations.

Default HUD theme for new players. Options: "western", "minimal", "wave"


Metabolism Decay Settings

Base hunger decrease: Every 10 seconds, hunger decreases by 0.4% (idle/walking).

Base thirst decrease: Every 15 seconds, thirst decreases by 0.4% (idle/walking).

Increased decay rates while running/sprinting.

Set to true to continue decreasing stats while player is AFK.


Activity Multipliers

Multipliers for hunger/thirst decay based on player activity.

  • idle: Barely moving

  • walk: Walking speed

  • run: Jogging

  • sprint: Full sprint

  • coast: Standing still

  • swim: Swimming

  • mounted: On horseback


Starvation & Dehydration

Seconds to wait after both hunger and thirst reach 0 before health damage starts. Set to 0 to disable.

Seconds between health damage ticks when starving/dehydrated.

Health points removed per tick when starving. Set to 0 to disable damage.


Stress System

Enable/disable the stress system.

Enable screen shake effect when stress is high.

Settings explained:

  • minimumSpeedMph: Speed (MPH) needed to start gaining stress from travel

  • speedStressMin/Max: Random stress amount added per check

  • shootingStressChance: Probability (0.0-1.0) of gaining stress when shooting

  • effectMinimumSeverity: Stress % when visual effects start

  • shakeIntensityMin/Max: Screen shake strength range

  • damageSeverityThreshold: Stress % when health damage begins

  • damageDelayMinutes: Time before damage starts at high stress

  • damageAmount: HP removed per tick


Sleep System

Sleep Settings:

  • gainPerMinute: How fast sleep accumulates per activity type (higher = faster fatigue)

  • drunkGainMult: Sleep builds 20% faster when drunk above threshold

  • lowNeedGainMult: Sleep builds 15% faster when hunger/thirst below threshold

  • drowsy.startAt: Sleep % when blinking effects start (90%)

  • microsleep.startAt: Sleep % when brief blackouts can occur (95%)

  • knockout.startAt: Sleep % when full knockout is possible (99%)

  • beds.reducePerSecond: How much sleep decreases per second when sleeping in bed

  • beds.entries: Add bed/bedroll models where players can sleep


Cleanliness System

  • MinCleanPercent: Cleanliness % threshold for warnings

  • PenaltyIntervalSeconds: Damage frequency when too dirty

  • DamagePerTick: HP damage per tick

  • DoFx: Apply visual dirt effects


Temperature System

Temperature range in Celsius.

Health damage from extreme temperatures.

Seconds between temperature warnings.

Extra thirst drain in hot weather.

Indoors temperature adjustment toward comfortable level.

Warmth bonus from nearby campfires.


Intoxication System

Walking styles applied at different drunk levels.

Vomiting system when too drunk or overeating/drinking.

Prevents overeating/overdrinking. After triesToVomit attempts, player vomits.


HUD Colors

Default HUD element colors (hex format).


Color Presets

Pre-made color themes players can select. Each preset contains:

  • hudColors: Progress bar colors

  • iconColors: Icon colors when full

  • emptyIconColors: Icon colors when empty


Minimap Styles

Available minimap style options.


Warning & Need Decay

Seconds to wait before decay begins after refilling hunger/thirst (5 minutes grace period).

Hunger/thirst % at which warnings trigger.

Seconds between repeated warnings.


Server Config

File: config/server_config.lua

Settings:

  • Enabled: Enable MySQL database persistence

  • Table: Database table name

  • SaveIntervalMs: How often to save data (60000ms = 1 minute)

  • AlsoSyncFramework: Also update framework's status system for compatibility

  • UseCharacterIdentifier: Use character-specific storage (multi-character support)

  • Debug: Enable debug prints


Shared Config

File: config/shared_config.lua

Tobacco Prompts

Key bindings for tobacco system.


Item Configuration

File: config/shared_config.lua (inside Config.ItemsToUse table)

Item Structure

Each item in Config.ItemsToUse follows this format:

Field Descriptions

Field
Type
Description

Name

String

Item spawn code (must match framework item)

Thirst

Number

Thirst points restored (0-100 scale but can exceed)

Hunger

Number

Hunger points restored (0-100 scale but can exceed)

Metabolism

Number

Metabolism boost

Stamina

Number

Stamina points added

InnerCoreHealth

Number

Inner health core boost

OuterCoreHealth

Number

Outer health core boost

stress

Table

Stress modification: mode = "increase" or "decrease", value = amount

drunk

Table

Intoxication modification: mode = "increase" or "decrease", value = amount

Animation

String

Animation type: "eat", "drink", "coffee", "stew", "smoke", "chew", "bandage", "syringe"

SmokeEvent

String

For tobacco items, custom prop event

Effect

String

Visual effect name (e.g., "PlayerDrunkSaloon1")

EffectDuration

Number

Effect duration in minutes

PropName

String

3D prop model to display during consumption

GiveBackItemLabel

String

Display name of returned item

GiveBackItem

String

Item spawn code to return after use (e.g., empty bottle)

GiveBackItemAmount

Number

Amount of returned item

InnerCoreHealthGold

Number

Duration (minutes) of gold inner health core

OuterCoreHealthGold

Number

Duration (minutes) of gold outer health core

InnerCoreStaminaGold

Number

Duration (minutes) of gold inner stamina core

OuterCoreStaminaGold

Number

Duration (minutes) of gold outer stamina core

coffeeBuff

Table

Coffee buff settings (see below)

Coffee Buff System

  • enabled: Enable coffee buff

  • durationMinutes: How long buff lasts (reduces sleep accumulation rate)

  • sleepReduction: Immediately reduce sleep by this amount when consumed

Example Items

Food:

Drink:

Coffee with Buff:

Tobacco:

Medical:


Client Exports

All client exports are used from other scripts like this:

Generic Getters & Setters

Get Value

Get any metabolism value by path.

Parameters:

  • keyPath (string): Path to the value (e.g., "hunger", "health.inner")

Returns: The value or nil if not found


Set Value

Set any metabolism value by path.

Parameters:

  • keyPath (string): Path to the value

  • value (any): New value to set

  • opts (table, optional):

    • apply (boolean): Apply health/stamina changes to game immediately

    • flush (boolean): Force immediate server sync

Returns: true on success, false on failure


Add Value

Add or subtract from a numeric value.

Parameters:

  • keyPath (string): Path to the numeric value

  • delta (number): Amount to add (negative to subtract)

  • opts (table, optional): Same as Set options

Returns: true on success, false on failure


Get All Values

Get all metabolism values at once.

Returns: Table with all current metabolism data


Specific Getters & Setters

Hunger


Thirst


Stress


Drunk


Sleep


Health (Inner/Outer)


Stamina (Inner/Outer)


Advanced Functions

Apply Vitals

Manually apply health/stamina values from metabolism data to the game.

Useful after making multiple changes and wanting to apply them all at once.


Usage Examples

Hunger Penalty System:

Reward System:

Health Check:

Force Full Recovery:


Server Exports

All server exports are used from other scripts like this:

Level System Exports

Get XP

Get a player's current XP amount.

Parameters:

  • identifier (string): Character identifier

Returns: XP amount (number)


Add XP

Give XP to a player.

Parameters:

  • amount (number): XP to add

  • identifier (string): Character identifier

  • source (number): Player server ID

Notes:

  • Automatically handles level-ups (100 XP = 1 level)

  • Updates client HUD automatically

  • Saves to JSON file


Remove XP

Remove XP from a player (can cause level down).

Parameters:

  • amount (number): XP to remove

  • identifier (string): Character identifier

  • source (number): Player server ID

Notes:

  • Can reduce level if XP goes below 0

  • Minimum level is 1


Get Level

Get a player's current level.

Parameters:

  • identifier (string): Character identifier

Returns: Level (number)


Get Level Data

Get complete level data for a player.

Parameters:

  • identifier (string): Character identifier

Returns: Table with { xp = number, level = number } or nil


Server Export Usage Examples

Mission Reward System:

Level-Based Permissions:

Death Penalty:

Leaderboard System:


Tips & Best Practices

Configuration Tips

  1. Balance Difficulty: Adjust ActivityMultipliers to make survival easier or harder

  2. Grace Periods: Use NeedsDecayStartDelay to give players time after eating/drinking

  3. Stress Management: Adjust StressSettings.shootingStressChance for roleplay vs combat servers

  4. Sleep System: Modify gainPerMinute values to make sleep more/less demanding

  5. Visual Effects: Disable EnableShakeEffectForStress if players find it annoying

Export Best Practices

Client Side:

  • Always check return values when using Get() functions

  • Use apply = true option when changing health/stamina for immediate effect

  • Batch multiple changes before applying vitals for better performance

Server Side:

  • Always validate identifier before using level functions

  • Store character identifier once instead of calling GetPlayerIdentifier repeatedly

  • Consider XP balancing: 100 XP per level is default, plan rewards accordingly

Common Patterns

Stat Check Before Action:

Full Status Reset:

Progress Tracking:


For additional support or questions, refer to the script's main files or contact the developer.

Last updated