Skip to content

Commit

Permalink
Appraisal tools check for cargo bounty completion (space-wizards#23760)
Browse files Browse the repository at this point in the history
Co-authored-by: ike709 <[email protected]>
  • Loading branch information
ike709 and ike709 authored Jan 9, 2024
1 parent a34ee7c commit b8e8e61
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Content.Server/Cargo/Systems/PriceGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed class PriceGunSystem : EntitySystem
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly PricingSystem _pricingSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly CargoSystem _bountySystem = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -55,9 +56,17 @@ private void OnAfterInteract(EntityUid uid, PriceGunComponent component, AfterIn
if (!TryComp(uid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((uid, useDelay)))
return;

var price = _pricingSystem.GetPrice(args.Target.Value);
// Check if we're scanning a bounty crate
if (_bountySystem.IsBountyComplete(args.Target.Value, (EntityUid?) null, out _))
{
_popupSystem.PopupEntity(Loc.GetString("price-gun-bounty-complete"), args.User, args.User);
}
else // Otherwise appraise the price
{
double price = _pricingSystem.GetPrice(args.Target.Value);
_popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", Identity.Entity(args.Target.Value, EntityManager)), ("price", $"{price:F2}")), args.User, args.User);
}

_popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", Identity.Entity(args.Target.Value, EntityManager)), ("price", $"{price:F2}")), args.User, args.User);
_useDelay.TryResetDelay((uid, useDelay));
args.Handled = true;
}
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/cargo/price-gun-component.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
price-gun-pricing-result = The device deems {THE($object)} to be worth {$price} spesos.
price-gun-verb-text = Appraisal
price-gun-verb-message = Appraise {THE($object)}.
price-gun-bounty-complete = The device confirms that the bounty contained within is completed.
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/Tools/appraisal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
parent: BaseItem
id: AppraisalTool
name: appraisal tool
description: A beancounter's best friend, with a quantum connection to the galactic market and the ability to appraise even the toughest items.
description: A beancounter's best friend, with a quantum connection to the galactic market and the ability to appraise even the toughest items. It will also tell you if a crate contains a completed bounty.
components:
- type: Sprite
sprite: Objects/Tools/appraisal-tool.rsi
Expand Down

0 comments on commit b8e8e61

Please sign in to comment.