@@ -44,13 +44,25 @@ namespace gdjs {
4444 } ;
4545
4646 type Cube3DObjectNetworkSyncDataType = {
47- fo : 'Y' | 'Z' ;
48- bfu : 'X' | 'Y' ;
49- vfb : integer ;
50- trfb : integer ;
51- frn : [ string , string , string , string , string , string ] ;
52- mt : number ;
53- tint : string ;
47+ fo ?: 'Y' | 'Z' ;
48+ facesOrientation ?: 'Y' | 'Z' ;
49+
50+ bfu ?: 'X' | 'Y' ;
51+ backFaceUpThroughWhichAxisRotation ?: 'X' | 'Y' ;
52+
53+ vfb ?: integer ;
54+ visibleFacesBitmask ?: integer ;
55+
56+ trfb ?: integer ;
57+ textureRepeatFacesBitmask ?: integer ;
58+
59+ frn ?: [ string , string , string , string , string , string ] ;
60+ faceResourceNames ?: [ string , string , string , string , string , string ] ;
61+
62+ mt ?: number ;
63+ materialType ?: number ;
64+
65+ tint ?: string ;
5466 } ;
5567
5668 type Cube3DObjectNetworkSyncData = Object3DNetworkSyncData &
@@ -460,14 +472,16 @@ namespace gdjs {
460472 getNetworkSyncData (
461473 syncOptions : GetNetworkSyncDataOptions
462474 ) : Cube3DObjectNetworkSyncData {
475+ const getKey = ( abbrev : string , full : string ) =>
476+ syncOptions . useFullNames ? full : abbrev ;
463477 return {
464478 ...super . getNetworkSyncData ( syncOptions ) ,
465- mt : this . _materialType ,
466- fo : this . _facesOrientation ,
467- bfu : this . _backFaceUpThroughWhichAxisRotation ,
468- vfb : this . _visibleFacesBitmask ,
469- trfb : this . _textureRepeatFacesBitmask ,
470- frn : this . _faceResourceNames ,
479+ [ getKey ( 'mt' , 'materialType' ) ] : this . _materialType ,
480+ [ getKey ( 'fo' , 'facesOrientation' ) ] : this . _facesOrientation ,
481+ [ getKey ( ' bfu' , 'backFaceUpThroughWhichAxisRotation' ) ] : this . _backFaceUpThroughWhichAxisRotation ,
482+ [ getKey ( ' vfb' , 'visibleFacesBitmask' ) ] : this . _visibleFacesBitmask ,
483+ [ getKey ( ' trfb' , 'textureRepeatFacesBitmask' ) ] : this . _textureRepeatFacesBitmask ,
484+ [ getKey ( ' frn' , 'faceResourceNames' ) ] : this . _faceResourceNames ,
471485 tint : this . _tint ,
472486 } ;
473487 }
@@ -510,13 +524,14 @@ namespace gdjs {
510524 }
511525 }
512526 if ( networkSyncData . frn !== undefined ) {
527+ const frn = networkSyncData . frn ;
513528 // If one element is different, update all the faces.
514529 if (
515530 ! this . _faceResourceNames . every (
516- ( value , index ) => value === networkSyncData . frn [ index ]
531+ ( value , index ) => value === frn [ index ]
517532 )
518533 ) {
519- this . _faceResourceNames = networkSyncData . frn ;
534+ this . _faceResourceNames = frn ;
520535 // Update all faces. (Could optimize to only update the changed ones)
521536 for ( let i = 0 ; i < this . _faceResourceNames . length ; i ++ ) {
522537 this . _renderer . updateFace ( i ) ;
0 commit comments