Files
tbd-station-14/Content.Shared/GameTicking/SharedGameTicker.cs
Moony ec68226e99 Refactor how jobs are handed out (#5422)
* Completely refactor how job spawning works

* Remove remains of old system.

* Squash the final bug, cleanup.

* Attempt to fix tests

* Adjusts packed's round-start crew roster, re-enables a bunch of old roles.
Also adds the Central Command Official as a proper role.

* pretty up ui

* refactor StationSystem into the correct folder & namespace.

* remove a log, make sure the lobby gets updated if a new map is spontaneously added.

* re-add accidentally removed log

* We do a little logging

* we do a little resolving

* we do a little documenting

* Renamed OverflowJob to FallbackOverflowJob
Allows stations to configure their own roundstart overflow job list.

* narrator: it did not compile

* oops

* support having no overflow jobs

* filescope for consistency

* small fixes

* Bumps a few role counts for Packed, namely engis

* log moment

* E

* Update Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

* Update Content.Server/Maps/GameMapPrototype.cs

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

* factored job logic, cleanup.

* e

* Address reviews

* Remove the concept of a "default" grid.
It has no future in our new multi-station world

* why was clickable using that in the first place

* fix bad evil bug that almost slipped through
also adds chemist

* rms obsolete things from chemist

* Adds a sanity fallback

* address reviews

* adds ability to set name

* fuck

* cleanup joingame
2021-11-26 20:02:46 +11:00

164 lines
4.8 KiB
C#

using System;
using System.Collections.Generic;
using Content.Shared.Station;
using Robust.Shared.GameObjects;
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.
public const string FallbackOverflowJob = "Assistant";
public const string FallbackOverflowJobName = "assistant";
}
[Serializable, NetSerializable]
public class TickerJoinLobbyEvent : EntityEventArgs
{
}
[Serializable, NetSerializable]
public class TickerJoinGameEvent : EntityEventArgs
{
}
[Serializable, NetSerializable]
public class TickerLateJoinStatusEvent : EntityEventArgs
{
// TODO: Make this a replicated CVar, honestly.
public bool Disallowed { get; }
public TickerLateJoinStatusEvent(bool disallowed)
{
Disallowed = disallowed;
}
}
[Serializable, NetSerializable]
public class TickerLobbyStatusEvent : EntityEventArgs
{
public bool IsRoundStarted { get; }
public string? LobbySong { get; }
public bool YouAreReady { get; }
// UTC.
public TimeSpan StartTime { get; }
public bool Paused { get; }
public TickerLobbyStatusEvent(bool isRoundStarted, string? lobbySong, bool youAreReady, TimeSpan startTime, bool paused)
{
IsRoundStarted = isRoundStarted;
LobbySong = lobbySong;
YouAreReady = youAreReady;
StartTime = startTime;
Paused = paused;
}
}
[Serializable, NetSerializable]
public class TickerLobbyInfoEvent : EntityEventArgs
{
public string TextBlob { get; }
public TickerLobbyInfoEvent(string textBlob)
{
TextBlob = textBlob;
}
}
[Serializable, NetSerializable]
public 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 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 class TickerJobsAvailableEvent : EntityEventArgs
{
/// <summary>
/// The Status of the Player in the lobby (ready, observer, ...)
/// </summary>
public Dictionary<StationId, Dictionary<string, int>> JobsAvailableByStation { get; }
public Dictionary<StationId, string> StationNames { get; }
public TickerJobsAvailableEvent(Dictionary<StationId, string> stationNames, Dictionary<StationId, Dictionary<string, int>> jobsAvailableByStation)
{
StationNames = stationNames;
JobsAvailableByStation = jobsAvailableByStation;
}
}
[Serializable, NetSerializable]
public 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 PlayerCount { get; }
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
public RoundEndMessageEvent(string gamemodeTitle, string roundEndText, TimeSpan roundDuration, int playerCount,
RoundEndPlayerInfo[] allPlayersEndInfo)
{
GamemodeTitle = gamemodeTitle;
RoundEndText = roundEndText;
RoundDuration = roundDuration;
PlayerCount = playerCount;
AllPlayersEndInfo = allPlayersEndInfo;
}
}
[Serializable, NetSerializable]
public enum LobbyPlayerStatus : sbyte
{
NotReady = 0,
Ready,
Observer,
}
}