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:19


gameWon

gameWon: VoidFunction

Sent when the game has ended.

Defined in

profectus/src/game/events.ts:41


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:37


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:24


reset

reset: (reset: GenericReset) => void

Type declaration

▸ (reset): void

Parameters
NameType
resetGenericReset
Returns

void

Defined in

profectus/src/features/reset.ts:95


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:47


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 game/player.Player.devSpeed or game/player.Player.offlineTime. Intended for things like updating animations.
Returns

void

Defined in

profectus/src/game/events.ts:30