using System.Collections.Generic; using Robust.Server.Player; using Robust.Shared.Map; namespace Content.Server.Tabletop { /// /// A struct for storing data about a running tabletop game. /// public struct TabletopSession { /// /// The map ID associated with this tabletop game session. /// public MapId MapId; /// /// The set of players currently playing this tabletop game. /// private readonly HashSet _currentPlayers; /// The map ID associated with this tabletop game. public TabletopSession(MapId mapId) { MapId = mapId; _currentPlayers = new(); } /// /// Returns true if the given player is currently playing this tabletop game. /// public bool IsPlaying(IPlayerSession playerSession) { return _currentPlayers.Contains(playerSession); } /// /// Store that this player has started playing this tabletop game. If the player was already playing, nothing /// happens. /// public void StartPlaying(IPlayerSession playerSession) { _currentPlayers.Add(playerSession); } /// /// Store that this player has stopped playing this tabletop game. If the player was not playing, nothing /// happens. /// public void StopPlaying(IPlayerSession playerSession) { _currentPlayers.Remove(playerSession); } } }