Skip to content

Commit

Permalink
fix(server): "actually" fix initial actor sync
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcAssey committed Jan 25, 2025
1 parent b711feb commit 730b81a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions GLOKON.Baiters.Core/Packets/Handlers/InstanceActorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void Handle(ulong sender, Packet data)
case ActorType.Player:
if (server.TryGetPlayer(sender, out var playerToSpawn) && playerToSpawn != null)
{
_ = playerToSpawn.IsSyncRequired; // Trip fuse, to prevent non-owned entity from initial sync
server.JoinPlayer(sender, actorId, playerToSpawn);
}
else
Expand All @@ -40,13 +41,15 @@ public void Handle(ulong sender, Packet data)
break;
default:
// TODO: Do we need to instantiate all the different types or just use the generic actor?
server.AddActor(actorId, new GenericActor(type, sender)
var actor = new GenericActor(type, sender)
{
Position = (Vector3)pktParams["at"],
Rotation = (Vector3)pktParams["rot"],
Zone = (string)pktParams["zone"],
ZoneOwnerId = (long)pktParams["zone_owner"]
});
};
_ = actor.IsSyncRequired; // Trip fuse, to prevent non-owned entity from initial sync
server.AddActor(actorId, actor);
break;
}
}
Expand Down

0 comments on commit 730b81a

Please sign in to comment.