Files
tbd-station-14/Content.Shared/Strip/Components/StrippableComponent.cs
to4no_fix 6567fa36e4 Adding shock collar and electropack (#30529)
* Adding shock collar with the new ShockOnTrigger

* Cleaning and updating the shock collar

* Add StripDelay datafield to ClothingComponent

* Adding SelfUnremovableClothingComponent

* ShockCollar Update

* Correction of the shock collar

* Correction of the shock collar 2

* Renaming the DamageSpecifier DataField to Damage

* Fixing the damage field in ShockCollar

* Cleaning the ShockCollar

* Renaming ShockCollar to ClothingNeckShockCollar

* Adding ClothingNeckShockCollar as a stealTarget to a thief

* Fixing a typo of the sprite path in ClothingNeckShockCollar

* Cleaning the ShockOnTriggerComponent

* Revision of SelfUnremovableClothing

* Adding a ClothingBackpackElectropack

* Sprite fix

* Code review

* Shock Collar sprite update

* add commit hash

---------

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
2024-08-15 10:30:39 -04:00

94 lines
3.5 KiB
C#

using Content.Shared.DoAfter;
using Content.Shared.Inventory;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Strip.Components
{
[RegisterComponent, NetworkedComponent]
public sealed partial class StrippableComponent : Component
{
/// <summary>
/// The strip delay for hands.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("handDelay")]
public TimeSpan HandStripDelay = TimeSpan.FromSeconds(4f);
}
[NetSerializable, Serializable]
public enum StrippingUiKey : byte
{
Key,
}
[NetSerializable, Serializable]
public sealed class StrippingSlotButtonPressed(string slot, bool isHand) : BoundUserInterfaceMessage
{
public readonly string Slot = slot;
public readonly bool IsHand = isHand;
}
[NetSerializable, Serializable]
public sealed class StrippingEnsnareButtonPressed : BoundUserInterfaceMessage;
[ByRefEvent]
public abstract class BaseBeforeStripEvent(TimeSpan initialTime, bool stealth = false) : EntityEventArgs, IInventoryRelayEvent
{
public readonly TimeSpan InitialTime = initialTime;
public float Multiplier = 1f;
public TimeSpan Additive = TimeSpan.Zero;
public bool Stealth = stealth;
public TimeSpan Time => TimeSpan.FromSeconds(MathF.Max(InitialTime.Seconds * Multiplier + Additive.Seconds, 0f));
public SlotFlags TargetSlots { get; } = SlotFlags.GLOVES;
}
/// <summary>
/// Used to modify strip times. Raised directed at the item being stripped.
/// </summary>
/// <remarks>
/// This is also used by some stripping related interactions, i.e., interactions with items that are currently equipped by another player.
/// </remarks>
[ByRefEvent]
public sealed class BeforeItemStrippedEvent(TimeSpan initialTime, bool stealth = false) : BaseBeforeStripEvent(initialTime, stealth);
/// <summary>
/// Used to modify strip times. Raised directed at the user.
/// </summary>
/// <remarks>
/// This is also used by some stripping related interactions, i.e., interactions with items that are currently equipped by another player.
/// </remarks>
[ByRefEvent]
public sealed class BeforeStripEvent(TimeSpan initialTime, bool stealth = false) : BaseBeforeStripEvent(initialTime, stealth);
/// <summary>
/// Used to modify strip times. Raised directed at the target.
/// </summary>
/// <remarks>
/// This is also used by some stripping related interactions, i.e., interactions with items that are currently equipped by another player.
/// </remarks>
[ByRefEvent]
public sealed class BeforeGettingStrippedEvent(TimeSpan initialTime, bool stealth = false) : BaseBeforeStripEvent(initialTime, stealth);
/// <summary>
/// Organizes the behavior of DoAfters for <see cref="StrippableSystem">.
/// </summary>
[Serializable, NetSerializable]
public sealed partial class StrippableDoAfterEvent : DoAfterEvent
{
public readonly bool InsertOrRemove;
public readonly bool InventoryOrHand;
public readonly string SlotOrHandName;
public StrippableDoAfterEvent(bool insertOrRemove, bool inventoryOrHand, string slotOrHandName)
{
InsertOrRemove = insertOrRemove;
InventoryOrHand = inventoryOrHand;
SlotOrHandName = slotOrHandName;
}
public override DoAfterEvent Clone() => this;
}
}