From bafd549e9e699cb4e213937961be759d1b4e5274 Mon Sep 17 00:00:00 2001 From: pheenty Date: Fri, 1 Nov 2024 04:36:11 +0700 Subject: [PATCH] cuffercomponent --- Content.Shared/Cuffs/SharedCuffableSystem.cs | 8 +++----- Content.Shared/Stories/Cuffs/CufferComponent.cs | 8 ++++++++ Content.Shared/Stories/Cuffs/CuffingSpeedComponent.cs | 8 -------- .../Stories/Entities/Mobs/Species/shadowling.yml | 3 ++- 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 Content.Shared/Stories/Cuffs/CufferComponent.cs delete mode 100644 Content.Shared/Stories/Cuffs/CuffingSpeedComponent.cs diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 7ead5b503b..a13b9df514 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -34,8 +34,6 @@ using Robust.Shared.Utility; using PullableComponent = Content.Shared.Movement.Pulling.Components.PullableComponent; -using Content.Shared.Stories.Cuffs; // Stories - namespace Content.Shared.Cuffs { // TODO remove all the IsServer() checks. @@ -502,14 +500,14 @@ public bool TryCuffing(EntityUid user, EntityUid target, EntityUid handcuff, Han if (HasComp(target)) cuffTime = MathF.Max(0.1f, cuffTime - handcuffComponent.StunBonus); - if (TryComp(user, out var speed)) // Stories - CuffingSpeed - start + if (TryComp(user, out var cuffer)) // Stories - CuffingSpeed - start { - if (speed.Modifier == 0) + if (cuffer.TimeModifier == null) { _popup.PopupClient(Loc.GetString("handcuff-component-cannot-use-cuffs"), user, user); return false; } - cuffTime = cuffTime / speed.Modifier; + cuffTime = cuffTime * (float)cuffer.TimeModifier; } // Stories - CuffingSpeed - end if (HasComp(target)) diff --git a/Content.Shared/Stories/Cuffs/CufferComponent.cs b/Content.Shared/Stories/Cuffs/CufferComponent.cs new file mode 100644 index 0000000000..34750df8bb --- /dev/null +++ b/Content.Shared/Stories/Cuffs/CufferComponent.cs @@ -0,0 +1,8 @@ +namespace Content.Shared.Cuffs; + +[RegisterComponent] +public sealed partial class CufferComponent : Component +{ + [DataField("timeModifier")] + public float? TimeModifier = 1; +} diff --git a/Content.Shared/Stories/Cuffs/CuffingSpeedComponent.cs b/Content.Shared/Stories/Cuffs/CuffingSpeedComponent.cs deleted file mode 100644 index 5ffa24e8a6..0000000000 --- a/Content.Shared/Stories/Cuffs/CuffingSpeedComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Content.Shared.Stories.Cuffs; - -[RegisterComponent] -public sealed partial class CuffingSpeedComponent : Component -{ - [ViewVariables(VVAccess.ReadWrite), DataField("modifier")] - public float Modifier = 0; -} diff --git a/Resources/Prototypes/Stories/Entities/Mobs/Species/shadowling.yml b/Resources/Prototypes/Stories/Entities/Mobs/Species/shadowling.yml index da6275f9c5..dcf1d3f5b6 100644 --- a/Resources/Prototypes/Stories/Entities/Mobs/Species/shadowling.yml +++ b/Resources/Prototypes/Stories/Entities/Mobs/Species/shadowling.yml @@ -9,7 +9,8 @@ id: BaseMobShadowling abstract: true components: - - type: CuffingSpeed + - type: Cuffer + timeModifier: null - type: ZombieImmune - type: ThermalVision - type: ComplexInteraction