using Content.Server.Objectives.Components;
using Content.Shared.Mind;
namespace Content.Server.Objectives.Systems;
///
/// Provides api for listings with ObjectiveUnlockRequirement to use.
///
public sealed class StoreUnlockerSystem : EntitySystem
{
private EntityQuery _query;
public override void Initialize()
{
_query = GetEntityQuery();
}
///
/// Returns true if a listing id is unlocked by any objectives on a mind.
///
public bool IsUnlocked(MindComponent mind, string id)
{
foreach (var obj in mind.Objectives)
{
if (!_query.TryComp(obj, out var comp))
continue;
if (comp.Listings.Contains(id))
return true;
}
return false;
}
}