2022-05-10 13:43:30 -05:00
|
|
|
|
using Robust.Shared.Network;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.Serialization;
|
2022-06-23 16:32:06 +07:00
|
|
|
|
using Robust.Shared.Utility;
|
2018-11-25 19:04:49 +01:00
|
|
|
|
|
2020-10-14 22:45:53 +02:00
|
|
|
|
namespace Content.Shared.GameTicking
|
2018-11-25 19:04:49 +01:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public abstract class SharedGameTicker : EntitySystem
|
2018-11-25 19:04:49 +01:00
|
|
|
|
{
|
2020-01-19 18:32:24 +01:00
|
|
|
|
// See ideally these would be pulled from the job definition or something.
|
|
|
|
|
|
// But this is easier, and at least it isn't hardcoded.
|
2022-05-10 13:43:30 -05:00
|
|
|
|
//TODO: Move these, they really belong in StationJobsSystem or a cvar.
|
2022-05-09 20:35:08 -07:00
|
|
|
|
public const string FallbackOverflowJob = "Passenger";
|
2022-06-28 15:55:05 +03:00
|
|
|
|
public const string FallbackOverflowJobName = "job-name-passenger";
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2020-01-19 18:32:24 +01:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerJoinLobbyEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2018-11-25 19:04:49 +01:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerJoinGameEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2018-11-25 19:04:49 +01:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerLateJoinStatusEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
// TODO: Make this a replicated CVar, honestly.
|
|
|
|
|
|
public bool Disallowed { get; }
|
2018-11-25 19:04:49 +01:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public TickerLateJoinStatusEvent(bool disallowed)
|
2018-11-25 19:04:49 +01:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
Disallowed = disallowed;
|
2018-11-25 19:04:49 +01:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2018-11-25 19:04:49 +01:00
|
|
|
|
|
2020-08-20 16:20:48 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerLobbyStatusEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
public bool IsRoundStarted { get; }
|
|
|
|
|
|
public string? LobbySong { get; }
|
2022-03-13 19:33:19 -07:00
|
|
|
|
public string? LobbyBackground { get; }
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public bool YouAreReady { get; }
|
|
|
|
|
|
// UTC.
|
|
|
|
|
|
public TimeSpan StartTime { get; }
|
2022-07-30 19:55:43 -07:00
|
|
|
|
public TimeSpan RoundStartTimeSpan { get; }
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public bool Paused { get; }
|
|
|
|
|
|
|
2022-07-30 19:55:43 -07:00
|
|
|
|
public TickerLobbyStatusEvent(bool isRoundStarted, string? lobbySong, string? lobbyBackground, bool youAreReady, TimeSpan startTime, TimeSpan roundStartTimeSpan, bool paused)
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
IsRoundStarted = isRoundStarted;
|
|
|
|
|
|
LobbySong = lobbySong;
|
2022-03-13 19:33:19 -07:00
|
|
|
|
LobbyBackground = lobbyBackground;
|
2021-06-20 10:09:24 +02:00
|
|
|
|
YouAreReady = youAreReady;
|
|
|
|
|
|
StartTime = startTime;
|
2022-07-30 19:55:43 -07:00
|
|
|
|
RoundStartTimeSpan = roundStartTimeSpan;
|
2021-06-20 10:09:24 +02:00
|
|
|
|
Paused = paused;
|
2020-08-20 16:20:48 +02:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2020-08-20 16:20:48 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerLobbyInfoEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
public string TextBlob { get; }
|
2020-08-20 16:20:48 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public TickerLobbyInfoEvent(string textBlob)
|
2018-11-25 19:04:49 +01:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
TextBlob = textBlob;
|
2018-11-25 19:04:49 +01:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2019-10-18 14:28:39 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerLobbyCountdownEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The game time that the game will start at.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public TimeSpan StartTime { get; }
|
2019-10-18 14:28:39 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Whether or not the countdown is paused
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool Paused { get; }
|
2020-06-21 22:05:47 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public TickerLobbyCountdownEvent(TimeSpan startTime, bool paused)
|
2020-06-21 22:05:47 +02:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
StartTime = startTime;
|
|
|
|
|
|
Paused = paused;
|
2020-06-21 22:05:47 +02:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2020-06-21 22:05:47 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerLobbyReadyEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The Status of the Player in the lobby (ready, observer, ...)
|
|
|
|
|
|
/// </summary>
|
2022-08-14 12:54:49 -07:00
|
|
|
|
public Dictionary<NetUserId, PlayerGameStatus> Status { get; }
|
2020-08-18 14:52:59 +02:00
|
|
|
|
|
2022-08-14 12:54:49 -07:00
|
|
|
|
public TickerLobbyReadyEvent(Dictionary<NetUserId, PlayerGameStatus> status)
|
2020-10-16 11:22:58 +02:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
Status = status;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-10-16 11:22:58 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class TickerJobsAvailableEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The Status of the Player in the lobby (ready, observer, ...)
|
|
|
|
|
|
/// </summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
|
public Dictionary<EntityUid, Dictionary<string, uint?>> JobsAvailableByStation { get; }
|
|
|
|
|
|
public Dictionary<EntityUid, string> StationNames { get; }
|
2020-10-16 11:22:58 +02:00
|
|
|
|
|
2022-05-10 13:43:30 -05:00
|
|
|
|
public TickerJobsAvailableEvent(Dictionary<EntityUid, string> stationNames, Dictionary<EntityUid, Dictionary<string, uint?>> jobsAvailableByStation)
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
2021-11-26 03:02:46 -06:00
|
|
|
|
StationNames = stationNames;
|
|
|
|
|
|
JobsAvailableByStation = jobsAvailableByStation;
|
2020-10-16 11:22:58 +02:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2020-08-16 23:36:50 +02:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class RoundEndMessageEvent : EntityEventArgs
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2020-04-10 01:37:14 -05:00
|
|
|
|
public struct RoundEndPlayerInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public string PlayerOOCName;
|
2021-03-16 15:50:20 +01:00
|
|
|
|
public string? PlayerICName;
|
2020-04-10 01:37:14 -05:00
|
|
|
|
public string Role;
|
2022-06-23 16:32:06 +07:00
|
|
|
|
public EntityUid? PlayerEntityUid;
|
2020-04-10 01:37:14 -05:00
|
|
|
|
public bool Antag;
|
2020-08-22 12:45:49 +02:00
|
|
|
|
public bool Observer;
|
2021-11-15 18:14:34 +00:00
|
|
|
|
public bool Connected;
|
2020-04-10 01:37:14 -05:00
|
|
|
|
}
|
2020-04-08 06:07:54 -05:00
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public string GamemodeTitle { get; }
|
|
|
|
|
|
public string RoundEndText { get; }
|
|
|
|
|
|
public TimeSpan RoundDuration { get; }
|
2022-04-14 11:40:26 -07:00
|
|
|
|
public int RoundId { get; }
|
2021-06-20 10:09:24 +02:00
|
|
|
|
public int PlayerCount { get; }
|
|
|
|
|
|
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
|
2022-05-13 10:13:07 +10:00
|
|
|
|
public string? LobbySong;
|
2022-06-12 03:23:28 +02:00
|
|
|
|
public string? RestartSound;
|
2022-05-13 10:13:07 +10:00
|
|
|
|
|
|
|
|
|
|
public RoundEndMessageEvent(
|
|
|
|
|
|
string gamemodeTitle,
|
|
|
|
|
|
string roundEndText,
|
|
|
|
|
|
TimeSpan roundDuration,
|
|
|
|
|
|
int roundId,
|
|
|
|
|
|
int playerCount,
|
|
|
|
|
|
RoundEndPlayerInfo[] allPlayersEndInfo,
|
2022-06-12 03:23:28 +02:00
|
|
|
|
string? lobbySong,
|
|
|
|
|
|
string? restartSound)
|
2020-08-21 11:24:06 +02:00
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
|
GamemodeTitle = gamemodeTitle;
|
|
|
|
|
|
RoundEndText = roundEndText;
|
|
|
|
|
|
RoundDuration = roundDuration;
|
2022-04-14 11:40:26 -07:00
|
|
|
|
RoundId = roundId;
|
2021-06-20 10:09:24 +02:00
|
|
|
|
PlayerCount = playerCount;
|
|
|
|
|
|
AllPlayersEndInfo = allPlayersEndInfo;
|
2022-05-13 10:13:07 +10:00
|
|
|
|
LobbySong = lobbySong;
|
2022-06-12 03:23:28 +02:00
|
|
|
|
RestartSound = restartSound;
|
2020-08-21 11:24:06 +02:00
|
|
|
|
}
|
2018-11-25 19:04:49 +01:00
|
|
|
|
}
|
2021-06-20 10:09:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-08-14 12:54:49 -07:00
|
|
|
|
public enum PlayerGameStatus : sbyte
|
2021-06-20 10:09:24 +02:00
|
|
|
|
{
|
2022-08-14 12:54:49 -07:00
|
|
|
|
NotReadyToPlay = 0,
|
|
|
|
|
|
ReadyToPlay,
|
|
|
|
|
|
JoinedGame,
|
2021-06-20 10:09:24 +02:00
|
|
|
|
}
|
2018-11-25 19:04:49 +01:00
|
|
|
|
}
|
2020-04-08 06:07:54 -05:00
|
|
|
|
|