Files
tbd-station-14/Content.Server/GameObjects/Components/Markers/SpawnPointComponent.cs
Víctor Aguilera Puerto 09a27df6db Makes players spawn on job spawn markers on roundstart (#543)
* Adds job type to spawn points, makes players spawn on job spawn markers on roundstart

* Update Content.Server/GameObjects/Components/Markers/SpawnPointComponent.cs

Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com>

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
2020-01-23 17:31:47 +01:00

43 lines
1.3 KiB
C#

using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.Jobs;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Markers
{
[RegisterComponent]
[ComponentReference(typeof(SharedSpawnPointComponent))]
public sealed class SpawnPointComponent : SharedSpawnPointComponent
{
#pragma warning disable 649
[Dependency] private IPrototypeManager _prototypeManager;
#pragma warning restore 649
[ViewVariables(VVAccess.ReadWrite)]
private SpawnPointType _spawnType;
[ViewVariables(VVAccess.ReadWrite)]
private string _jobId;
public SpawnPointType SpawnType => _spawnType;
public JobPrototype Job => string.IsNullOrEmpty(_jobId) ? null
: _prototypeManager.Index<JobPrototype>(_jobId);
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _spawnType, "spawn_type", SpawnPointType.Unset);
serializer.DataField(ref _jobId, "job_id", null);
}
}
public enum SpawnPointType
{
Unset = 0,
LateJoin,
Job,
}
}