From 045eba06c3f87c4b5e2c2e4f99e3c120e37d9b12 Mon Sep 17 00:00:00 2001 From: Clon clover <76759079+noudoit@users.noreply.github.com> Date: Tue, 4 Jul 2023 05:30:09 +0800 Subject: [PATCH] Damage on forced uncuff (#17801) * cuffs do 1 damage * Update SharedCuffableSystem.cs * Update SharedCuffableSystem.cs * remove unused code * Update CuffableComponent.cs * alphabetical * damage --------- Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> --- .../Cuffs/Components/CuffableComponent.cs | 13 +++++++++++++ Content.Shared/Cuffs/SharedCuffableSystem.cs | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/Content.Shared/Cuffs/Components/CuffableComponent.cs b/Content.Shared/Cuffs/Components/CuffableComponent.cs index 624cc06ac4..7c431ff9a3 100644 --- a/Content.Shared/Cuffs/Components/CuffableComponent.cs +++ b/Content.Shared/Cuffs/Components/CuffableComponent.cs @@ -1,3 +1,4 @@ +using Content.Shared.Damage; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Serialization; @@ -38,6 +39,18 @@ public sealed class CuffableComponent : Component /// [DataField("canStillInteract"), ViewVariables(VVAccess.ReadWrite)] public bool CanStillInteract = true; + + /// + /// Damage is applied to someone when they try to uncuff themselves. + /// + [DataField("damageOnResist"), ViewVariables(VVAccess.ReadWrite)] + public DamageSpecifier DamageOnResist = new() + { + DamageDict = new() + { + { "Blunt", 3.0 }, + } + }; } [Serializable, NetSerializable] diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 64f9b7c6e3..059f4b1742 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Administration.Logs; using Content.Shared.Alert; using Content.Shared.Buckle.Components; using Content.Shared.Cuffs.Components; +using Content.Shared.Damage; using Content.Shared.Database; using Content.Shared.DoAfter; using Content.Shared.Hands; @@ -41,6 +42,7 @@ namespace Content.Shared.Cuffs [Dependency] private readonly ISharedAdminLogManager _adminLog = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly AlertsSystem _alerts = default!; + [Dependency] private readonly DamageableSystem _damageSystem = default!; [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedContainerSystem _container = default!; @@ -573,6 +575,13 @@ namespace Content.Shared.Cuffs if (!_doAfter.TryStartDoAfter(doAfterEventArgs)) return; + _adminLog.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(user)} is trying to uncuff {ToPrettyString(target)}"); + + if (isOwner) + { + _damageSystem.TryChangeDamage(target, cuffable.DamageOnResist, true, false); + } + if (_net.IsServer) { _popup.PopupEntity(Loc.GetString("cuffable-component-start-uncuffing-observer",