Skip to content

Commit 3134090

Browse files
committed
fix: send metadata
1 parent edf9151 commit 3134090

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

fission/src/systems/multiplayer/MessageHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ProgressHandle } from "@/components/ProgressNotificationData.ts"
22
import MirabufCachingService from "@/mirabuf/MirabufLoader"
33
import MirabufSceneObject, { createMirabuf } from "@/mirabuf/MirabufSceneObject"
4-
import { mirabuf } from "@/proto/mirabuf"
4+
import type { mirabuf } from "@/proto/mirabuf"
55
import { ScoreTracker } from "@/systems/match_mode/ScoreTracker.ts"
66
import { globalAddToast } from "@/ui/components/GlobalUIControls"
77
import JOLT from "@/util/loading/JoltSyncLoader"

fission/src/systems/multiplayer/MultiplayerSystem.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type PhysicsSystem from "../physics/PhysicsSystem"
1010
import World from "../World"
1111
import { peerMessageHandlers } from "./MessageHandlers"
1212
import type { ClientInfo, InitObjectData, Message, MessageType } from "./types"
13-
import Jolt from "@azaleacolburn/jolt-physics"
13+
import type Jolt from "@azaleacolburn/jolt-physics"
1414

1515
export const COLLISION_TIMEOUT = 500
1616

@@ -185,25 +185,14 @@ class MultiplayerSystem {
185185
this._connections.set(conn.peer, conn)
186186
MultiplayerStateEvent.dispatch(MultiplayerStateEventType.PEER_CHANGE)
187187
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+
})
207196
})
208197

209198
conn.on("data", async (data: unknown) => {

0 commit comments

Comments
 (0)