Extra Configuration
The alcohol, drug and buff hooks in client/editable.lua.
client/editable.lua is where you hook this resource into your own scripts. It sits
outside the escrow alongside config.lua, so edit it freely. It holds the alcohol and drug
state that breathalyzer and drug-testing scripts read back out through exports.
Client
The stock client/editable.lua, in full.
OnAlcoholUpdate
Consumables.Editable.OnAlcoholUpdate(level, type) runs when an alcohol effect starts and
again when it ends.
Nothing is called while the count is still below lightalcohol. The stock body only stores
the level as a BAC number; add your own call inside the if newBacLevel ~= currentBacLevel
block to push it to a breathalyzer resource. The 0.40 and 0.25 caps are hardcoded here,
not config.
OnDrugUpdate
Consumables.Editable.OnDrugUpdate(bool, type) runs when a drug effect starts and again
when it ends.
An item with more than one entry in drugeffect calls this once per effect. For shaking
and focus the false call fires immediately rather than when the effect ends, because
both run on their own thread.
The true call happens before the effect is dispatched, and only the eight known effect
names have a matching false call. Put an unrecognised name in drugeffect, a typo, or a
custom effect of your own, and the hook fires true and never false, leaving IsHigh()
stuck at true and the name stuck in GetHighDrug() until the player reconnects.
Exports
Call these from any other resource as exports['pixel-consumables']:GetBACLevel(). They
are all client side; the resource defines no server exports.
The three buff exports take one of nostress, stamina, strength, superjump,
running, swimming, health, armor, energy.
Events you can hook
Both are triggered locally on the consuming player and pass the item name. They ship empty so you can fill them in. Configuration has a worked example using them.