@@ -4,7 +4,7 @@ import { timeToValue } from "../utils.js";
44
55export const finishLineEntered = async ( { credentials, currentElapsedTime, profileObject, raceObject, world } ) => {
66 try {
7- const { profileId, sceneDropId, urlSlug, visitorId } = credentials ;
7+ const { profileId, sceneDropId, urlSlug, username , visitorId } = credentials ;
88 const { checkpoints, highscore } = profileObject ;
99 const allCheckpointsCompleted = raceObject . numberOfCheckpoints === Object . keys ( checkpoints ) . length ;
1010
@@ -19,11 +19,15 @@ export const finishLineEntered = async ({ credentials, currentElapsedTime, profi
1919 [ `${ sceneDropId } .profiles.${ profileId } .elapsedTime` ] : currentElapsedTime ,
2020 [ `${ sceneDropId } .profiles.${ profileId } .startTimestamp` ] : null ,
2121 [ `${ sceneDropId } .profiles.${ profileId } .highscore` ] : newHighscore ,
22+ [ `${ sceneDropId } .profiles.${ profileId } .username` ] : username ,
2223 } ,
2324 { analytics : [ { analyticName : "completions" , uniqueKey : profileId } ] } ,
2425 ) ;
2526
26- if ( newHighscore !== highscore ) world . triggerActivity ( { type : WorldActivityType . GAME_HIGH_SCORE , assetId } ) ;
27+ if ( newHighscore !== highscore )
28+ world . triggerActivity ( { type : WorldActivityType . GAME_HIGH_SCORE , assetId } ) . catch ( ( error ) => {
29+ console . error ( "Error triggering activity:" , error ) ;
30+ } ) ;
2731
2832 const visitor = await Visitor . get ( visitorId , urlSlug , { credentials } ) ;
2933 const { x, y } = visitor . moveTo ;
0 commit comments