Profectus / game/events / GlobalEvents
Interface: GlobalEvents ​
All types of events able to be sent or emitted from the global event bus.
Properties ​
addLayer() ​
addLayer: (
layer
,saveData
) =>void
Sent whenever a layer is added.
Parameters ​
layer ​
The layer being added.
saveData ​
Record
<string
, unknown
>
The layer's save data object within player.
Returns ​
void
Defined in ​
profectus/src/game/events.ts:14
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
) =>void
Sent when constructing the Settings object. Use it to add default values for custom properties to the object.
Parameters ​
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
) =>void
Sent whenever a layer is removed.
Parameters ​
layer ​
The layer being removed.
Returns ​
void
Defined in ​
profectus/src/game/events.ts:19
reset() ​
reset: (
reset
) =>void
Parameters ​
reset ​
Returns ​
void
Defined in ​
profectus/src/features/reset.ts:118
setupVue() ​
setupVue: (
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 ​
vue ​
App
The Vue App being constructed.
Returns ​
void
Defined in ​
profectus/src/game/events.ts:41
update() ​
update: (
diff
,trueDiff
) =>void
Sent every game tick. Runs the life cycle of the project.
Parameters ​
diff ​
number
The delta time since last tick, in ms.
trueDiff ​
number
The 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