@@ -9,6 +9,13 @@ import { WORLD_GAME_STATE_EVENT_TYPES } from './constants.js';
99import { isPlainObject } from '../../shared/utils/objectUtils.js' ;
1010import { toFiniteNumber } from '../../shared/math/numberNormalization.js' ;
1111
12+ function isPassiveModeContext ( context ) {
13+ if ( ! isPlainObject ( context ) ) return false ;
14+ if ( context . passiveMode === true ) return true ;
15+ if ( typeof context . mode === 'string' && context . mode . trim ( ) . toLowerCase ( ) === 'passive' ) return true ;
16+ return false ;
17+ }
18+
1219function recalcObjectiveSummary ( objectivesById ) {
1320 const objectiveIds = Object . keys ( objectivesById ) ;
1421 let completed = 0 ;
@@ -60,7 +67,10 @@ function validateApplyScoreDelta(payload) {
6067 return { ok : true } ;
6168}
6269
63- function applyAuthoritativeScoreDelta ( snapshot , payload ) {
70+ function applyAuthoritativeScoreDelta ( snapshot , payload , context = { } ) {
71+ if ( isPassiveModeContext ( context ) ) {
72+ return { changes : [ ] } ;
73+ }
6474 if ( ! snapshot . worldState || ! isPlainObject ( snapshot . worldState ) ) {
6575 snapshot . worldState = { } ;
6676 }
@@ -112,6 +122,9 @@ function validateUpdateObjectiveProgress(payload) {
112122}
113123
114124function applyAuthoritativeObjectiveProgress ( snapshot , payload , context = { } ) {
125+ if ( isPassiveModeContext ( context ) ) {
126+ return { changes : [ ] } ;
127+ }
115128 const now = typeof context . now === 'function' ? context . now : ( ) => Date . now ( ) ;
116129 const objectiveId = String ( payload . objectiveId || '' ) . trim ( ) ;
117130 const objectives = snapshot . worldState && snapshot . worldState . objectives
0 commit comments