From ebab4cae8cbd00d11434e1cc53b2b690cad980e0 Mon Sep 17 00:00:00 2001
From: brainfood1183 <113240905+brainfood1183@users.noreply.github.com>
Date: Sat, 22 Jul 2023 23:14:25 +0100
Subject: [PATCH] Straitjacket Functionality. (#18052)
---
.../Cuffs/Components/CuffableComponent.cs | 12 -------
.../Cuffs/Components/HandcuffComponent.cs | 10 ++++++
Content.Shared/Cuffs/SharedCuffableSystem.cs | 4 +--
.../cuffs/components/cuffable-component.ftl | 26 +++++++--------
.../cuffs/components/handcuff-component.ftl | 30 +++++++++---------
.../Entities/Clothing/OuterClothing/misc.yml | 11 -------
.../Prototypes/Entities/Mobs/Species/base.yml | 10 +++---
.../Entities/Objects/Misc/handcuffs.yml | 21 ++++++++++++
...d-OUTERCLOTHING.png => body-overlay-2.png} | Bin
.../Misc/straight_jacket.rsi/meta.json | 2 +-
10 files changed, 67 insertions(+), 59 deletions(-)
rename Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/{equipped-OUTERCLOTHING.png => body-overlay-2.png} (100%)
diff --git a/Content.Shared/Cuffs/Components/CuffableComponent.cs b/Content.Shared/Cuffs/Components/CuffableComponent.cs
index 7c431ff9a3..4cfeec5636 100644
--- a/Content.Shared/Cuffs/Components/CuffableComponent.cs
+++ b/Content.Shared/Cuffs/Components/CuffableComponent.cs
@@ -39,18 +39,6 @@ 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/Components/HandcuffComponent.cs b/Content.Shared/Cuffs/Components/HandcuffComponent.cs
index 27f8a0a112..398fce4fc7 100644
--- a/Content.Shared/Cuffs/Components/HandcuffComponent.cs
+++ b/Content.Shared/Cuffs/Components/HandcuffComponent.cs
@@ -1,3 +1,4 @@
+using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
@@ -47,6 +48,15 @@ public sealed class HandcuffComponent : Component
[DataField("brokenPrototype", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)]
public string? BrokenPrototype;
+ [DataField("damageOnResist"), ViewVariables(VVAccess.ReadWrite)]
+ public DamageSpecifier DamageOnResist = new()
+ {
+ DamageDict = new()
+ {
+ { "Blunt", 3.0 },
+ }
+ };
+
///
/// The path of the RSI file used for the player cuffed overlay.
///
diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs
index 39385bf795..470256c9a6 100644
--- a/Content.Shared/Cuffs/SharedCuffableSystem.cs
+++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs
@@ -266,7 +266,7 @@ namespace Content.Shared.Cuffs
private void OnCuffAfterInteract(EntityUid uid, HandcuffComponent component, AfterInteractEvent args)
{
- if (args.Target is not {Valid: true} target)
+ if (args.Target is not { Valid: true } target)
return;
if (!args.CanReach)
@@ -580,7 +580,7 @@ namespace Content.Shared.Cuffs
if (isOwner)
{
- _damageSystem.TryChangeDamage(target, cuffable.DamageOnResist, true, false);
+ _damageSystem.TryChangeDamage(target, cuff.DamageOnResist, true, false);
}
if (_net.IsServer)
diff --git a/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl b/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl
index 52c416ce9d..d84ed3f781 100644
--- a/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl
+++ b/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl
@@ -1,17 +1,17 @@
cuffable-component-cannot-interact-message = You can't do that!
-cuffable-component-cannot-remove-cuffs-too-far-message = You are too far away to remove the cuffs.
+cuffable-component-cannot-remove-cuffs-too-far-message = You are too far away to remove the restraints.
-cuffable-component-start-uncuffing-self = You start to painfully wriggle out of your cuffs.
-cuffable-component-start-uncuffing-observer = {$user} starts uncuffing {$target}!
-cuffable-component-start-uncuffing-target-message = You start uncuffing {$targetName}.
-cuffable-component-start-uncuffing-by-other-message = {$otherName} starts uncuffing you!
+cuffable-component-start-uncuffing-self = You start to painfully wriggle out of your restraints.
+cuffable-component-start-uncuffing-observer = {$user} starts unrestraining {$target}!
+cuffable-component-start-uncuffing-target-message = You start unrestraining {$targetName}.
+cuffable-component-start-uncuffing-by-other-message = {$otherName} starts unrestraining you!
-cuffable-component-remove-cuffs-success-message = You successfully remove the cuffs.
-cuffable-component-remove-cuffs-by-other-success-message = {$otherName} uncuffs your hands.
-cuffable-component-remove-cuffs-to-other-partial-success-message = You successfully remove the cuffs. {$cuffedHandCount} of {$otherName}'s hands remain cuffed.
-cuffable-component-remove-cuffs-by-other-partial-success-message = {$otherName} removes your cuffs. {$cuffedHandCount} of your hands remain cuffed.
-cuffable-component-remove-cuffs-partial-success-message = You successfully remove the cuffs. {$cuffedHandCount} of your hands remain cuffed.
-cuffable-component-remove-cuffs-fail-message = You fail to remove the cuffs.
+cuffable-component-remove-cuffs-success-message = You successfully remove the restraints.
+cuffable-component-remove-cuffs-by-other-success-message = {$otherName} unrestrains your hands.
+cuffable-component-remove-cuffs-to-other-partial-success-message = You successfully remove the restraints. {$cuffedHandCount} of {$otherName}'s hands remain restrained.
+cuffable-component-remove-cuffs-by-other-partial-success-message = {$otherName} removes your restraints. {$cuffedHandCount} of your hands remain restrained.
+cuffable-component-remove-cuffs-partial-success-message = You successfully remove the restraints. {$cuffedHandCount} of your hands remain restrained.
+cuffable-component-remove-cuffs-fail-message = You fail to remove the restraints.
-# UncuffVerb
-uncuff-verb-get-data-text = Uncuff
\ No newline at end of file
+# UnrestrainVerb
+uncuff-verb-get-data-text = Unrestrain
diff --git a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl
index 4d74143d50..2d295b5d1b 100644
--- a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl
+++ b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl
@@ -1,17 +1,17 @@
-handcuff-component-target-self = You start cuffing yourself.
-handcuff-component-cuffs-broken-error = The cuffs are broken!
+handcuff-component-target-self = You start restraining yourself.
+handcuff-component-cuffs-broken-error = The restraints are broken!
handcuff-component-target-has-no-hands-error = {$targetName} has no hands!
handcuff-component-target-has-no-free-hands-error = {$targetName} has no free hands!
-handcuff-component-too-far-away-error = You are too far away to use the cuffs!
-handcuff-component-start-cuffing-observer = {$user} starts cuffing {$target}!
-handcuff-component-start-cuffing-target-message = You start cuffing {$targetName}.
-handcuff-component-start-cuffing-by-other-message = {$otherName} starts cuffing you!
-handcuff-component-cuff-observer-success-message = {$user} cuffs {$target}.
-handcuff-component-cuff-other-success-message = You successfully cuff {$otherName}.
-handcuff-component-cuff-by-other-success-message = You have been cuffed by {$otherName}!
-handcuff-component-cuff-self-success-message = You cuff yourself.
-handcuff-component-cuff-interrupt-message = You were interrupted while cuffing {$targetName}!
-handcuff-component-cuff-interrupt-other-message = You interrupt {$otherName} while they are cuffing you!
-handcuff-component-cuff-interrupt-self-message = You were interrupted while cuffing yourself.
-handcuff-component-cuff-interrupt-buckled-message = You can't buckle while cuffed!
-handcuff-component-cuff-interrupt-unbuckled-message = You can't unbuckle while cuffed!
+handcuff-component-too-far-away-error = You are too far away to use the restraints!
+handcuff-component-start-cuffing-observer = {$user} starts restraining {$target}!
+handcuff-component-start-cuffing-target-message = You start restraining {$targetName}.
+handcuff-component-start-cuffing-by-other-message = {$otherName} starts restraining you!
+handcuff-component-cuff-observer-success-message = {$user} restrains {$target}.
+handcuff-component-cuff-other-success-message = You successfully restrain {$otherName}.
+handcuff-component-cuff-by-other-success-message = You have been restrained by {$otherName}!
+handcuff-component-cuff-self-success-message = You restrain yourself.
+handcuff-component-cuff-interrupt-message = You were interrupted while unrestraining {$targetName}!
+handcuff-component-cuff-interrupt-other-message = You interrupt {$otherName} while they are restraining you!
+handcuff-component-cuff-interrupt-self-message = You were interrupted while unrestraining yourself.
+handcuff-component-cuff-interrupt-buckled-message = You can't buckle while restrained!
+handcuff-component-cuff-interrupt-unbuckled-message = You can't unbuckle while restrained!
diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml
index ab0020b1aa..3f45bd4e8e 100644
--- a/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml
+++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml
@@ -145,17 +145,6 @@
- type: Clothing
sprite: Clothing/OuterClothing/Misc/santa.rsi
-- type: entity
- parent: ClothingOuterBase
- id: ClothingOuterStraightjacket
- name: straight jacket
- description: A straight jacket.
- components:
- - type: Sprite
- sprite: Clothing/OuterClothing/Misc/straight_jacket.rsi
- - type: Clothing
- sprite: Clothing/OuterClothing/Misc/straight_jacket.rsi
-
# Is this wizard wearing a fanny pack???
- type: entity
parent: ClothingOuterBase
diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml
index 664103c543..4fe8bb1e42 100644
--- a/Resources/Prototypes/Entities/Mobs/Species/base.yml
+++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml
@@ -120,11 +120,6 @@
- map: ["enum.HumanoidVisualLayers.RFoot"]
- map: ["enum.HumanoidVisualLayers.LHand"]
- map: ["enum.HumanoidVisualLayers.RHand"]
- - map: ["enum.HumanoidVisualLayers.Handcuffs"]
- color: "#ffffff"
- sprite: Objects/Misc/handcuffs.rsi
- state: body-overlay-2
- visible: false
- map: [ "id" ]
- map: [ "gloves" ]
- map: [ "shoes" ]
@@ -143,6 +138,11 @@
- map: [ "head" ]
- map: [ "pocket1" ]
- map: [ "pocket2" ]
+ - map: ["enum.HumanoidVisualLayers.Handcuffs"]
+ color: "#ffffff"
+ sprite: Objects/Misc/handcuffs.rsi
+ state: body-overlay-2
+ visible: false
- map: [ "clownedon" ] # Dynamically generated
sprite: "Effects/creampie.rsi"
state: "creampie_human"
diff --git a/Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml b/Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml
index b21f47cb60..4d0aeba0d5 100644
--- a/Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml
+++ b/Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml
@@ -117,3 +117,24 @@
sprite: Objects/Misc/cablecuffs.rsi
state: cuff-broken
color: forestgreen
+
+- type: entity
+ parent: Handcuffs
+ id: ClothingOuterStraightjacket
+ name: straitjacket
+ description: Used to restrain those who may cause harm to themselves or others.
+ components:
+ - type: Item
+ size: 20
+ - type: Handcuff
+ cuffedRSI: Clothing/OuterClothing/Misc/straight_jacket.rsi
+ breakoutTime: 100
+ damageOnResist:
+ types:
+ Blunt: 0
+ cuffTime: 10
+ uncuffTime: 10
+ stunBonus: 4
+ - type: Sprite
+ sprite: Clothing/OuterClothing/Misc/straight_jacket.rsi
+ state: icon
diff --git a/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/equipped-OUTERCLOTHING.png b/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/body-overlay-2.png
similarity index 100%
rename from Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/equipped-OUTERCLOTHING.png
rename to Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/body-overlay-2.png
diff --git a/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/meta.json b/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/meta.json
index e482264df5..b41f0209d7 100644
--- a/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/meta.json
+++ b/Resources/Textures/Clothing/OuterClothing/Misc/straight_jacket.rsi/meta.json
@@ -11,7 +11,7 @@
"name": "icon"
},
{
- "name": "equipped-OUTERCLOTHING",
+ "name": "body-overlay-2",
"directions": 4
},
{