* 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.
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|