Files
tbd-station-14/Content.Server/GameTicking/Rules/Components/DeathMatchRuleComponent.cs
2023-08-30 18:06:15 -07:00

47 lines
1.5 KiB
C#

using Content.Shared.FixedPoint;
using Content.Shared.Roles;
using Content.Shared.Storage;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.GameTicking.Rules.Components;
/// <summary>
/// Gamerule that ends when a player gets a certain number of kills.
/// </summary>
[RegisterComponent, Access(typeof(DeathMatchRuleSystem))]
public sealed partial class DeathMatchRuleComponent : Component
{
/// <summary>
/// The number of points a player has to get to win.
/// </summary>
[DataField("killCap"), ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 KillCap = 31;
/// <summary>
/// How long until the round restarts
/// </summary>
[DataField("restartDelay"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan RestartDelay = TimeSpan.FromSeconds(10f);
/// <summary>
/// The person who won.
/// We store this here in case of some assist shenanigans.
/// </summary>
[DataField("victor")]
public NetUserId? Victor;
/// <summary>
/// An entity spawned after a player is killed.
/// </summary>
[DataField("rewardSpawns")]
public List<EntitySpawnEntry> RewardSpawns = new();
/// <summary>
/// The gear all players spawn with.
/// </summary>
[DataField("gear", customTypeSerializer: typeof(PrototypeIdSerializer<StartingGearPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public string Gear = "DeathMatchGear";
}