PullerComponent.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Content.Shared.Alert;
  2. using Content.Shared.Movement.Pulling.Systems;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  6. namespace Content.Shared.Movement.Pulling.Components;
  7. /// <summary>
  8. /// Specifies an entity as being able to pull another entity with <see cref="PullableComponent"/>
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  11. [Access(typeof(PullingSystem))]
  12. public sealed partial class PullerComponent : Component
  13. {
  14. // My raiding guild
  15. /// <summary>
  16. /// Next time the puller can throw what is being pulled.
  17. /// Used to avoid spamming it for infinite spin + velocity.
  18. /// </summary>
  19. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, Access(Other = AccessPermissions.ReadWriteExecute)]
  20. public TimeSpan NextThrow;
  21. [DataField]
  22. public TimeSpan ThrowCooldown = TimeSpan.FromSeconds(1);
  23. // Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
  24. public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.95f;
  25. public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.95f;
  26. /// <summary>
  27. /// Entity currently being pulled if applicable.
  28. /// </summary>
  29. [AutoNetworkedField, DataField]
  30. public EntityUid? Pulling;
  31. /// <summary>
  32. /// Does this entity need hands to be able to pull something?
  33. /// </summary>
  34. [DataField]
  35. public bool NeedsHands = true;
  36. [DataField]
  37. public ProtoId<AlertPrototype> PullingAlert = "Pulling";
  38. }
  39. public sealed partial class StopPullingAlertEvent : BaseAlertEvent;