]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix potted plant popup/sfx spam (#26901)
authorTayrtahn <tayrtahn@gmail.com>
Fri, 12 Apr 2024 06:30:34 +0000 (02:30 -0400)
committerGitHub <noreply@github.com>
Fri, 12 Apr 2024 06:30:34 +0000 (16:30 +1000)
Fixed potted plant hide popup/sfx spam.

Content.Shared/Plants/PottedPlantHideSystem.cs

index fd256fd926342aab8c10b86c97811b087eac349d..cbe052f8d5c695ca79afacb5f62236c1839c17cb 100644 (file)
@@ -31,7 +31,7 @@ namespace Content.Shared.Plants
             if (args.Handled)
                 return;
 
-            Rustle(uid, component);
+            Rustle(uid, component, args.User);
             args.Handled = _stashSystem.TryHideItem(uid, args.User, args.Used);
         }
 
@@ -40,24 +40,24 @@ namespace Content.Shared.Plants
             if (args.Handled)
                 return;
 
-            Rustle(uid, component);
+            Rustle(uid, component, args.User);
 
             var gotItem = _stashSystem.TryGetItem(uid, args.User);
             if (!gotItem)
             {
                 var msg = Loc.GetString("potted-plant-hide-component-interact-hand-got-no-item-message");
-                _popupSystem.PopupEntity(msg, uid, args.User);
+                _popupSystem.PopupClient(msg, uid, args.User);
             }
 
             args.Handled = gotItem;
         }
 
-        private void Rustle(EntityUid uid, PottedPlantHideComponent? component = null)
+        private void Rustle(EntityUid uid, PottedPlantHideComponent? component = null, EntityUid? user = null)
         {
             if (!Resolve(uid, ref component))
                 return;
 
-            _audio.PlayPvs(component.RustleSound, uid, AudioParams.Default.WithVariation(0.25f));
+            _audio.PlayPredicted(component.RustleSound, uid, user, AudioParams.Default.WithVariation(0.25f));
         }
     }
 }