Class DeathLinkManager
Hierarchy
- EventBasedManager<DeathEvents>
- DeathLinkManager (view full)
Index
Accessors
Methods
Accessors
enabled
- get enabled(): boolean
Returns
true
if this client is participating in the DeathLink mechanic.Returns boolean
Methods
disableDeathLink
enableDeathLink
off
- off<Event>(event, listener): this
Removes an existing event listener.
Type Parameters
Parameters
- event: Event
The event name associated with this listener to remove.
- listener: ((...args: DeathEvents[Event]) => void)
The callback function to remove.
- (...args): void
Parameters
Rest
...args: DeathEvents[Event]
Returns void
Returns this
This object.
- event: Event
on
- on<Event>(event, listener): this
Add an event listener for a specific event.
Type Parameters
Parameters
- event: Event
The event name to listen for.
- listener: ((...args: DeathEvents[Event]) => void)
The callback function to fire when this event is received.
- (...args): void
Parameters
Rest
...args: DeathEvents[Event]
Returns void
Returns this
This object.
- event: Event
sendDeathLink
- send
Death (source, cause?): voidLink If DeathLink is enabled, sends a DeathLink to all DeathLink enabled players, otherwise this method does nothing.
Parameters
- source: string
The name of the player who died. Can be a slot name, but could also be a name from within a multiplayer game.
Optional
cause: stringOptional text explaining the cause of death. When provided, this should include the player's name. (e.g.,
Phar drowned in a vat of kittens.
)
Returns void
Throws
UnauthenticatedError if attempting to send a death link before authenticating to the server.
Remarks
DeathLinks sent from this client will not fire a DeathEvents.deathReceived event to avoid an infinite feedback loop of deaths.
- source: string
wait
- wait<Event>(event, clearPredicate?): Promise<DeathEvents[Event]>
Returns a promise that waits for a single specified event to be received. Resolves with the list of arguments dispatched with the event.
Type Parameters
Parameters
- event: Event
The event name to listen for.
- clearPredicate: ((...args: DeathEvents[Event]) => boolean) = ...
An optional predicate to check on incoming events to validate if the correct event has been received. If omitted, will return immediately on next event type received.
- (...args): boolean
Parameters
Rest
...args: DeathEvents[Event]
Returns boolean
Returns Promise<DeathEvents[Event]>
- event: Event
Manages DeathLink mechanics for clients that choose to opt in to the mechanic.