2022-05-10 13:43:30 -05:00
|
|
|
using Content.Server.Station;
|
|
|
|
|
using JetBrains.Annotations;
|
2021-11-20 12:32:07 -06:00
|
|
|
using Robust.Shared.Prototypes;
|
2022-02-02 00:05:55 +11:00
|
|
|
using Robust.Shared.Utility;
|
2022-11-07 18:18:21 -08:00
|
|
|
using System.Diagnostics;
|
2021-11-20 12:32:07 -06:00
|
|
|
|
2021-11-26 03:02:46 -06:00
|
|
|
namespace Content.Server.Maps;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Prototype data for a game map.
|
|
|
|
|
/// </summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
/// <remarks>
|
|
|
|
|
/// Forks should not directly edit existing parts of this class.
|
|
|
|
|
/// Make a new partial for your fancy new feature, it'll save you time later.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
[Prototype("gameMap"), PublicAPI]
|
2022-11-07 18:18:21 -08:00
|
|
|
[DebuggerDisplay("GameMapPrototype [{ID} - {MapName}]")]
|
2022-05-10 13:43:30 -05:00
|
|
|
public sealed partial class GameMapPrototype : IPrototype
|
2021-11-20 12:32:07 -06:00
|
|
|
{
|
2021-11-26 03:02:46 -06:00
|
|
|
/// <inheritdoc/>
|
2022-05-10 13:43:30 -05:00
|
|
|
[IdDataField]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string ID { get; private set; } = default!;
|
2021-11-26 03:02:46 -06:00
|
|
|
|
|
|
|
|
/// <summary>
|
2021-11-26 07:54:32 -06:00
|
|
|
/// Name of the map to use in generic messages, like the map vote.
|
2021-11-26 03:02:46 -06:00
|
|
|
/// </summary>
|
|
|
|
|
[DataField("mapName", required: true)]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string MapName { get; private set; } = default!;
|
2021-11-26 03:02:46 -06:00
|
|
|
|
2021-11-26 07:54:32 -06:00
|
|
|
/// <summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
/// Relative directory path to the given map, i.e. `/Maps/saltern.yml`
|
2021-11-26 03:02:46 -06:00
|
|
|
/// </summary>
|
|
|
|
|
[DataField("mapPath", required: true)]
|
2023-08-22 18:14:33 -07:00
|
|
|
public ResPath MapPath { get; private set; } = default!;
|
2021-11-26 03:02:46 -06:00
|
|
|
|
2022-05-10 15:21:55 -05:00
|
|
|
[DataField("stations", required: true)]
|
2022-05-10 13:43:30 -05:00
|
|
|
private Dictionary<string, StationConfig> _stations = new();
|
2021-11-26 03:02:46 -06:00
|
|
|
|
2021-11-20 12:32:07 -06:00
|
|
|
/// <summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
/// The stations this map contains. The names should match with the BecomesStation components.
|
2021-11-26 03:02:46 -06:00
|
|
|
/// </summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
public IReadOnlyDictionary<string, StationConfig> Stations => _stations;
|
2023-12-17 03:55:19 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Performs a shallow clone of this map prototype, replacing <c>MapPath</c> with the argument.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public GameMapPrototype Persistence(ResPath mapPath)
|
|
|
|
|
{
|
|
|
|
|
return new()
|
|
|
|
|
{
|
|
|
|
|
ID = ID,
|
|
|
|
|
MapName = MapName,
|
|
|
|
|
MapPath = mapPath,
|
|
|
|
|
_stations = _stations
|
|
|
|
|
};
|
|
|
|
|
}
|
2021-11-20 12:32:07 -06:00
|
|
|
}
|