Commands#
| Command | Who | What |
|---|---|---|
/buff |
Everyone | Show your active buff cards again |
/debuff |
Everyone | Show your active debuff cards again |
Server exports#
Call them as exports['glitch-buffs']:Name(...). Each takes the player's source first.
| Export signature | What it does |
|---|---|
Apply(src, name, opts) |
Starts or refreshes an effect from Config.Effects. opts: duration, level, add (extend instead of reset), max (longest total when add is used) and silent (the caller saves and syncs). Returns the effect table. |
Remove(src, name, reason) |
Ends an effect. reason defaults to 'removed'. Returns true if it was active. |
Has(src, name) |
Returns the effect table, or nil. |
Caffeine(src, item) |
Coffee or energy drink from Config.Caffeine.items. |
Protein(src, seconds) |
Protein carry bonus. Stacks up to Config.Protein.maxTime. |
Drank(src) |
Counts one alcoholic drink toward a hangover. |
AddFatigue(src, pointsOrJob, times) |
Adds fatigue. A number is points, a string is a Config.Fatigue.jobs key. times defaults to 1. |
RestFatigue(src, n) |
Takes n fatigue points off without counting as work. |
DrugUse(src, drug, doseSeconds, opts) |
Counts a dose. Returns { level, share, overdose }. opts.comedownMult shortens the comedown. |
Treated(src, how) |
For a medical resource. 'hospital' cures infection, and any call ends adrenaline. |
There are no client exports. The GlitchBuffs tables on each script side are globals for this resource's own files.
Events#
| Event | Side | Use |
|---|---|---|
glitch-buffs:server:sober (peak) |
Server, from a client | Your consumables script reports that the player is sober again. Reports are range checked and limited to one per five seconds per player. |
glitch-buffs:unloaded (citizenid) |
Server, local | Fired by this resource when a character leaves. Listen to it to drop your own per-character data. |
glitch-buffs:server:ready, glitch-buffs:server:rest, glitch-buffs:client:sync, glitch-buffs:client:ended, glitch-buffs:client:overdose and glitch-buffs:client:knockout are internal and are not meant to be called from other resources. The client sync and ended events ignore calls from other resources.
State bags#
| State bag | Meaning |
|---|---|
buff_carry |
Server, replicated. Kilograms added by active effects such as protein, for a weight script. |
hud_buff, hud_debuff |
Written by the client. A GetGameTimer end time, or true for no end. Your HUD draws the squares from these. |
stress |
0 to 100. Shared with qbx_consumables. |
Saved data#
Active effects and fatigue points are stored in the player's glitchbuffs metadata as { fx = effects, fp = fatigue }. No tables are created.
Stuck on a step?Ask in the Discord →