IonStormTargetComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Content.Shared.Random;
  2. using Robust.Shared.Prototypes;
  3. namespace Content.Shared.Silicons.Laws.Components;
  4. /// <summary>
  5. /// During the ion storm event, this entity will have <see cref="IonStormLawsEvent"/> raised on it if it has laws.
  6. /// New laws can be modified in multiple ways depending on the fields below.
  7. /// </summary>
  8. [RegisterComponent]
  9. public sealed partial class IonStormTargetComponent : Component
  10. {
  11. /// <summary>
  12. /// <see cref="WeightedRandomPrototype"/> for a random lawset to possibly replace the old one with.
  13. /// </summary>
  14. [DataField, ViewVariables(VVAccess.ReadWrite)]
  15. public ProtoId<WeightedRandomPrototype> RandomLawsets = "IonStormLawsets";
  16. /// <summary>
  17. /// Chance for this borg to be affected at all.
  18. /// </summary>
  19. [DataField, ViewVariables(VVAccess.ReadWrite)]
  20. public float Chance = 0.8f;
  21. /// <summary>
  22. /// Chance to replace the lawset with a random one
  23. /// </summary>
  24. [DataField, ViewVariables(VVAccess.ReadWrite)]
  25. public float RandomLawsetChance = 0.25f;
  26. /// <summary>
  27. /// Chance to remove a random law.
  28. /// </summary>
  29. [DataField, ViewVariables(VVAccess.ReadWrite)]
  30. public float RemoveChance = 0.2f;
  31. /// <summary>
  32. /// Chance to replace a random law with the new one, rather than have it be a glitched-order law.
  33. /// </summary>
  34. [DataField, ViewVariables(VVAccess.ReadWrite)]
  35. public float ReplaceChance = 0.2f;
  36. /// <summary>
  37. /// Chance to shuffle laws after everything is done.
  38. /// </summary>
  39. [DataField, ViewVariables(VVAccess.ReadWrite)]
  40. public float ShuffleChance = 0.2f;
  41. }
  42. /// <summary>
  43. /// Raised on an ion storm target to modify its laws.
  44. /// </summary>
  45. [ByRefEvent]
  46. public record struct IonStormLawsEvent(SiliconLawset Lawset);