Files
Delta-v/Content.Server/_DV/Store/Conditions/ObjectiveUnlockCondition.cs
T
deltanedasanddeltanedas 1e7573d6ec fix objectives tab not working (#2991)
Co-authored-by: deltanedas <@deltanedas:kde.org>
2025-02-16 18:41:44 +00:00

22 lines
658 B
C#

using Content.Shared.Mind;
using Content.Shared.Store;
using Content.Server._DV.Objectives.Systems;
namespace Content.Server._DV.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)
{
var ent = args.EntityManager;
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var mind))
return false;
var unlocker = ent.System<StoreUnlockerSystem>();
return unlocker.IsUnlocked(mind, args.Listing.ID);
}
}