From: beck <163376292+widgetbeck@users.noreply.github.com>
Date: Fri, 6 Dec 2024 15:31:31 +0000 (-0500)
Subject: Added several variables to make ClumsyComponent more modular for developers. (#33715)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=6add781c4ac1313190200cea3a4771bb368df41e;p=space-station-14.git
Added several variables to make ClumsyComponent more modular for developers. (#33715)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---
diff --git a/Content.Shared/Clumsy/ClumsyComponent.cs b/Content.Shared/Clumsy/ClumsyComponent.cs
index c71f5d0008..6b013a5c2f 100644
--- a/Content.Shared/Clumsy/ClumsyComponent.cs
+++ b/Content.Shared/Clumsy/ClumsyComponent.cs
@@ -58,4 +58,46 @@ public sealed partial class ClumsyComponent : Component
///
[DataField]
public SoundSpecifier GunShootFailSound = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/bang.ogg");
+
+ ///
+ /// Whether or not to apply Clumsy to hyposprays.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool ClumsyHypo = true;
+
+ ///
+ /// Whether or not to apply Clumsy to defibs.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool ClumsyDefib = true;
+
+ ///
+ /// Whether or not to apply Clumsy to guns.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool ClumsyGuns = true;
+
+ ///
+ /// Whether or not to apply Clumsy to vaulting.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool ClumsyVaulting = true;
+
+ ///
+ /// Lets you define a new "failed" message for each event.
+ ///
+ [DataField]
+ public LocId HypoFailedMessage = "hypospray-component-inject-self-clumsy-message";
+
+ [DataField]
+ public LocId GunFailedMessage = "gun-clumsy";
+
+ [DataField]
+ public LocId VaulingFailedMessageSelf = "bonkable-success-message-user";
+
+ [DataField]
+ public LocId VaulingFailedMessageOthers = "bonkable-success-message-others";
+
+ [DataField]
+ public LocId VaulingFailedMessageForced = "forced-bonkable-success-message";
}
diff --git a/Content.Shared/Clumsy/ClumsySystem.cs b/Content.Shared/Clumsy/ClumsySystem.cs
index e034458197..4804b6b723 100644
--- a/Content.Shared/Clumsy/ClumsySystem.cs
+++ b/Content.Shared/Clumsy/ClumsySystem.cs
@@ -38,6 +38,11 @@ public sealed class ClumsySystem : EntitySystem
private void BeforeHyposprayEvent(Entity ent, ref SelfBeforeHyposprayInjectsEvent args)
{
// Clumsy people sometimes inject themselves! Apparently syringes are clumsy proof...
+
+ // checks if ClumsyHypo is false, if so, skips.
+ if (!ent.Comp.ClumsyHypo)
+ return;
+
if (!_random.Prob(ent.Comp.ClumsyDefaultCheck))
return;
@@ -49,6 +54,11 @@ public sealed class ClumsySystem : EntitySystem
private void BeforeDefibrillatorZapsEvent(Entity ent, ref SelfBeforeDefibrillatorZapsEvent args)
{
// Clumsy people sometimes defib themselves!
+
+ // checks if ClumsyDefib is false, if so, skips.
+ if (!ent.Comp.ClumsyDefib)
+ return;
+
if (!_random.Prob(ent.Comp.ClumsyDefaultCheck))
return;
@@ -61,6 +71,10 @@ public sealed class ClumsySystem : EntitySystem
{
// Clumsy people sometimes can't shoot :(
+ // checks if ClumsyGuns is false, if so, skips.
+ if (!ent.Comp.ClumsyGuns)
+ return;
+
if (args.Gun.Comp.ClumsyProof)
return;
@@ -82,6 +96,10 @@ public sealed class ClumsySystem : EntitySystem
private void OnBeforeClimbEvent(Entity ent, ref SelfBeforeClimbEvent args)
{
+ // checks if ClumsyVaulting is false, if so, skips.
+ if (!ent.Comp.ClumsyVaulting)
+ return;
+
// This event is called in shared, thats why it has all the extra prediction stuff.
var rand = new System.Random((int)_timing.CurTick.Value);
@@ -102,8 +120,8 @@ public sealed class ClumsySystem : EntitySystem
{
// You are slamming yourself onto the table.
_popup.PopupPredicted(
- Loc.GetString("bonkable-success-message-user", ("bonkable", args.BeingClimbedOn)),
- Loc.GetString("bonkable-success-message-others", ("victim", gettingPutOnTableName), ("bonkable", args.BeingClimbedOn)),
+ Loc.GetString(ent.Comp.VaulingFailedMessageSelf, ("bonkable", args.BeingClimbedOn)),
+ Loc.GetString(ent.Comp.VaulingFailedMessageOthers, ("victim", gettingPutOnTableName), ("bonkable", args.BeingClimbedOn)),
ent,
ent);
}
@@ -112,7 +130,7 @@ public sealed class ClumsySystem : EntitySystem
// Someone else slamed you onto the table.
// This is only run in server so you need to use popup entity.
_popup.PopupPredicted(
- Loc.GetString("forced-bonkable-success-message",
+ Loc.GetString(ent.Comp.VaulingFailedMessageForced,
("bonker", puttingOnTableName),
("victim", gettingPutOnTableName),
("bonkable", args.BeingClimbedOn)),