Revert "plutonium core steal objective" (#29578)

Revert "plutonium core steal objective (#26786)"

This reverts commit f6ce07289a.
This commit is contained in:
Pieter-Jan Briers
2024-06-29 17:23:03 +02:00
committed by GitHub
parent 325d64b5ed
commit 2a7bdd9b08
33 changed files with 20 additions and 497 deletions

View File

@@ -1,14 +0,0 @@
using Content.Shared.Store;
using Robust.Shared.Prototypes;
namespace Content.Server.Objectives.Components;
/// <summary>
/// Unlocks store listings that use <see cref="ObjectiveUnlockCondition"/>.
/// </summary>
[RegisterComponent]
public sealed partial class StoreUnlockerComponent : Component
{
[DataField(required: true)]
public List<ProtoId<ListingPrototype>> Listings = new();
}

View File

@@ -1,34 +0,0 @@
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;
}
}

View File

@@ -1,21 +0,0 @@
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)
{
var minds = args.EntityManager.System<SharedMindSystem>();
if (!minds.TryGetMind(args.Buyer, out _, out var mind))
return false;
var unlocker = args.EntityManager.System<StoreUnlockerSystem>();
return unlocker.IsUnlocked(mind, args.Listing.ID);
}
}