fish-station/Content.Server/_Sunrise/Store/Conditions/ObjectiveUnlockCondition.cs
2025-12-25 21:23:56 +03:00

20 lines
638 B
C#

using Content.Shared.Mind;
using Content.Shared.Store;
using Content.Server.Objectives.Systems;
namespace Content.Server.Store.Conditions;
/// <summary>
/// Requires that the buyer have an objective that unlocks this listing.
/// </summary>
public sealed partial class ObjectiveUnlockCondition : ListingCondition
{
public override bool Condition(ListingConditionArgs args)
{
if (!args.EntityManager.TryGetComponent(args.Buyer, out MindComponent? mind))
return false;
var unlocker = args.EntityManager.System<StoreUnlockerSystem>();
return unlocker.IsUnlocked(mind, args.Listing.ID);
}
}