Files
tbd-station-14/Content.Shared/Tools/Components/ToolComponent.cs
Leon Friedrich 19277a2276 More DoAfter Changes (#14609)
* DoAfters

* Compact Clone()

* Fix mice and cuffables

* Try generalize attempt events

* moves climbabledoafter event to shared, fixes issue with climbable target

* Fix merge (cuffing)

* Make all events netserializable

* handful of doafter events moved

* moves the rest of the events to their respective shared folders

* Changes all mentions of server doafter to shared

* stop stripping cancellation

* fix merge errors

* draw paused doafters

* handle unpausing

* missing netserializable ref

* removes break on stun reference

* removes cuffing state reference

* Fix tools

* Fix door prying.

* Fix construction

* Fix dumping

* Fix wielding assert

* fix rev

* Fix test

* more test fixes

---------

Co-authored-by: keronshb <keronshb@live.com>
2023-04-02 21:13:48 -04:00

55 lines
1.7 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Utility;
namespace Content.Shared.Tools.Components
{
[RegisterComponent, NetworkedComponent] // TODO move tool system to shared, and make it a friend.
public sealed class ToolComponent : Component
{
[DataField("qualities")]
public PrototypeFlags<ToolQualityPrototype> Qualities { get; set; } = new();
/// <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)]
[DataField("speed")]
public float SpeedModifier { get; set; } = 1;
[DataField("useSound")]
public SoundSpecifier? UseSound { get; set; }
}
/// <summary>
/// Attempt event called *before* any do afters to see if the tool usage should succeed or not.
/// You can change the fuel consumption by changing the Fuel property.
/// </summary>
public sealed class ToolUseAttemptEvent : CancellableEntityEventArgs
{
public float Fuel { get; set; }
public EntityUid User { get; }
public ToolUseAttemptEvent(float fuel, EntityUid user)
{
Fuel = fuel;
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;
public ToolUserAttemptUseEvent(EntityUid? target)
{
Target = target;
}
}
}