AllowNextCritSpeechComponent.cs 1.3 KB

12345678910111213141516171819202122232425
  1. using Content.Shared.Mobs.Components;
  2. using Content.Shared.Mobs.Systems;
  3. using Robust.Shared.GameStates;
  4. namespace Content.Shared.Damage.ForceSay;
  5. /// <summary>
  6. /// The reason for this component's existence is slightly unintuitive, so for context: this is put on an entity
  7. /// to allow its next speech attempt to bypass <see cref="MobStateComponent"/> checks. The reason for this is to allow
  8. /// 'force saying'--for instance, with deathgasping or with <see cref="DamageForceSayComponent"/>.
  9. ///
  10. /// This component is either removed in the <see cref="MobStateSystem"/> speech attempt check, or after <see cref="Timeout"/>
  11. /// has passed. This is to allow a player-submitted forced message in the case of <see cref="DamageForceSayComponent"/>,
  12. /// while also ensuring that it isn't valid forever. It has to work this way, because the server is not a keylogger and doesn't
  13. /// have any knowledge of what the client might actually have typed, so it gives them some leeway for ping.
  14. /// </summary>
  15. [RegisterComponent, NetworkedComponent]
  16. public sealed partial class AllowNextCritSpeechComponent : Component
  17. {
  18. /// <summary>
  19. /// Should be set when adding the component to specify the time that this should be valid for,
  20. /// if it should stay valid for some amount of time.
  21. /// </summary>
  22. public TimeSpan? Timeout = null;
  23. }