mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 00:27:59 +00:00
* move store-objective stuff to _DV * radiation fix * move SealingCabinet to _DV * move textures to _DV * move yml stuff to _DV --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
35 lines
883 B
C#
35 lines
883 B
C#
using Content.Server._DV.Objectives.Components;
|
|
using Content.Shared.Mind;
|
|
|
|
namespace Content.Server._DV.Objectives.Systems;
|
|
|
|
/// <summary>
|
|
/// Provides api for listings with <c>ObjectiveUnlockRequirement</c> to use.
|
|
/// </summary>
|
|
public sealed class StoreUnlockerSystem : EntitySystem
|
|
{
|
|
private EntityQuery<StoreUnlockerComponent> _query;
|
|
|
|
public override void Initialize()
|
|
{
|
|
_query = GetEntityQuery<StoreUnlockerComponent>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if a listing id is unlocked by any objectives on a mind.
|
|
/// </summary>
|
|
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;
|
|
}
|
|
}
|