Skip to content
On this page

Interface: GlobalEvents

game/events.GlobalEvents

All types of events able to be sent or emitted from the global event bus.

Properties

addLayer

addLayer: (layer: GenericLayer, saveData: Record<string, unknown>) => void

Type declaration

▸ (layer, saveData): void

Sent whenever a layer is added.

Parameters
NameTypeDescription
layerGenericLayerThe layer being added.
saveDataRecord<string, unknown>The layer's save data object within player.
Returns

void

Defined in

profectus/src/game/events.ts:13


fontsLoaded

fontsLoaded: VoidFunction

Using document.fonts.ready returns too early on firefox, so we use document.fonts.onloadingdone instead, which doesn't accept multiple listeners. This event fires when that callback is called.

Defined in

profectus/src/game/events.ts:51


gameWon

gameWon: VoidFunction

Sent when the game has ended.

Defined in

profectus/src/game/events.ts:35


loadSettings

loadSettings: (settings: Partial<Settings>) => void

Type declaration

▸ (settings): void

Sent when constructing the Settings object. Use it to add default values for custom properties to the object.

See

features/features.setDefault for setting default values.

Parameters
NameTypeDescription
settingsPartial<Settings>The settings object being constructed.
Returns

void

Defined in

profectus/src/game/events.ts:31


onLoad

onLoad: VoidFunction

Sent whenever a save has finished loading. Happens when the page is opened and upon switching saves in the saves manager.

Defined in

profectus/src/game/events.ts:46


removeLayer

removeLayer: (layer: GenericLayer) => void

Type declaration

▸ (layer): void

Sent whenever a layer is removed.

Parameters
NameTypeDescription
layerGenericLayerThe layer being removed.
Returns

void

Defined in

profectus/src/game/events.ts:18


reset

reset: (reset: GenericReset) => void

Type declaration

▸ (reset): void

Parameters
NameType
resetGenericReset
Returns

void

Defined in

profectus/src/features/reset.ts:117


setupVue

setupVue: (vue: App<any>) => void

Type declaration

▸ (vue): void

Sent when setting up the Vue Application instance. Use it to register global components or otherwise set up things that should affect Vue globally.

Parameters
NameTypeDescription
vueApp<any>The Vue App being constructed.
Returns

void

Defined in

profectus/src/game/events.ts:41


update

update: (diff: number, trueDiff: number) => void

Type declaration

▸ (diff, trueDiff): void

Sent every game tick. Runs the life cycle of the project.

Parameters
NameTypeDescription
diffnumberThe delta time since last tick, in ms.
trueDiffnumberThe delta time since last tick, in ms. Unaffected by time modifiers like devSpeed or offlineTime. Intended for things like updating animations.
Returns

void

Defined in

profectus/src/game/events.ts:24