]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Rename DummyPuppet to VentriloquistPuppet (#19777)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sat, 16 Sep 2023 04:54:46 +0000 (16:54 +1200)
committerGitHub <noreply@github.com>
Sat, 16 Sep 2023 04:54:46 +0000 (14:54 +1000)
Content.Server/Puppet/PuppetDummySystem.cs [deleted file]
Content.Server/Puppet/VentriloquistPuppetSystem.cs [new file with mode: 0644]
Content.Server/Speech/Muting/MutingSystem.cs
Content.Shared/Puppet/PuppetDummyComponent.cs [deleted file]
Content.Shared/Puppet/SharedPuppetDummySystem.cs [deleted file]
Content.Shared/Puppet/SharedVentriloquistPuppetSystem.cs [new file with mode: 0644]
Content.Shared/Puppet/VentriloquistPuppetComponent.cs [new file with mode: 0644]
Resources/Locale/en-US/dummy/dummy.ftl [deleted file]
Resources/Locale/en-US/ventriloquist/ventriloquist.ftl [new file with mode: 0644]
Resources/Prototypes/Entities/Objects/Fun/puppet.yml

diff --git a/Content.Server/Puppet/PuppetDummySystem.cs b/Content.Server/Puppet/PuppetDummySystem.cs
deleted file mode 100644 (file)
index ce1e7d2..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-using Content.Server.Ghost.Roles.Components;
-using Content.Server.Popups;
-using Content.Shared.Interaction.Events;
-using Content.Shared.Puppet;
-using Content.Shared.Hands.Components;
-using Content.Server.Speech.Muting;
-using Content.Shared.CombatMode;
-using Content.Shared.Hands;
-
-namespace Content.Server.Puppet
-{
-    public sealed class PuppetDummySystem : SharedPuppetDummySystem
-    {
-        [Dependency] private readonly PopupSystem _popupSystem = default!;
-
-        public override void Initialize()
-        {
-            base.Initialize();
-
-            SubscribeLocalEvent<PuppetDummyComponent, DroppedEvent>(OnDropped);
-            SubscribeLocalEvent<PuppetDummyComponent, UseInHandEvent>(OnUseInHand);
-            SubscribeLocalEvent<PuppetDummyComponent, GotUnequippedHandEvent>(OnUnequippedHand);
-        }
-
-        /// <summary>
-        /// When used user inserts hand into dummy and the dummy can speak, when used again the user removes hand
-        /// from dummy and the dummy cannot speak.
-        /// </summary>
-        /// <param name="uid"></param>
-        /// <param name="component"></param>
-        /// <param name="args"></param>
-        private void OnUseInHand(EntityUid uid, PuppetDummyComponent component, UseInHandEvent args)
-        {
-            if (args.Handled)
-                return;
-
-            var userHands = Comp<HandsComponent>(args.User);
-
-            if (userHands.ActiveHandEntity == uid && HasComp<MutedComponent>(uid))
-            {
-                RemComp<MutedComponent>(uid);
-                _popupSystem.PopupEntity(Loc.GetString("dummy-insert-hand"), uid, args.User);
-                _popupSystem.PopupEntity(Loc.GetString("dummy-inserted-hand"), uid, uid);
-                AddComp<CombatModeComponent>(uid);
-
-                if (!HasComp<GhostTakeoverAvailableComponent>(uid))
-                {
-                    EnsureComp<GhostTakeoverAvailableComponent>(uid);
-                    var ghostRole = AddComp<GhostRoleComponent>(uid);
-                    ghostRole.RoleName = Loc.GetString("dummy-role-name");
-                    ghostRole.RoleDescription = Loc.GetString("dummy-role-description");
-                }
-
-            }
-
-            else if (userHands.ActiveHandEntity == uid && !HasComp<MutedComponent>(uid))
-            {
-                _popupSystem.PopupEntity(Loc.GetString("dummy-remove-hand"), uid, args.User);
-                MuteDummy(uid, component);
-            }
-
-            args.Handled = true;
-        }
-
-        /// <summary>
-        /// When dropped the dummy is muted again.
-        /// </summary>
-        private void OnDropped(EntityUid uid, PuppetDummyComponent component, DroppedEvent args)
-        {
-            if (HasComp<MutedComponent>(uid))
-                return;
-
-            _popupSystem.PopupEntity(Loc.GetString("dummy-remove-hand"), uid, args.User);
-            MuteDummy(uid, component);
-        }
-
-        /// <summary>
-        /// When unequipped from a hand slot the dummy is muted again.
-        /// </summary>
-        private void OnUnequippedHand(EntityUid uid, PuppetDummyComponent component, GotUnequippedHandEvent args)
-        {
-            if (HasComp<MutedComponent>(uid))
-                return;
-
-            _popupSystem.PopupEntity(Loc.GetString("dummy-remove-hand"), uid, args.User);
-            MuteDummy(uid, component);
-        }
-
-        /// <summary>
-        /// Mutes the dummy.
-        /// </summary>
-        private void MuteDummy(EntityUid uid, PuppetDummyComponent component)
-        {
-            _popupSystem.PopupEntity(Loc.GetString("dummy-removed-hand"), uid, uid);
-            AddComp<MutedComponent>(uid);
-            RemComp<CombatModeComponent>(uid);
-        }
-    }
-}
-
diff --git a/Content.Server/Puppet/VentriloquistPuppetSystem.cs b/Content.Server/Puppet/VentriloquistPuppetSystem.cs
new file mode 100644 (file)
index 0000000..68d660f
--- /dev/null
@@ -0,0 +1,96 @@
+using Content.Server.Ghost.Roles.Components;
+using Content.Server.Popups;
+using Content.Shared.Interaction.Events;
+using Content.Shared.Puppet;
+using Content.Server.Speech.Muting;
+using Content.Shared.CombatMode;
+using Content.Shared.Hands;
+
+namespace Content.Server.Puppet
+{
+    public sealed class VentriloquistPuppetSystem : SharedVentriloquistPuppetSystem
+    {
+        [Dependency] private readonly PopupSystem _popupSystem = default!;
+
+        public override void Initialize()
+        {
+            base.Initialize();
+
+            SubscribeLocalEvent<VentriloquistPuppetComponent, DroppedEvent>(OnDropped);
+            SubscribeLocalEvent<VentriloquistPuppetComponent, UseInHandEvent>(OnUseInHand);
+            SubscribeLocalEvent<VentriloquistPuppetComponent, GotUnequippedHandEvent>(OnUnequippedHand);
+        }
+
+        /// <summary>
+        /// When used user inserts hand into dummy and the dummy can speak, when used again the user removes hand
+        /// from dummy and the dummy cannot speak.
+        /// </summary>
+        private void OnUseInHand(EntityUid uid, VentriloquistPuppetComponent component, UseInHandEvent args)
+        {
+            if (args.Handled)
+                return;
+
+            // TODO stop using mute component as a toggle for this component's functionality.
+            // TODO disable dummy when the user dies or cannot interact.
+            // Then again, this is all quite cursed code, so maybe its a cursed ventriloquist puppet.
+
+            if (!RemComp<MutedComponent>(uid))
+            {
+                _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-remove-hand"), uid, args.User);
+                MuteDummy(uid, component);
+                return;
+            }
+
+            // TODO why does this need a combat component???
+            EnsureComp<CombatModeComponent>(uid);
+            _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-insert-hand"), uid, args.User);
+            _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-inserted-hand"), uid, uid);
+
+            if (!HasComp<GhostTakeoverAvailableComponent>(uid))
+            {
+                AddComp<GhostTakeoverAvailableComponent>(uid);
+                var ghostRole = EnsureComp<GhostRoleComponent>(uid);
+                ghostRole.RoleName = Loc.GetString("ventriloquist-puppet-role-name");
+                ghostRole.RoleDescription = Loc.GetString("ventriloquist-puppet-role-description");
+            }
+
+            args.Handled = true;
+        }
+
+        /// <summary>
+        /// When dropped the dummy is muted again.
+        /// </summary>
+        private void OnDropped(EntityUid uid, VentriloquistPuppetComponent component, DroppedEvent args)
+        {
+            if (HasComp<MutedComponent>(uid))
+                return;
+
+            _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-remove-hand"), uid, args.User);
+            MuteDummy(uid, component);
+        }
+
+        /// <summary>
+        /// When unequipped from a hand slot the dummy is muted again.
+        /// </summary>
+        private void OnUnequippedHand(EntityUid uid, VentriloquistPuppetComponent component, GotUnequippedHandEvent args)
+        {
+            if (HasComp<MutedComponent>(uid))
+                return;
+
+            _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-remove-hand"), uid, args.User);
+            MuteDummy(uid, component);
+        }
+
+        /// <summary>
+        /// Mutes the dummy.
+        /// </summary>
+        private void MuteDummy(EntityUid uid, VentriloquistPuppetComponent component)
+        {
+            _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-removed-hand"), uid, uid);
+            EnsureComp<MutedComponent>(uid);
+            RemComp<CombatModeComponent>(uid);
+            RemComp<GhostTakeoverAvailableComponent>(uid);
+        }
+    }
+}
+
index 5023957c4b4cc62097884a7757d320805b870277..b743d9eda85e1334b8408177b5140be69d257d48 100644 (file)
@@ -46,12 +46,12 @@ namespace Content.Server.Speech.Muting
 
         private void OnSpeakAttempt(EntityUid uid, MutedComponent component, SpeakAttemptEvent args)
         {
+            // TODO something better than this.
+
             if (HasComp<MimePowersComponent>(uid))
                 _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid);
-
-            if (HasComp<PuppetDummyComponent>(uid))
-                _popupSystem.PopupEntity(Loc.GetString("dummy-cant-speak"), uid, uid);
-
+            else if (HasComp<VentriloquistPuppetComponent>(uid))
+                _popupSystem.PopupEntity(Loc.GetString("ventriloquist-puppet-cant-speak"), uid, uid);
             else
                 _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
 
diff --git a/Content.Shared/Puppet/PuppetDummyComponent.cs b/Content.Shared/Puppet/PuppetDummyComponent.cs
deleted file mode 100644 (file)
index 87dbf69..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-using Robust.Shared.GameStates;
-
-namespace Content.Shared.Puppet
-{
-    [RegisterComponent, NetworkedComponent]
-    public sealed partial class PuppetDummyComponent : Component
-    {
-        [DataField("enabled")]
-        public bool Enabled = false;
-    }
-}
diff --git a/Content.Shared/Puppet/SharedPuppetDummySystem.cs b/Content.Shared/Puppet/SharedPuppetDummySystem.cs
deleted file mode 100644 (file)
index ededcbc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-using Content.Shared.ActionBlocker;
-using Content.Shared.Hands;
-using Content.Shared.Interaction.Events;
-using Content.Shared.Item;
-using Content.Shared.Emoting;
-using Content.Shared.Movement.Events;
-
-namespace Content.Shared.Puppet
-{
-    public abstract class SharedPuppetDummySystem : EntitySystem
-    {
-        [Dependency] private readonly ActionBlockerSystem _blocker = default!;
-
-        public override void Initialize()
-        {
-            base.Initialize();
-            SubscribeLocalEvent<PuppetDummyComponent, UseAttemptEvent>(OnUseAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, InteractionAttemptEvent>(OnInteractAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, DropAttemptEvent>(OnDropAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, PickupAttemptEvent>(OnPickupAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, UpdateCanMoveEvent>(OnMoveAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, EmoteAttemptEvent>(OnEmoteAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, ChangeDirectionAttemptEvent>(OnChangeDirectionAttempt);
-            SubscribeLocalEvent<PuppetDummyComponent, ComponentStartup>(OnStartup);
-        }
-
-        private void OnStartup(EntityUid uid, PuppetDummyComponent component, ComponentStartup args)
-        {
-            _blocker.UpdateCanMove(uid);
-        }
-
-        private void OnMoveAttempt(EntityUid uid, PuppetDummyComponent component, UpdateCanMoveEvent args)
-        {
-            if (component.LifeStage > ComponentLifeStage.Running)
-                return;
-
-            args.Cancel();
-        }
-
-        private void OnChangeDirectionAttempt(EntityUid uid, PuppetDummyComponent component, ChangeDirectionAttemptEvent args)
-        {
-            args.Cancel();
-        }
-
-        private void OnUseAttempt(EntityUid uid, PuppetDummyComponent component, UseAttemptEvent args)
-        {
-            args.Cancel();
-        }
-
-        private void OnEmoteAttempt(EntityUid uid, PuppetDummyComponent component, EmoteAttemptEvent args)
-        {
-            args.Cancel();
-        }
-
-        private void OnInteractAttempt(EntityUid uid, PuppetDummyComponent component, InteractionAttemptEvent args)
-        {
-            args.Cancel();
-        }
-
-        private void OnDropAttempt(EntityUid uid, PuppetDummyComponent component, DropAttemptEvent args)
-        {
-            args.Cancel();
-        }
-
-        private void OnPickupAttempt(EntityUid uid, PuppetDummyComponent component, PickupAttemptEvent args)
-        {
-            args.Cancel();
-        }
-    }
-}
-
diff --git a/Content.Shared/Puppet/SharedVentriloquistPuppetSystem.cs b/Content.Shared/Puppet/SharedVentriloquistPuppetSystem.cs
new file mode 100644 (file)
index 0000000..430c2b1
--- /dev/null
@@ -0,0 +1,36 @@
+using Content.Shared.ActionBlocker;
+using Content.Shared.Hands;
+using Content.Shared.Interaction.Events;
+using Content.Shared.Item;
+using Content.Shared.Emoting;
+using Content.Shared.Movement.Events;
+
+namespace Content.Shared.Puppet;
+
+public abstract class SharedVentriloquistPuppetSystem : EntitySystem
+{
+    [Dependency] private readonly ActionBlockerSystem _blocker = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+        SubscribeLocalEvent<VentriloquistPuppetComponent, UseAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, InteractionAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, DropAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, PickupAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, UpdateCanMoveEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, EmoteAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, ChangeDirectionAttemptEvent>(Cancel);
+        SubscribeLocalEvent<VentriloquistPuppetComponent, ComponentStartup>(OnStartup);
+    }
+
+    private void OnStartup(EntityUid uid, VentriloquistPuppetComponent component, ComponentStartup args)
+    {
+        _blocker.UpdateCanMove(uid);
+    }
+
+    private void Cancel<T>(EntityUid uid, VentriloquistPuppetComponent component, T args) where T : CancellableEntityEventArgs
+    {
+        args.Cancel();
+    }
+}
\ No newline at end of file
diff --git a/Content.Shared/Puppet/VentriloquistPuppetComponent.cs b/Content.Shared/Puppet/VentriloquistPuppetComponent.cs
new file mode 100644 (file)
index 0000000..8f9239d
--- /dev/null
@@ -0,0 +1,8 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Puppet;
+
+[RegisterComponent, NetworkedComponent]
+public sealed partial class VentriloquistPuppetComponent : Component
+{
+}
\ No newline at end of file
diff --git a/Resources/Locale/en-US/dummy/dummy.ftl b/Resources/Locale/en-US/dummy/dummy.ftl
deleted file mode 100644 (file)
index 9c77d36..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-dummy-cant-speak = You cannot speak without a helping hand.
-dummy-insert-hand = You insert your hand.
-dummy-remove-hand = You remove your hand.
-dummy-inserted-hand = You have a helping hand.
-dummy-removed-hand = you have lost your helping hand.
-dummy-role-name = A dummy
-dummy-role-description = Become a dummy, dummy!
diff --git a/Resources/Locale/en-US/ventriloquist/ventriloquist.ftl b/Resources/Locale/en-US/ventriloquist/ventriloquist.ftl
new file mode 100644 (file)
index 0000000..5b46e25
--- /dev/null
@@ -0,0 +1,8 @@
+ventriloquist-puppet-insert-hand = You insert your hand into the puppet.
+ventriloquist-puppet-remove-hand = You remove your hand from the puppet.
+
+ventriloquist-puppet-cant-speak = You cannot speak without a helping hand.
+ventriloquist-puppet-inserted-hand = You have a helping hand.
+ventriloquist-puppet-removed-hand = you have lost your helping hand.
+ventriloquist-puppet-role-name = A dummy
+ventriloquist-puppet-role-description = Become a dummy, dummy!
index 845a4b97c6123d21d9a1eb993dcb3ad0f2f3015a..2757689a300b10b0623f0b4a01fa069f630249b6 100644 (file)
@@ -12,7 +12,7 @@
   - type: Input
     context: "human"
   - type: DoAfter
-  - type: PuppetDummy
+  - type: VentriloquistPuppet
   - type: Item
     size: 30
   - type: Muted