Files

157 lines
4.2 KiB
C#
Raw Permalink Normal View History

2023-04-20 10:43:13 +10:00
using Content.Shared.Salvage.Expeditions.Modifiers;
using Robust.Shared.Audio;
2023-03-10 16:41:22 +11:00
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
2023-06-27 21:28:51 +10:00
namespace Content.Shared.Salvage.Expeditions;
2023-03-10 16:41:22 +11:00
[Serializable, NetSerializable]
public sealed class SalvageExpeditionConsoleState : BoundUserInterfaceState
{
public TimeSpan NextOffer;
public bool Claimed;
2023-04-20 10:43:13 +10:00
public bool Cooldown;
2023-03-10 16:41:22 +11:00
public ushort ActiveMission;
2023-04-20 10:43:13 +10:00
public List<SalvageMissionParams> Missions;
2023-03-10 16:41:22 +11:00
2023-04-20 10:43:13 +10:00
public SalvageExpeditionConsoleState(TimeSpan nextOffer, bool claimed, bool cooldown, ushort activeMission, List<SalvageMissionParams> missions)
2023-03-10 16:41:22 +11:00
{
NextOffer = nextOffer;
Claimed = claimed;
2023-04-20 10:43:13 +10:00
Cooldown = cooldown;
2023-03-10 16:41:22 +11:00
ActiveMission = activeMission;
Missions = missions;
}
}
/// <summary>
/// Used to interact with salvage expeditions and claim them.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class SalvageExpeditionConsoleComponent : Component
2023-03-10 16:41:22 +11:00
{
/// <summary>
/// The sound made when spawning a coordinates disk
/// </summary>
[DataField]
public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/terminal_insert_disc.ogg");
2023-03-10 16:41:22 +11:00
}
[Serializable, NetSerializable]
public sealed class ClaimSalvageMessage : BoundUserInterfaceMessage
{
public ushort Index;
}
/// <summary>
/// Added per station to store data on their available salvage missions.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class SalvageExpeditionDataComponent : Component
2023-03-10 16:41:22 +11:00
{
/// <summary>
/// Is there an active salvage expedition.
/// </summary>
[ViewVariables]
public bool Claimed => ActiveMission != 0;
2023-04-20 10:43:13 +10:00
/// <summary>
/// Are we actively cooling down from the last salvage mission.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("cooldown")]
public bool Cooldown = false;
2023-03-10 16:41:22 +11:00
/// <summary>
/// Nexy time salvage missions are offered.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextOffer", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
2023-03-10 16:41:22 +11:00
public TimeSpan NextOffer;
[ViewVariables]
2023-04-20 10:43:13 +10:00
public readonly Dictionary<ushort, SalvageMissionParams> Missions = new();
2023-03-10 16:41:22 +11:00
[ViewVariables] public ushort ActiveMission;
public ushort NextIndex = 1;
}
[Serializable, NetSerializable]
2023-09-19 22:52:01 +10:00
public sealed record SalvageMissionParams
2023-03-10 16:41:22 +11:00
{
[ViewVariables]
public ushort Index;
2023-04-20 10:43:13 +10:00
[ViewVariables(VVAccess.ReadWrite)] public int Seed;
2023-03-10 16:41:22 +11:00
public string Difficulty = "Moderate";
2023-03-10 16:41:22 +11:00
}
2023-04-20 10:43:13 +10:00
/// <summary>
/// Created from <see cref="SalvageMissionParams"/>. Only needed for data the client also needs for mission
/// display.
/// </summary>
public sealed record SalvageMission(
int Seed,
string Dungeon,
string Faction,
string Biome,
string Air,
float Temperature,
2023-04-20 10:43:13 +10:00
Color? Color,
TimeSpan Duration,
List<string> Modifiers)
2023-03-10 16:41:22 +11:00
{
2023-04-20 10:43:13 +10:00
/// <summary>
/// Seed used for the mission.
/// </summary>
public readonly int Seed = Seed;
/// <summary>
2023-09-19 22:52:01 +10:00
/// <see cref="SalvageDungeonModPrototype"/> to be used.
2023-04-20 10:43:13 +10:00
/// </summary>
public readonly string Dungeon = Dungeon;
/// <summary>
/// <see cref="SalvageFactionPrototype"/> to be used.
/// </summary>
public readonly string Faction = Faction;
/// <summary>
/// Biome to be used for the mission.
/// </summary>
public readonly string Biome = Biome;
/// <summary>
/// Air mixture to be used for the mission's planet.
/// </summary>
public readonly string Air = Air;
/// <summary>
/// Temperature of the planet's atmosphere.
/// </summary>
public readonly float Temperature = Temperature;
2023-04-20 10:43:13 +10:00
/// <summary>
/// Lighting color to be used (AKA outdoor lighting).
/// </summary>
public readonly Color? Color = Color;
/// <summary>
/// Mission duration.
/// </summary>
public TimeSpan Duration = Duration;
/// <summary>
/// Modifiers (outside of the above) applied to the mission.
/// </summary>
public List<string> Modifiers = Modifiers;
2023-03-10 16:41:22 +11:00
}
[Serializable, NetSerializable]
public enum SalvageConsoleUiKey : byte
{
Expedition,
}