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
|
|
|
|
2022-04-02 16:52:44 +13:00
|
|
|
namespace Content.Shared.Tools.Components
|
2020-04-28 16:44:22 +02:00
|
|
|
{
|
2022-11-17 18:10:45 -05:00
|
|
|
[RegisterComponent, NetworkedComponent] // TODO move tool system to shared, and make it a friend.
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ToolComponent : Component
|
2020-07-02 14:50:57 -07:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("qualities")]
|
2021-10-07 13:01:27 +02:00
|
|
|
public PrototypeFlags<ToolQualityPrototype> Qualities { get; set; } = new();
|
2020-04-29 13:43:07 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("speed")]
|
2020-05-20 11:05:55 +02:00
|
|
|
public float SpeedModifier { get; set; } = 1;
|
2020-04-29 13:43:07 +02:00
|
|
|
|
2021-08-13 11:04:23 +02:00
|
|
|
[DataField("useSound")]
|
|
|
|
|
public SoundSpecifier? UseSound { get; set; }
|
2020-04-28 16:44:22 +02:00
|
|
|
}
|
2023-02-24 19:01:25 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-09-05 17:20:54 +01:00
|
|
|
/// 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.
|
2023-02-24 19:01:25 -05:00
|
|
|
/// </summary>
|
|
|
|
|
public sealed class ToolUseAttemptEvent : CancellableEntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EntityUid User { get; }
|
|
|
|
|
|
2023-06-28 01:46:48 +00:00
|
|
|
public ToolUseAttemptEvent(EntityUid user)
|
2023-02-24 19:01:25 -05:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event raised on the user of a tool to see if they can actually use it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ByRefEvent]
|
|
|
|
|
public struct ToolUserAttemptUseEvent
|
|
|
|
|
{
|
|
|
|
|
public EntityUid? Target;
|
|
|
|
|
public bool Cancelled = false;
|
|
|
|
|
|
2023-04-03 13:13:48 +12:00
|
|
|
public ToolUserAttemptUseEvent(EntityUid? target)
|
2023-02-24 19:01:25 -05:00
|
|
|
{
|
|
|
|
|
Target = target;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-28 16:44:22 +02:00
|
|
|
}
|