Events β
Events fire after a change is committed. Use them to refresh UI, notify other resources, or trigger side effects β instead of polling statebags or re-querying exports.
To block an operation before it happens, use Hooks instead.
Server events β
Registered with AddEventHandler on the server:
| Event | Arguments |
|---|---|
bln_society:ready | β |
bln_society:societyCreated | societyId, society |
bln_society:societyDeleted | societyId, name |
bln_society:memberAdded | societyId, characterId, rankId |
bln_society:memberRemoved | societyId, characterId |
bln_society:memberRankChanged | societyId, characterId, rankId, previousRankId |
bln_society:dutyChanged | societyId, characterId, onDuty, reason? |
bln_society:balanceChanged | societyId, currency, balance, delta |
bln_society:payrollPaid | societyId, total, memberCount |
bln_society:paycheckIssued | societyId, characterId, amount, currency |
bln_society:paycheckCollected | societyId, characterId, amount |
bln_society:storageUpgraded | societyId, key, level |
bln_society:fineCreated | societyId, characterId, amount, fineId |
bln_society:finePaid | societyId, characterId, amount, fineId |
bln_society:ownershipTransferred | societyId, characterId, previousOwnerId |
bln_society:pointChanged | societyId, point |
Boot β
Wait for bln_society:ready before calling mutating exports:
lua
AddEventHandler('bln_society:ready', function()
exports.bln_society:EnsureSociety({ ... })
end)Example β react to revenue β
lua
AddEventHandler('bln_society:balanceChanged', function(societyId, currency, balance, delta)
if societyId ~= mySocietyId or delta <= 0 then return end
-- refresh your till display, Discord alert, etc.
end)Client events β
Registered with AddEventHandler on the client. Fired when statebags update β listen instead of polling bags every frame.
| Event | Arguments | When |
|---|---|---|
bln_society:c:ready | β | Boot finished β safe to read bags |
bln_society:c:membershipsChanged | new memberships table | Joined, left, or rank changed |
bln_society:c:dutyChanged | new duty payload, or false | Clocked in or out |
bln_society:c:stateChanged | { finance, paychecks, storage } | Finance, paychecks, or storage updated |
bln_society:c:directoryChanged | new directory | Society list or points changed |
Example β refresh staff UI on duty change β
lua
AddEventHandler('bln_society:c:dutyChanged', function(duty)
if duty and duty.id == societyId then
EnableStaffUi()
else
DisableStaffUi()
end
end)