Files
OldThink/Content.Server/Store/Conditions/BuyerBlockForMindProtected.cs

21 lines
644 B
C#
Raw Permalink Normal View History

2024-01-11 09:44:36 +03:00
using Content.Server.Mind;
using Content.Server.Roles.Jobs;
2023-04-28 06:07:50 +06:00
using Content.Shared.Store;
namespace Content.Server.Store.Conditions;
2024-01-11 09:44:36 +03:00
public sealed partial class BuyerBlockForMindProtected : ListingCondition
2023-04-28 06:07:50 +06:00
{
public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
2024-01-11 09:44:36 +03:00
var roleSystem = ent.System<JobSystem>();
var mindSystem = ent.System<MindSystem>();
if (!mindSystem.TryGetMind(args.Buyer, out var mindId, out var mind))
2023-04-28 06:07:50 +06:00
return false;
2024-01-11 09:44:36 +03:00
if (mind.Session == null)
2023-04-28 06:07:50 +06:00
return false;
2024-01-11 09:44:36 +03:00
return !roleSystem.CanBeAntag(mind.Session);
2023-04-28 06:07:50 +06:00
}
}