Station records (#8720)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Flipp Syder
2022-08-08 22:10:01 -07:00
committed by GitHub
parent 75dfbdb57f
commit 3d36a6e1f6
35 changed files with 1888 additions and 9 deletions

View File

@@ -955,6 +955,37 @@ namespace Content.Shared.CCVar
public static readonly CVarDef<string> CentcommMap =
CVarDef.Create("shuttle.centcomm_map", "/Maps/centcomm.yml", CVar.SERVERONLY);
/*
* Crew Manifests
*/
/// <summary>
/// Setting this allows a crew manifest to be opened from any window
/// that has a crew manifest button, and sends the correct message.
/// If this is false, only in-game entities will allow you to see
/// the crew manifest, if the functionality is coded in.
/// Having administrator priveledge ignores this, but will still
/// hide the button in UI windows.
/// </summary>
public static readonly CVarDef<bool> CrewManifestWithoutEntity =
CVarDef.Create("crewmanifest.no_entity", true, CVar.REPLICATED);
/// <summary>
/// Setting this allows the crew manifest to be viewed from 'unsecure'
/// entities, such as the PDA.
/// </summary>
public static readonly CVarDef<bool> CrewManifestUnsecure =
CVarDef.Create("crewmanifest.unsecure", true, CVar.REPLICATED);
/// <summary>
/// Dictates the order the crew manifest will appear in, in terms of its sections.
/// Sections not in this list will appear at the end of the list, in no
/// specific order.
/// </summary>
public static readonly CVarDef<string> CrewManifestOrdering =
CVarDef.Create("crewmanifest.ordering", "Command,Security,Science,Medical,Engineering,Cargo,Civilian,Unknown",
CVar.REPLICATED);
/*
* VIEWPORT
*/

View File

@@ -0,0 +1,75 @@
using Content.Shared.Eui;
using Robust.Shared.Serialization;
namespace Content.Shared.CrewManifest;
/// <summary>
/// A message to send to the server when requesting a crew manifest.
/// CrewManifestSystem will open an EUI that will send the crew manifest
/// to the player when it is updated.
/// </summary>
[Serializable, NetSerializable]
public sealed class RequestCrewManifestMessage : EntityEventArgs
{
public EntityUid Id { get; }
public RequestCrewManifestMessage(EntityUid id)
{
Id = id;
}
}
[Serializable, NetSerializable]
public sealed class CrewManifestEuiState : EuiStateBase
{
public string StationName { get; }
public CrewManifestEntries? Entries { get; }
public CrewManifestEuiState(string stationName, CrewManifestEntries? entries)
{
StationName = stationName;
Entries = entries;
}
}
[Serializable, NetSerializable]
public sealed class CrewManifestEuiClosed : EuiMessageBase
{}
[Serializable, NetSerializable]
public sealed class CrewManifestEntries
{
/// <summary>
/// Entries in the crew manifest. Goes by department ID.
/// </summary>
// public Dictionary<string, List<CrewManifestEntry>> Entries = new();
public List<CrewManifestEntry> Entries = new();
}
[Serializable, NetSerializable]
public sealed class CrewManifestEntry
{
public string Name { get; }
public string JobTitle { get; }
public string JobIcon { get; }
public string JobPrototype { get; }
public CrewManifestEntry(string name, string jobTitle, string jobIcon, string jobPrototype)
{
Name = name;
JobTitle = jobTitle;
JobIcon = jobIcon;
JobPrototype = jobPrototype;
}
}
/// <summary>
/// Tells the server to open a crew manifest UI from
/// this entity's point of view.
/// </summary>
[Serializable, NetSerializable]
public sealed class CrewManifestOpenUiMessage : BoundUserInterfaceMessage
{}

View File

@@ -0,0 +1,59 @@
using Robust.Shared.Enums;
using Robust.Shared.Serialization;
namespace Content.Shared.StationRecords;
/// <summary>
/// General station record. Indicates the crewmember's name and job.
/// </summary>
[Serializable, NetSerializable]
public sealed class GeneralStationRecord
{
/// <summary>
/// Name tied to this station record.
/// </summary>
[ViewVariables]
public string Name = string.Empty;
/// <summary>
/// Age of the person that this station record represents.
/// </summary>
[ViewVariables]
public int Age;
/// <summary>
/// Job title tied to this station record.
/// </summary>
[ViewVariables]
public string JobTitle = string.Empty;
/// <summary>
/// Job icon tied to this station record.
/// </summary>
[ViewVariables]
public string JobIcon = string.Empty;
[ViewVariables]
public string JobPrototype = string.Empty;
/// <summary>
/// Species tied to this station record.
/// </summary>
[ViewVariables]
public string Species = string.Empty;
/// <summary>
/// Gender identity tied to this station record.
/// </summary>
/// <remarks>Sex should be placed in a medical record, not a general record.</remarks>
[ViewVariables]
public Gender Gender = Gender.Neuter;
/// <summary>
/// The priority to display this record at.
/// This is taken from the 'weight' of a job prototype,
/// usually.
/// </summary>
[ViewVariables]
public int DisplayPriority;
}

View File

@@ -0,0 +1,54 @@
using Robust.Shared.Serialization;
namespace Content.Shared.StationRecords;
[Serializable, NetSerializable]
public enum GeneralStationRecordConsoleKey : byte
{
Key
}
/// <summary>
/// General station records console state. There are a few states:
/// - SelectedKey null, Record null, RecordListing null
/// - The station record database could not be accessed.
/// - SelectedKey null, Record null, RecordListing non-null
/// - Records are populated in the database, or at least the station has
/// the correct component.
/// - SelectedKey non-null, Record null, RecordListing non-null
/// - The selected key does not have a record tied to it.
/// - SelectedKey non-null, Record non-null, RecordListing non-null
/// - The selected key has a record tied to it, and the record has been sent.
///
/// Other states are erroneous.
/// </summary>
[Serializable, NetSerializable]
public sealed class GeneralStationRecordConsoleState : BoundUserInterfaceState
{
/// <summary>
/// Current selected key.
/// </summary>
public StationRecordKey? SelectedKey { get; }
public GeneralStationRecord? Record { get; }
public Dictionary<StationRecordKey, string>? RecordListing { get; }
public GeneralStationRecordConsoleState(StationRecordKey? key, GeneralStationRecord? record, Dictionary<StationRecordKey, string>? recordListing)
{
SelectedKey = key;
Record = record;
RecordListing = recordListing;
}
public bool IsEmpty() => SelectedKey == null && Record == null && RecordListing == null;
}
[Serializable, NetSerializable]
public sealed class SelectGeneralStationRecord : BoundUserInterfaceMessage
{
public StationRecordKey? SelectedKey { get; }
public SelectGeneralStationRecord(StationRecordKey? selectedKey)
{
SelectedKey = selectedKey;
}
}

View File

@@ -0,0 +1,21 @@
using Robust.Shared.Serialization;
namespace Content.Shared.StationRecords;
// Station record keys. These should be stored somewhere,
// preferably within an ID card.
[Serializable, NetSerializable]
public readonly struct StationRecordKey
{
[ViewVariables]
public uint ID { get; }
[ViewVariables]
public EntityUid OriginStation { get; }
public StationRecordKey(uint id, EntityUid originStation)
{
ID = id;
OriginStation = originStation;
}
}