Fix some tabletop prediction jank (#12758)

This commit is contained in:
Leon Friedrich
2022-11-27 23:25:54 +13:00
committed by GitHub
parent 2dc7663d1a
commit 8467d2373c
4 changed files with 91 additions and 96 deletions

View File

@@ -19,6 +19,7 @@ namespace Content.Server.Tabletop
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<TabletopStopPlayingEvent>(OnStopPlaying);
SubscribeLocalEvent<TabletopGameComponent, ActivateInWorldEvent>(OnTabletopActivate);
SubscribeLocalEvent<TabletopGameComponent, ComponentShutdown>(OnGameShutdown);
@@ -27,7 +28,21 @@ namespace Content.Server.Tabletop
SubscribeLocalEvent<TabletopGameComponent, GetVerbsEvent<ActivationVerb>>(AddPlayGameVerb);
InitializeMap();
InitializeDraggable();
}
protected override void OnTabletopMove(TabletopMoveEvent msg, EntitySessionEventArgs args)
{
if (args.SenderSession is not IPlayerSession playerSession)
return;
if (!TryComp(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
return;
// Check if player is actually playing at this table
if (!session.Players.ContainsKey(playerSession))
return;
base.OnTabletopMove(msg, args);
}
/// <summary>