Hooks
Hooks provided by the Alcoholism module for managing blood alcohol content (BAC) and alcohol consumption effects.
Overview
The Alcoholism module implements a comprehensive intoxication system where players can consume alcoholic beverages that progressively increase their Blood Alcohol Content (BAC). As BAC rises, players experience visual impairments like screen blurring, movement slowdown, and other debilitating effects. The system includes BAC thresholds for different intoxication levels, automatic metabolism over time, and extensive hook integration for customizing alcohol effects, consumption mechanics, and sobriety recovery processes.
AlcoholConsumed
đ Purpose
Called when a player consumes an alcohol item.
â° When Called
After a player successfully drinks an alcohol item and their BAC has been increased.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player who consumed the alcohol |
item |
Item | The alcohol item that was consumed |
âŠī¸ Returns
nil
đ Realm
Server
BACChanged
đ Purpose
Called whenever a player's blood alcohol content (BAC) value changes.
â° When Called
After the BAC value has been updated on the server, whether it increased or decreased.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC changed |
newBac |
number | The new BAC value (0-100) |
âŠī¸ Returns
nil
đ Realm
Server
BACIncreased
đ Purpose
Called when a player's BAC value increases.
â° When Called
After BAC has been increased but before BACChanged is called.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC increased |
oldBac |
number | The previous BAC value |
newBac |
number | The new BAC value |
âŠī¸ Returns
nil
đ Realm
Server
BACReset
đ Purpose
Called when a player's BAC is reset to zero.
â° When Called
After BAC has been reset, typically when a character is loaded or respawns.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC was reset |
âŠī¸ Returns
nil
đ Realm
Server
BACThresholdReached
đ Purpose
Called when a player's BAC reaches a specific threshold level.
â° When Called
When BAC crosses a defined threshold value (e.g., 30%, 50%, 80%).
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player who reached the threshold |
bac |
number | The current BAC value |
threshold |
number | The threshold that was reached |
âŠī¸ Returns
nil
đ Realm
Server
PostBACDecrease
đ Purpose
Called after a player's BAC has been decreased during the degradation cycle.
â° When Called
After BAC degradation has been processed and the new value has been set.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC decreased |
newBac |
number | The new BAC value after decrease |
âŠī¸ Returns
nil
đ Realm
Server
PostBACReset
đ Purpose
Called after a player's BAC has been reset to zero.
â° When Called
After BAC reset has been completed.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC was reset |
âŠī¸ Returns
nil
đ Realm
Server
PreBACDecrease
đ Purpose
Called before a player's BAC is decreased during the degradation cycle.
â° When Called
Before BAC degradation is processed, allowing modification of the decrease rate.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC will decrease |
bac |
number | The current BAC value before decrease |
âŠī¸ Returns
nil
đ Realm
Server
PreBACIncrease
đ Purpose
Called before a player's BAC is increased from consuming alcohol.
â° When Called
Before BAC increase is processed, allowing modification of the increase amount.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC will increase |
item |
Item | The alcohol item being consumed |
amount |
number | The amount of BAC to add |
âŠī¸ Returns
nil or number - Return a modified amount to override the increase
đ Realm
Server
PreBACReset
đ Purpose
Called before a player's BAC is reset to zero.
â° When Called
Before BAC reset is processed, allowing cancellation of the reset.
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The player whose BAC will be reset |
âŠī¸ Returns
nil or boolean - Return false to prevent reset
đ Realm
Server