Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
Fix for grab sync. Fixes #538
Browse files Browse the repository at this point in the history
  • Loading branch information
eanders-ms committed Apr 28, 2020
1 parent 85a6969 commit 22d5df1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/sdk/src/internal/adapters/multipeer/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = {
message: Message<Payloads.ActorCorrection>
) => {
const syncActor = session.actorSet.get(message.payload.actorId);
if (syncActor && (client.authoritative || syncActor.grabbedBy === client.id)) {
if (syncActor && ((client.authoritative && !syncActor.grabbedBy) || (syncActor.grabbedBy === client.id))) {
const correctionPayload = message.payload;

// Synthesize an actor update message and add in the transform from the correction payload.
Expand Down Expand Up @@ -399,7 +399,7 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = {
message: Message<Payloads.ActorUpdate>
) => {
const syncActor = session.actorSet.get(message.payload.actor.id);
if (syncActor && (client.authoritative || syncActor.grabbedBy === client.id)) {
if (syncActor && ((client.authoritative && !syncActor.grabbedBy) || (syncActor.grabbedBy === client.id))) {
// Merge the update into the existing actor.
session.cacheActorUpdateMessage(message);

Expand Down

0 comments on commit 22d5df1

Please sign in to comment.