|
| 1 | +# Alcoholism Module Hooks |
| 2 | + |
| 3 | +Hooks provided by the Alcoholism module for managing blood alcohol content (BAC) and alcohol consumption effects. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +Overview |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +### AlcoholConsumed |
| 14 | + |
| 15 | +#### 📋 Purpose |
| 16 | +Called when a player consumes an alcohol item. |
| 17 | + |
| 18 | +#### ⏰ When Called |
| 19 | +After a player successfully drinks an alcohol item and their BAC has been increased. |
| 20 | + |
| 21 | +#### ⚙️ Parameters |
| 22 | + |
| 23 | +| Parameter | Type | Description | |
| 24 | +|-----------|------|-------------| |
| 25 | +| `client` | **Player** | The player who consumed the alcohol | |
| 26 | +| `item` | **Item** | The alcohol item that was consumed | |
| 27 | + |
| 28 | +#### ↩️ Returns |
| 29 | +nil |
| 30 | + |
| 31 | +#### 🌐 Realm |
| 32 | +Server |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +### BACChanged |
| 37 | + |
| 38 | +#### 📋 Purpose |
| 39 | +Called whenever a player's blood alcohol content (BAC) value changes. |
| 40 | + |
| 41 | +#### ⏰ When Called |
| 42 | +After the BAC value has been updated on the server, whether it increased or decreased. |
| 43 | + |
| 44 | +#### ⚙️ Parameters |
| 45 | + |
| 46 | +| Parameter | Type | Description | |
| 47 | +|-----------|------|-------------| |
| 48 | +| `client` | **Player** | The player whose BAC changed | |
| 49 | +| `newBac` | **number** | The new BAC value (0-100) | |
| 50 | + |
| 51 | +#### ↩️ Returns |
| 52 | +nil |
| 53 | + |
| 54 | +#### 🌐 Realm |
| 55 | +Server |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### BACIncreased |
| 60 | + |
| 61 | +#### 📋 Purpose |
| 62 | +Called when a player's BAC value increases. |
| 63 | + |
| 64 | +#### ⏰ When Called |
| 65 | +After BAC has been increased but before BACChanged is called. |
| 66 | + |
| 67 | +#### ⚙️ Parameters |
| 68 | + |
| 69 | +| Parameter | Type | Description | |
| 70 | +|-----------|------|-------------| |
| 71 | +| `client` | **Player** | The player whose BAC increased | |
| 72 | +| `oldBac` | **number** | The previous BAC value | |
| 73 | +| `newBac` | **number** | The new BAC value | |
| 74 | + |
| 75 | +#### ↩️ Returns |
| 76 | +nil |
| 77 | + |
| 78 | +#### 🌐 Realm |
| 79 | +Server |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +### BACReset |
| 84 | + |
| 85 | +#### 📋 Purpose |
| 86 | +Called when a player's BAC is reset to zero. |
| 87 | + |
| 88 | +#### ⏰ When Called |
| 89 | +After BAC has been reset, typically when a character is loaded or respawns. |
| 90 | + |
| 91 | +#### ⚙️ Parameters |
| 92 | + |
| 93 | +| Parameter | Type | Description | |
| 94 | +|-----------|------|-------------| |
| 95 | +| `client` | **Player** | The player whose BAC was reset | |
| 96 | + |
| 97 | +#### ↩️ Returns |
| 98 | +nil |
| 99 | + |
| 100 | +#### 🌐 Realm |
| 101 | +Server |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +### BACThresholdReached |
| 106 | + |
| 107 | +#### 📋 Purpose |
| 108 | +Called when a player's BAC reaches a specific threshold level. |
| 109 | + |
| 110 | +#### ⏰ When Called |
| 111 | +When BAC crosses a defined threshold value (e.g., 30%, 50%, 80%). |
| 112 | + |
| 113 | +#### ⚙️ Parameters |
| 114 | + |
| 115 | +| Parameter | Type | Description | |
| 116 | +|-----------|------|-------------| |
| 117 | +| `client` | **Player** | The player who reached the threshold | |
| 118 | +| `bac` | **number** | The current BAC value | |
| 119 | +| `threshold` | **number** | The threshold that was reached | |
| 120 | + |
| 121 | +#### ↩️ Returns |
| 122 | +nil |
| 123 | + |
| 124 | +#### 🌐 Realm |
| 125 | +Server |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +### PostBACDecrease |
| 130 | + |
| 131 | +#### 📋 Purpose |
| 132 | +Called after a player's BAC has been decreased during the degradation cycle. |
| 133 | + |
| 134 | +#### ⏰ When Called |
| 135 | +After BAC degradation has been processed and the new value has been set. |
| 136 | + |
| 137 | +#### ⚙️ Parameters |
| 138 | + |
| 139 | +| Parameter | Type | Description | |
| 140 | +|-----------|------|-------------| |
| 141 | +| `client` | **Player** | The player whose BAC decreased | |
| 142 | +| `newBac` | **number** | The new BAC value after decrease | |
| 143 | + |
| 144 | +#### ↩️ Returns |
| 145 | +nil |
| 146 | + |
| 147 | +#### 🌐 Realm |
| 148 | +Server |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +### PostBACReset |
| 153 | + |
| 154 | +#### 📋 Purpose |
| 155 | +Called after a player's BAC has been reset to zero. |
| 156 | + |
| 157 | +#### ⏰ When Called |
| 158 | +After BAC reset has been completed. |
| 159 | + |
| 160 | +#### ⚙️ Parameters |
| 161 | + |
| 162 | +| Parameter | Type | Description | |
| 163 | +|-----------|------|-------------| |
| 164 | +| `client` | **Player** | The player whose BAC was reset | |
| 165 | + |
| 166 | +#### ↩️ Returns |
| 167 | +nil |
| 168 | + |
| 169 | +#### 🌐 Realm |
| 170 | +Server |
| 171 | + |
| 172 | +--- |
| 173 | + |
| 174 | +### PreBACDecrease |
| 175 | + |
| 176 | +#### 📋 Purpose |
| 177 | +Called before a player's BAC is decreased during the degradation cycle. |
| 178 | + |
| 179 | +#### ⏰ When Called |
| 180 | +Before BAC degradation is processed, allowing modification of the decrease rate. |
| 181 | + |
| 182 | +#### ⚙️ Parameters |
| 183 | + |
| 184 | +| Parameter | Type | Description | |
| 185 | +|-----------|------|-------------| |
| 186 | +| `client` | **Player** | The player whose BAC will decrease | |
| 187 | +| `bac` | **number** | The current BAC value before decrease | |
| 188 | + |
| 189 | +#### ↩️ Returns |
| 190 | +nil |
| 191 | + |
| 192 | +#### 🌐 Realm |
| 193 | +Server |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +### PreBACIncrease |
| 198 | + |
| 199 | +#### 📋 Purpose |
| 200 | +Called before a player's BAC is increased from consuming alcohol. |
| 201 | + |
| 202 | +#### ⏰ When Called |
| 203 | +Before BAC increase is processed, allowing modification of the increase amount. |
| 204 | + |
| 205 | +#### ⚙️ Parameters |
| 206 | + |
| 207 | +| Parameter | Type | Description | |
| 208 | +|-----------|------|-------------| |
| 209 | +| `client` | **Player** | The player whose BAC will increase | |
| 210 | +| `item` | **Item** | The alcohol item being consumed | |
| 211 | +| `amount` | **number** | The amount of BAC to add | |
| 212 | + |
| 213 | +#### ↩️ Returns |
| 214 | +nil or **number** - Return a modified amount to override the increase |
| 215 | + |
| 216 | +#### 🌐 Realm |
| 217 | +Server |
| 218 | + |
| 219 | +--- |
| 220 | + |
| 221 | +### PreBACReset |
| 222 | + |
| 223 | +#### 📋 Purpose |
| 224 | +Called before a player's BAC is reset to zero. |
| 225 | + |
| 226 | +#### ⏰ When Called |
| 227 | +Before BAC reset is processed, allowing cancellation of the reset. |
| 228 | + |
| 229 | +#### ⚙️ Parameters |
| 230 | + |
| 231 | +| Parameter | Type | Description | |
| 232 | +|-----------|------|-------------| |
| 233 | +| `client` | **Player** | The player whose BAC will be reset | |
| 234 | + |
| 235 | +#### ↩️ Returns |
| 236 | +nil or **boolean** - Return false to prevent reset |
| 237 | + |
| 238 | +#### 🌐 Realm |
| 239 | +Server |
| 240 | + |
0 commit comments