DeathMatchRuleComponent.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Content.Shared.FixedPoint;
  2. using Content.Shared.Roles;
  3. using Content.Shared.Storage;
  4. using Robust.Shared.Network;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Server.GameTicking.Rules.Components;
  8. /// <summary>
  9. /// Gamerule that ends when a player gets a certain number of kills.
  10. /// </summary>
  11. [RegisterComponent, Access(typeof(DeathMatchRuleSystem))]
  12. public sealed partial class DeathMatchRuleComponent : Component
  13. {
  14. /// <summary>
  15. /// The number of points a player has to get to win.
  16. /// </summary>
  17. [DataField("killCap"), ViewVariables(VVAccess.ReadWrite)]
  18. public FixedPoint2 KillCap = 31;
  19. /// <summary>
  20. /// How long until the round restarts
  21. /// </summary>
  22. [DataField("restartDelay"), ViewVariables(VVAccess.ReadWrite)]
  23. public TimeSpan RestartDelay = TimeSpan.FromSeconds(10f);
  24. /// <summary>
  25. /// The person who won.
  26. /// We store this here in case of some assist shenanigans.
  27. /// </summary>
  28. [DataField("victor")]
  29. public NetUserId? Victor;
  30. /// <summary>
  31. /// An entity spawned after a player is killed.
  32. /// </summary>
  33. [DataField("rewardSpawns")]
  34. public List<EntitySpawnEntry> RewardSpawns = new();
  35. /// <summary>
  36. /// The gear all players spawn with.
  37. /// </summary>
  38. [DataField("gear", customTypeSerializer: typeof(PrototypeIdSerializer<StartingGearPrototype>)), ViewVariables(VVAccess.ReadWrite)]
  39. public string Gear = "DeathMatchGear";
  40. }