1
0

STWeightComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Robust.Shared.GameStates;
  2. namespace Content.Shared._Stalker.Weight;
  3. [RegisterComponent, NetworkedComponent]
  4. public sealed partial class STWeightComponent : Component
  5. {
  6. /// <summary>
  7. /// The total weight of the entity, which is calculated
  8. /// by recursive passes over all children with this component
  9. /// </summary>
  10. [ViewVariables]
  11. public float Total => Self + InsideWeight;
  12. [ViewVariables]
  13. public float TotalMaximum => Maximum * MaximumModifier;
  14. [DataField, ViewVariables]
  15. public float InsideWeight;
  16. [DataField, ViewVariables]
  17. public float WeightThrowModifier = 0.1f;
  18. /// <summary>
  19. /// This allows you to adjust the strength of
  20. /// the throw so that small objects are not thrown harder,
  21. /// but large objects are thrown weaker
  22. /// </summary>
  23. [DataField, ViewVariables]
  24. public float WeightThrowMinStrengthModifier = 1f;
  25. [DataField, ViewVariables]
  26. public float MovementSpeedModifier = 1f;
  27. [DataField, ViewVariables]
  28. public float MaximumModifier = 1f;
  29. /// <summary>
  30. /// <see cref="STWeightComponent.Total"/> weight at which the entity stops completely,
  31. /// yes this code has a linear deceleration schedule,
  32. /// possible improvements in the future
  33. /// </summary>
  34. [DataField, ViewVariables(VVAccess.ReadWrite)]
  35. public float Maximum = 200f;
  36. /// <summary>
  37. /// <see cref="STWeightComponent.Total"/> weight at which the entity begins to slow down.
  38. /// </summary>
  39. [DataField, ViewVariables(VVAccess.ReadWrite)]
  40. public float Overload = 100f;
  41. [ViewVariables]
  42. public float TotalOverload => Overload * MaximumModifier;
  43. /// <summary>
  44. /// Entity's own weight
  45. /// </summary>
  46. [DataField, ViewVariables(VVAccess.ReadWrite)]
  47. public float Self = 0.05f;
  48. }