]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Added pricegun sound (#34119)
authorDylan Hunter Whittingham <45404433+DylanWhittingham@users.noreply.github.com>
Thu, 2 Jan 2025 16:46:13 +0000 (16:46 +0000)
committerGitHub <noreply@github.com>
Thu, 2 Jan 2025 16:46:13 +0000 (17:46 +0100)
added pricegun sound

Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>
Content.Client/Cargo/Systems/ClientPriceGunSystem.cs
Content.Server/Cargo/Systems/PriceGunSystem.cs
Content.Shared/Cargo/Components/PriceGunComponent.cs
Content.Shared/Cargo/SharedPriceGunSystem.cs
Resources/Audio/Items/appraiser.ogg [new file with mode: 0644]
Resources/Audio/Items/attributions.yml

index f1739324783649af5730c9adbb92b3c8c900ec9b..35fb2112c0740aaee1bdb6a410b80659f0766d28 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Cargo.Components;
 using Content.Shared.Timing;
 using Content.Shared.Cargo.Systems;
 
@@ -10,9 +11,9 @@ public sealed class ClientPriceGunSystem : SharedPriceGunSystem
 {
     [Dependency] private readonly UseDelaySystem _useDelay = default!;
 
-    protected override bool GetPriceOrBounty(EntityUid priceGunUid, EntityUid target, EntityUid user)
+    protected override bool GetPriceOrBounty(Entity<PriceGunComponent> entity, EntityUid target, EntityUid user)
     {
-        if (!TryComp(priceGunUid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((priceGunUid, useDelay)))
+        if (!TryComp(entity, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((entity, useDelay)))
             return false;
 
         // It feels worse if the cooldown is predicted but the popup isn't! So only do the cooldown reset on the server.
index 94f9f9cba9edcc505f93d5dd09c56a69372284db..5e7ab2306068750fb30bf27f67441ddbdba38111 100644 (file)
@@ -1,7 +1,9 @@
 using Content.Server.Popups;
+using Content.Shared.Cargo.Components;
 using Content.Shared.IdentityManagement;
 using Content.Shared.Timing;
 using Content.Shared.Cargo.Systems;
+using Robust.Shared.Audio.Systems;
 
 namespace Content.Server.Cargo.Systems;
 
@@ -11,12 +13,12 @@ public sealed class PriceGunSystem : SharedPriceGunSystem
     [Dependency] private readonly PricingSystem _pricingSystem = default!;
     [Dependency] private readonly PopupSystem _popupSystem = default!;
     [Dependency] private readonly CargoSystem _bountySystem = default!;
+    [Dependency] private readonly SharedAudioSystem _audio = default!;
 
-    protected override bool GetPriceOrBounty(EntityUid priceGunUid, EntityUid target, EntityUid user)
+    protected override bool GetPriceOrBounty(Entity<PriceGunComponent> entity, EntityUid target, EntityUid user)
     {
-        if (!TryComp(priceGunUid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((priceGunUid, useDelay)))
+        if (!TryComp(entity.Owner, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((entity.Owner, useDelay)))
             return false;
-
         // Check if we're scanning a bounty crate
         if (_bountySystem.IsBountyComplete(target, out _))
         {
@@ -25,10 +27,15 @@ public sealed class PriceGunSystem : SharedPriceGunSystem
         else // Otherwise appraise the price
         {
             var price = _pricingSystem.GetPrice(target);
-            _popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", Identity.Entity(target, EntityManager)), ("price", $"{price:F2}")), user, user);
+            _popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result",
+                    ("object", Identity.Entity(target, EntityManager)),
+                    ("price", $"{price:F2}")),
+                user,
+                user);
         }
 
-        _useDelay.TryResetDelay((priceGunUid, useDelay));
+        _audio.PlayPvs(entity.Comp.AppraisalSound, entity.Owner);
+        _useDelay.TryResetDelay((entity.Owner, useDelay));
         return true;
     }
 }
index 7024f1195afde5c22af51881c69783a0e0d53326..6577c52c1e7115b3be52ab9e6b6094b34d0d1fda 100644 (file)
@@ -1,3 +1,4 @@
+using Robust.Shared.Audio;
 using Robust.Shared.GameStates;
 
 namespace Content.Shared.Cargo.Components;
@@ -8,4 +9,9 @@ namespace Content.Shared.Cargo.Components;
 [RegisterComponent, NetworkedComponent]
 public sealed partial class PriceGunComponent : Component
 {
+    /// <summary>
+    /// The sound that plays when the price gun appraises an object.
+    /// </summary>
+    [DataField]
+    public SoundSpecifier AppraisalSound  = new SoundPathSpecifier("/Audio/Items/appraiser.ogg");
 }
index 779d55055aa2bf445998ba6cf610132a0168c8e5..b5e312772b755258e74add0ebd678ebb86b30e28 100644 (file)
@@ -26,7 +26,7 @@ public abstract class SharedPriceGunSystem : EntitySystem
         {
             Act = () =>
             {
-                GetPriceOrBounty(uid, args.Target, args.User);
+                GetPriceOrBounty((uid, component), args.Target, args.User);
             },
             Text = Loc.GetString("price-gun-verb-text"),
             Message = Loc.GetString("price-gun-verb-message", ("object", Identity.Entity(args.Target, EntityManager)))
@@ -51,5 +51,5 @@ public abstract class SharedPriceGunSystem : EntitySystem
     ///     This is abstract for prediction. When the bounty system / cargo systems that are necessary are moved to shared,
     ///     combine all the server, client, and shared stuff into one non abstract file.
     /// </remarks>
-    protected abstract bool GetPriceOrBounty(EntityUid priceGunUid, EntityUid target, EntityUid user);
+    protected abstract bool GetPriceOrBounty(Entity<PriceGunComponent> entity, EntityUid target, EntityUid user);
 }
diff --git a/Resources/Audio/Items/appraiser.ogg b/Resources/Audio/Items/appraiser.ogg
new file mode 100644 (file)
index 0000000..18c0a83
Binary files /dev/null and b/Resources/Audio/Items/appraiser.ogg differ
index 6a2d579b700c324ef431355d54cfa90acdfd3bb6..41866b5d3010def4716adef23be69597c70597f4 100644 (file)
 - files: ["pen_click.ogg"]
   license: "CC0-1.0"
   copyright: "Created by dslrguide, converted to ogg and mono by Themias"
-  source: "https://freesound.org/people/dslrguide/sounds/321484"
\ No newline at end of file
+  source: "https://freesound.org/people/dslrguide/sounds/321484"
+
+- files: [ "appraiser.ogg" ]
+  license: "CC0-1.0"
+  copyright: "Original sound by vestibule-door on freesound.org, processed by DylanWhittingham"
+  source: "https://freesound.org/people/vestibule-door/sounds/668985/"