Skip to content

Events ​

← BLN Society overview

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:

EventArguments
bln_society:ready–
bln_society:societyCreatedsocietyId, society
bln_society:societyDeletedsocietyId, name
bln_society:memberAddedsocietyId, characterId, rankId
bln_society:memberRemovedsocietyId, characterId
bln_society:memberRankChangedsocietyId, characterId, rankId, previousRankId
bln_society:dutyChangedsocietyId, characterId, onDuty, reason?
bln_society:balanceChangedsocietyId, currency, balance, delta
bln_society:payrollPaidsocietyId, total, memberCount
bln_society:paycheckIssuedsocietyId, characterId, amount, currency
bln_society:paycheckCollectedsocietyId, characterId, amount
bln_society:storageUpgradedsocietyId, key, level
bln_society:fineCreatedsocietyId, characterId, amount, fineId
bln_society:finePaidsocietyId, characterId, amount, fineId
bln_society:ownershipTransferredsocietyId, characterId, previousOwnerId
bln_society:pointChangedsocietyId, 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.

EventArgumentsWhen
bln_society:c:ready–Boot finished β€” safe to read bags
bln_society:c:membershipsChangednew memberships tableJoined, left, or rank changed
bln_society:c:dutyChangednew duty payload, or falseClocked in or out
bln_society:c:stateChanged{ finance, paychecks, storage }Finance, paychecks, or storage updated
bln_society:c:directoryChangednew directorySociety 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)