Welding tweaks (#27959)

This commit is contained in:
Verm
2024-06-02 22:28:53 -05:00
committed by GitHub
parent 509e3aedf7
commit 31eb3ed62c
33 changed files with 139 additions and 141 deletions

View File

@@ -1,52 +1,43 @@
using Content.Shared.Tools.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Utility;
namespace Content.Shared.Tools.Components
namespace Content.Shared.Tools.Components;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedToolSystem))]
public sealed partial class ToolComponent : Component
{
[RegisterComponent, NetworkedComponent] // TODO move tool system to shared, and make it a friend.
public sealed partial 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; }
}
[DataField]
public PrototypeFlags<ToolQualityPrototype> Qualities = [];
/// <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.
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
/// </summary>
public sealed class ToolUseAttemptEvent : CancellableEntityEventArgs
{
public EntityUid User { get; }
[DataField]
public float SpeedModifier = 1;
public ToolUseAttemptEvent(EntityUid user)
{
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;
}
}
[DataField]
public SoundSpecifier? UseSound;
}
/// <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;
}
/// <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;
}