Implements item pricing, and piracy. (#8548)
* Start implementing item pricing. * Flesh out prices a bit, add the appraisal tool. * Add prices to more things. * YARRRRRRR * gives pirates an appraisal tool in their pocket. * Makes the various traitor objectives valuable. Also nerfs the price of a living person, so it's easier to bargain for them. * Address reviews. * Address reviews.
This commit is contained in:
37
Content.Server/Cargo/Systems/PriceGunSystem.cs
Normal file
37
Content.Server/Cargo/Systems/PriceGunSystem.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Content.Server.Cargo.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Timing;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Cargo.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// This handles...
|
||||
/// </summary>
|
||||
public sealed class PriceGunSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||
[Dependency] private readonly PricingSystem _pricingSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<PriceGunComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, PriceGunComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (!args.CanReach || args.Target == null)
|
||||
return;
|
||||
|
||||
if (TryComp(args.Used, out UseDelayComponent? useDelay) && useDelay.ActiveDelay)
|
||||
return;
|
||||
|
||||
var price = _pricingSystem.GetPrice(args.Target.Value);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", args.Target.Value), ("price", $"{price:F2}")), args.User, Filter.Entities(args.User));
|
||||
_useDelay.BeginDelay(uid, useDelay);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user