2024-06-02 22:28:53 -05:00
|
|
|
using Content.Shared.Tools.Systems;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2022-11-17 18:10:45 -05:00
|
|
|
using Robust.Shared.GameStates;
|
2021-10-07 13:01:27 +02:00
|
|
|
using Robust.Shared.Utility;
|
2020-04-28 16:44:22 +02:00
|
|
|
|
2024-06-02 22:28:53 -05:00
|
|
|
namespace Content.Shared.Tools.Components;
|
2020-04-29 13:43:07 +02:00
|
|
|
|
2024-06-02 22:28:53 -05:00
|
|
|
[RegisterComponent, NetworkedComponent]
|
|
|
|
|
[Access(typeof(SharedToolSystem))]
|
|
|
|
|
public sealed partial class ToolComponent : Component
|
|
|
|
|
{
|
|
|
|
|
[DataField]
|
|
|
|
|
public PrototypeFlags<ToolQualityPrototype> Qualities = [];
|
2023-02-24 19:01:25 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
2024-06-02 22:28:53 -05:00
|
|
|
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
2023-02-24 19:01:25 -05:00
|
|
|
/// </summary>
|
2024-06-02 22:28:53 -05:00
|
|
|
[DataField]
|
|
|
|
|
public float SpeedModifier = 1;
|
2023-02-24 19:01:25 -05:00
|
|
|
|
2024-06-02 22:28:53 -05:00
|
|
|
[DataField]
|
|
|
|
|
public SoundSpecifier? UseSound;
|
|
|
|
|
}
|
2023-02-24 19:01:25 -05:00
|
|
|
|
2024-06-02 22:28:53 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Attempt event called *before* any do afters to see if the tool usage should succeed or not.
|
|
|
|
|
/// Raised on both the tool and then target.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class ToolUseAttemptEvent(EntityUid user, float fuel) : CancellableEntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EntityUid User { get; } = user;
|
|
|
|
|
public float Fuel = fuel;
|
|
|
|
|
}
|
2023-02-24 19:01:25 -05:00
|
|
|
|
2024-06-02 22:28:53 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Event raised on the user of a tool to see if they can actually use it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ByRefEvent]
|
|
|
|
|
public struct ToolUserAttemptUseEvent(EntityUid? target)
|
|
|
|
|
{
|
|
|
|
|
public EntityUid? Target = target;
|
|
|
|
|
public bool Cancelled = false;
|
2020-04-28 16:44:22 +02:00
|
|
|
}
|