Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pricegun sound #34101

5 changes: 3 additions & 2 deletions Content.Client/Cargo/Systems/ClientPriceGunSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.Cargo.Components;
using Content.Shared.Timing;
using Content.Shared.Cargo.Systems;

Expand All @@ -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.
Expand Down
17 changes: 12 additions & 5 deletions Content.Server/Cargo/Systems/PriceGunSystem.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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 _))
{
Expand All @@ -25,10 +27,15 @@ protected override bool GetPriceOrBounty(EntityUid priceGunUid, EntityUid target
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, target);
slarticodefast marked this conversation as resolved.
Show resolved Hide resolved
_useDelay.TryResetDelay((entity.Owner, useDelay));
return true;
}
}
7 changes: 7 additions & 0 deletions Content.Shared/Cargo/Components/PriceGunComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;

namespace Content.Shared.Cargo.Components;
Expand All @@ -8,4 +9,10 @@ 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");
}

4 changes: 2 additions & 2 deletions Content.Shared/Cargo/SharedPriceGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void OnUtilityVerb(EntityUid uid, PriceGunComponent component, GetVerbsE
{
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)))
Expand All @@ -51,5 +51,5 @@ private void OnAfterInteract(Entity<PriceGunComponent> entity, ref AfterInteract
/// 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);
}
Binary file added Resources/Audio/Items/appraiser.ogg
Binary file not shown.
7 changes: 6 additions & 1 deletion Resources/Audio/Items/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,9 @@
- 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"
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/"
Loading