1
0

CommsHackerComponent.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Content.Shared.Random;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Shared.Communications;
  5. /// <summary>
  6. /// Component for hacking a communications console to call in a threat.
  7. /// Can only be done once, the component is remove afterwards.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, Access(typeof(SharedCommsHackerSystem))]
  10. public sealed partial class CommsHackerComponent : Component
  11. {
  12. /// <summary>
  13. /// Time taken to hack the console
  14. /// </summary>
  15. [DataField, ViewVariables(VVAccess.ReadWrite)]
  16. public TimeSpan Delay = TimeSpan.FromSeconds(20);
  17. /// <summary>
  18. /// Weighted random for the possible threats to choose from.
  19. /// </summary>
  20. [DataField(required: true)]
  21. public ProtoId<WeightedRandomPrototype> Threats = string.Empty;
  22. }
  23. /// <summary>
  24. /// A threat that can be called in to the station by a ninja hacking a communications console.
  25. /// Generally some kind of mid-round minor antag, though you could make it call in scrubber backflow if you wanted to.
  26. /// You wouldn't do that, right?
  27. /// </summary>
  28. [Prototype]
  29. public sealed partial class NinjaHackingThreatPrototype : IPrototype
  30. {
  31. [IdDataField]
  32. public string ID { get; private set; } = default!;
  33. /// <summary>
  34. /// Locale id for the announcement to be made from CentCom.
  35. /// </summary>
  36. [DataField(required: true)]
  37. public LocId Announcement;
  38. /// <summary>
  39. /// The game rule for the threat to be added, it should be able to work when added mid-round otherwise this will do nothing.
  40. /// </summary>
  41. [DataField(required: true)]
  42. public EntProtoId Rule;
  43. }