1
0

ToolComponent.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Content.Shared.Tools.Systems;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Utility;
  5. namespace Content.Shared.Tools.Components;
  6. [RegisterComponent, NetworkedComponent]
  7. [Access(typeof(SharedToolSystem))]
  8. public sealed partial class ToolComponent : Component
  9. {
  10. [DataField]
  11. public PrototypeFlags<ToolQualityPrototype> Qualities = [];
  12. /// <summary>
  13. /// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
  14. /// </summary>
  15. [DataField]
  16. public float SpeedModifier = 1;
  17. [DataField]
  18. public SoundSpecifier? UseSound;
  19. }
  20. /// <summary>
  21. /// Attempt event called *before* any do afters to see if the tool usage should succeed or not.
  22. /// Raised on both the tool and then target.
  23. /// </summary>
  24. public sealed class ToolUseAttemptEvent(EntityUid user, float fuel) : CancellableEntityEventArgs
  25. {
  26. public EntityUid User { get; } = user;
  27. public float Fuel = fuel;
  28. }
  29. /// <summary>
  30. /// Event raised on the user of a tool to see if they can actually use it.
  31. /// </summary>
  32. [ByRefEvent]
  33. public struct ToolUserAttemptUseEvent(EntityUid? target)
  34. {
  35. public EntityUid? Target = target;
  36. public bool Cancelled = false;
  37. }