Files
tbd-station-14/Content.Shared/GameTicking/SharedGameTicker.cs
Vera Aguilera Puerto 0c337d6235 Round end sound now respects lobby music option toggle. (#8699)
Now it only plays when the round restarts *after* a regular roundend.
Meaning that if you spam the "restartroundnow" command, it won't play even if you have roundend sounds enabled in the options.
2022-06-12 11:23:28 +10:00

175 lines
5.3 KiB
C#

using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.GameTicking
{
public abstract class SharedGameTicker : EntitySystem
{
// See ideally these would be pulled from the job definition or something.
// But this is easier, and at least it isn't hardcoded.
//TODO: Move these, they really belong in StationJobsSystem or a cvar.
public const string FallbackOverflowJob = "Passenger";
public const string FallbackOverflowJobName = "passenger";
}
[Serializable, NetSerializable]
public sealed class TickerJoinLobbyEvent : EntityEventArgs
{
}
[Serializable, NetSerializable]
public sealed class TickerJoinGameEvent : EntityEventArgs
{
}
[Serializable, NetSerializable]
public sealed class TickerLateJoinStatusEvent : EntityEventArgs
{
// TODO: Make this a replicated CVar, honestly.
public bool Disallowed { get; }
public TickerLateJoinStatusEvent(bool disallowed)
{
Disallowed = disallowed;
}
}
[Serializable, NetSerializable]
public sealed class TickerLobbyStatusEvent : EntityEventArgs
{
public bool IsRoundStarted { get; }
public string? LobbySong { get; }
public string? LobbyBackground { get; }
public bool YouAreReady { get; }
// UTC.
public TimeSpan StartTime { get; }
public bool Paused { get; }
public TickerLobbyStatusEvent(bool isRoundStarted, string? lobbySong, string? lobbyBackground, bool youAreReady, TimeSpan startTime, bool paused)
{
IsRoundStarted = isRoundStarted;
LobbySong = lobbySong;
LobbyBackground = lobbyBackground;
YouAreReady = youAreReady;
StartTime = startTime;
Paused = paused;
}
}
[Serializable, NetSerializable]
public sealed class TickerLobbyInfoEvent : EntityEventArgs
{
public string TextBlob { get; }
public TickerLobbyInfoEvent(string textBlob)
{
TextBlob = textBlob;
}
}
[Serializable, NetSerializable]
public sealed class TickerLobbyCountdownEvent : EntityEventArgs
{
/// <summary>
/// The game time that the game will start at.
/// </summary>
public TimeSpan StartTime { get; }
/// <summary>
/// Whether or not the countdown is paused
/// </summary>
public bool Paused { get; }
public TickerLobbyCountdownEvent(TimeSpan startTime, bool paused)
{
StartTime = startTime;
Paused = paused;
}
}
[Serializable, NetSerializable]
public sealed class TickerLobbyReadyEvent : EntityEventArgs
{
/// <summary>
/// The Status of the Player in the lobby (ready, observer, ...)
/// </summary>
public Dictionary<NetUserId, LobbyPlayerStatus> Status { get; }
public TickerLobbyReadyEvent(Dictionary<NetUserId, LobbyPlayerStatus> status)
{
Status = status;
}
}
[Serializable, NetSerializable]
public sealed class TickerJobsAvailableEvent : EntityEventArgs
{
/// <summary>
/// The Status of the Player in the lobby (ready, observer, ...)
/// </summary>
public Dictionary<EntityUid, Dictionary<string, uint?>> JobsAvailableByStation { get; }
public Dictionary<EntityUid, string> StationNames { get; }
public TickerJobsAvailableEvent(Dictionary<EntityUid, string> stationNames, Dictionary<EntityUid, Dictionary<string, uint?>> jobsAvailableByStation)
{
StationNames = stationNames;
JobsAvailableByStation = jobsAvailableByStation;
}
}
[Serializable, NetSerializable]
public sealed class RoundEndMessageEvent : EntityEventArgs
{
[Serializable, NetSerializable]
public struct RoundEndPlayerInfo
{
public string PlayerOOCName;
public string? PlayerICName;
public string Role;
public bool Antag;
public bool Observer;
public bool Connected;
}
public string GamemodeTitle { get; }
public string RoundEndText { get; }
public TimeSpan RoundDuration { get; }
public int RoundId { get; }
public int PlayerCount { get; }
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
public string? LobbySong;
public string? RestartSound;
public RoundEndMessageEvent(
string gamemodeTitle,
string roundEndText,
TimeSpan roundDuration,
int roundId,
int playerCount,
RoundEndPlayerInfo[] allPlayersEndInfo,
string? lobbySong,
string? restartSound)
{
GamemodeTitle = gamemodeTitle;
RoundEndText = roundEndText;
RoundDuration = roundDuration;
RoundId = roundId;
PlayerCount = playerCount;
AllPlayersEndInfo = allPlayersEndInfo;
LobbySong = lobbySong;
RestartSound = restartSound;
}
}
[Serializable, NetSerializable]
public enum LobbyPlayerStatus : sbyte
{
NotReady = 0,
Ready,
Observer,
}
}