PacifiedComponent.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Content.Shared.Alert;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Shared.CombatMode.Pacification;
  5. /// <summary>
  6. /// Status effect that disallows harming living things and restricts aggressive actions.
  7. ///
  8. /// There is a caveat with pacifism. It's not intended to be wholly encompassing: there are ways of harming people
  9. /// while pacified--plenty of them, even! The goal is to restrict the obvious ones to make gameplay more interesting
  10. /// while not overly limiting.
  11. ///
  12. /// If you want full-pacifism (no combat mode at all), you can simply set <see cref="DisallowAllCombat"/> before adding.
  13. /// </summary>
  14. [RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
  15. [Access(typeof(PacificationSystem))]
  16. public sealed partial class PacifiedComponent : Component
  17. {
  18. [DataField]
  19. public bool DisallowDisarm = false;
  20. /// <summary>
  21. /// If true, this will disable combat entirely instead of only disallowing attacking living creatures and harmful things.
  22. /// </summary>
  23. [DataField]
  24. public bool DisallowAllCombat = false;
  25. /// <summary>
  26. /// When attempting attack against the same entity multiple times,
  27. /// don't spam popups every frame and instead have a cooldown.
  28. /// </summary>
  29. [DataField]
  30. public TimeSpan PopupCooldown = TimeSpan.FromSeconds(3.0);
  31. [DataField]
  32. [AutoPausedField]
  33. public TimeSpan? NextPopupTime = null;
  34. /// <summary>
  35. /// The last entity attacked, used for popup purposes (avoid spam)
  36. /// </summary>
  37. [DataField]
  38. public EntityUid? LastAttackedEntity = null;
  39. [DataField]
  40. public ProtoId<AlertPrototype> PacifiedAlert = "Pacified";
  41. }