plutonium core steal objective (#26786)
* add textures * add SealingCabinet system * add StoreUnlocker/ObjectiveUnlock system * add plutonium core and nuke core container * make nuke deconstructable * add steal core objective * add core extraction toolbox to new category * typo ops wrench fuel * use queries and resolve, have it resolve instead of using Comp --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
34
Content.Server/Objectives/Systems/StoreUnlockerSystem.cs
Normal file
34
Content.Server/Objectives/Systems/StoreUnlockerSystem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Shared.Mind;
|
||||
|
||||
namespace Content.Server.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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user