mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
6b215d64e6
* doorjack to counter condition * howd i do that * partial * enumrate the * cleanup --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Content.Server.Mind;
|
|
using Content.Server.Objectives.Components;
|
|
using Content.Shared.Delivery;
|
|
using Content.Shared.FingerprintReader;
|
|
|
|
namespace Content.Server.Objectives.Systems;
|
|
|
|
public sealed partial class MailFraudObjectiveSystem : EntitySystem
|
|
{
|
|
[Dependency] private MindSystem _mind = default!;
|
|
[Dependency] private FingerprintReaderSystem _fingerprintReader = default!;
|
|
[Dependency] private CounterConditionSystem _counterCondition = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<DeliveryComponent, DeliveryOpenedEvent>(OnDeliveryOpened);
|
|
}
|
|
|
|
private void OnDeliveryOpened(Entity<DeliveryComponent> ent, ref DeliveryOpenedEvent args)
|
|
{
|
|
if (!ent.Comp.WasPenalized)
|
|
return; //not fraud
|
|
|
|
if (_fingerprintReader.IsAllowed(ent.Owner, args.User, out var _, showPopup: false, checkGloves: false))
|
|
return; //cutting open your own letter
|
|
|
|
if (!_mind.TryGetMind(args.User, out var mindUid, out var mind))
|
|
return;
|
|
|
|
foreach (var obj in _mind.EnumerateObjectives<MailFraudConditionComponent>((mindUid, mind)))
|
|
{
|
|
_counterCondition.IncreaseCount(obj);
|
|
}
|
|
}
|
|
}
|