@@ -10,7 +10,7 @@ import type PhysicsSystem from "../physics/PhysicsSystem"
10
10
import World from "../World"
11
11
import { peerMessageHandlers } from "./MessageHandlers"
12
12
import type { ClientInfo , InitObjectData , Message , MessageType } from "./types"
13
- import Jolt from "@azaleacolburn/jolt-physics"
13
+ import type Jolt from "@azaleacolburn/jolt-physics"
14
14
15
15
export const COLLISION_TIMEOUT = 500
16
16
@@ -185,25 +185,14 @@ class MultiplayerSystem {
185
185
this . _connections . set ( conn . peer , conn )
186
186
MultiplayerStateEvent . dispatch ( MultiplayerStateEventType . PEER_CHANGE )
187
187
await this . send ( conn . peer , { type : "info" , data : this . info } )
188
- // I don't think this is necessary if we just move the call to initWorld
189
- // for (const objectId of this.getOwnSceneObjectIDs()) {
190
- // const obj = World.sceneRenderer.sceneObjects.get(objectId)
191
- // if (!(obj instanceof MirabufSceneObject)) return
192
- // const hash = await MirabufCachingService.hashBuffer(
193
- // mirabuf.Assembly.encode(obj.mirabufInstance.parser.assembly).finish().buffer as ArrayBuffer
194
- // )
195
- // await this.send(conn.peer, {
196
- // type: "newObject",
197
- // data: {
198
- // sceneObjectKey: objectId,
199
- // assemblyHash: hash,
200
- // miraType: obj.miraType,
201
- // initialPreferences: obj.getPreferenceData(),
202
- // bodyIds: obj.getAllBodies(),
203
- // },
204
- // })
205
- // await this.send(conn.peer, { type: "metadataUpdate", data: obj.multiplayerInfo })
206
- // }
188
+
189
+ const ownSceneObjects = this . getOwnSceneObjectIDs ( )
190
+ World . sceneRenderer . mirabufSceneObjects
191
+ . getAll ( )
192
+ . filter ( obj => ownSceneObjects . includes ( obj . id ) )
193
+ . forEach ( async obj => {
194
+ await this . send ( conn . peer , { type : "metadataUpdate" , data : obj . multiplayerInfo } )
195
+ } )
207
196
} )
208
197
209
198
conn . on ( "data" , async ( data : unknown ) => {
0 commit comments