1
0

DamageForceSayComponent.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Content.Shared.Damage.Prototypes;
  2. using Content.Shared.Dataset;
  3. using Content.Shared.FixedPoint;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Shared.Damage.ForceSay;
  7. /// <summary>
  8. /// This is used for forcing clients to send messages with a suffix attached (like -GLORF) when taking large amounts
  9. /// of damage, or things like entering crit or being stunned.
  10. /// </summary>
  11. [RegisterComponent, NetworkedComponent]
  12. public sealed partial class DamageForceSayComponent : Component
  13. {
  14. /// <summary>
  15. /// The localization string that the message & suffix will be passed into
  16. /// </summary>
  17. [DataField]
  18. public LocId ForceSayMessageWrap = "damage-force-say-message-wrap";
  19. /// <summary>
  20. /// Same as <see cref="ForceSayMessageWrap"/> but for cases where no suffix is used,
  21. /// such as when going into crit.
  22. /// </summary>
  23. [DataField]
  24. public LocId ForceSayMessageWrapNoSuffix = "damage-force-say-message-wrap-no-suffix";
  25. /// <summary>
  26. /// The fluent string prefix to use when picking a random suffix
  27. /// </summary>
  28. [DataField]
  29. public ProtoId<LocalizedDatasetPrototype> ForceSayStringDataset = "ForceSayStringDataset";
  30. /// <summary>
  31. /// The amount of total damage between <see cref="ValidDamageGroups"/> that needs to be taken before
  32. /// a force say occurs.
  33. /// </summary>
  34. [DataField]
  35. public FixedPoint2 DamageThreshold = FixedPoint2.New(5);
  36. /// <summary>
  37. /// A list of damage group types that are considered when checking <see cref="DamageThreshold"/>.
  38. /// </summary>
  39. [DataField]
  40. public HashSet<ProtoId<DamageGroupPrototype>>? ValidDamageGroups = new()
  41. {
  42. "Brute",
  43. "Burn",
  44. };
  45. /// <summary>
  46. /// The time enforced between force says to avoid spam.
  47. /// </summary>
  48. [DataField]
  49. public TimeSpan Cooldown = TimeSpan.FromSeconds(5.0);
  50. public TimeSpan? NextAllowedTime = null;
  51. }