Files
tbd-station-14/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs
SlamBamActionman bed9e9ac6a Coordinates Disks & Shuttle FTL Travel (#23240)
* Adds the CentComm Disk and configures it to work with direct-use shuttles

* Added functionality for drone shuttles (i.e. cargo shuttle)

* Adds support for pods, and a disk console object for disks to be inserted into. Also sprites.

* Added the disk to HoP's locker

* Removed leftover logs & comments

* Fix for integration test

* Apply suggestions from code review (formatting & proper DataField)

Co-authored-by: 0x6273 <0x40@keemail.me>

* Fix integration test & changes based on code review

* Includes Disk Cases to contain Coordinate Disks, which are now CDs instead of Floppy Disks

* Check pods & non-evac shuttles for CentCom travel, even in FTL

* Import

* Remove CentCom travel restrictions & pod disk consoles

* Major changes that changes the coordinates disk system to work with salvage expeditions

* Missed CC diskcase removal

* Fix build

* Review suggestions and changes

* Major additional changes after merge

* Minor tag miss

* Integration test fix

* review

---------

Co-authored-by: 0x6273 <0x40@keemail.me>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-04-01 15:50:00 +11:00

157 lines
4.2 KiB
C#

using Content.Shared.Salvage.Expeditions.Modifiers;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Salvage.Expeditions;
[Serializable, NetSerializable]
public sealed class SalvageExpeditionConsoleState : BoundUserInterfaceState
{
public TimeSpan NextOffer;
public bool Claimed;
public bool Cooldown;
public ushort ActiveMission;
public List<SalvageMissionParams> Missions;
public SalvageExpeditionConsoleState(TimeSpan nextOffer, bool claimed, bool cooldown, ushort activeMission, List<SalvageMissionParams> missions)
{
NextOffer = nextOffer;
Claimed = claimed;
Cooldown = cooldown;
ActiveMission = activeMission;
Missions = missions;
}
}
/// <summary>
/// Used to interact with salvage expeditions and claim them.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class SalvageExpeditionConsoleComponent : Component
{
/// <summary>
/// The sound made when spawning a coordinates disk
/// </summary>
[DataField]
public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/terminal_insert_disc.ogg");
}
[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
{
/// <summary>
/// Is there an active salvage expedition.
/// </summary>
[ViewVariables]
public bool Claimed => ActiveMission != 0;
/// <summary>
/// Are we actively cooling down from the last salvage mission.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("cooldown")]
public bool Cooldown = false;
/// <summary>
/// Nexy time salvage missions are offered.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextOffer", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextOffer;
[ViewVariables]
public readonly Dictionary<ushort, SalvageMissionParams> Missions = new();
[ViewVariables] public ushort ActiveMission;
public ushort NextIndex = 1;
}
[Serializable, NetSerializable]
public sealed record SalvageMissionParams
{
[ViewVariables]
public ushort Index;
[ViewVariables(VVAccess.ReadWrite)] public int Seed;
public string Difficulty = string.Empty;
}
/// <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,
Color? Color,
TimeSpan Duration,
List<string> Modifiers)
{
/// <summary>
/// Seed used for the mission.
/// </summary>
public readonly int Seed = Seed;
/// <summary>
/// <see cref="SalvageDungeonModPrototype"/> to be used.
/// </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;
/// <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;
}
[Serializable, NetSerializable]
public enum SalvageConsoleUiKey : byte
{
Expedition,
}