mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Content.Server._White.GameTicking.Rules;
|
|
using Content.Server._White.Objectives.Components;
|
|
using Content.Server.Objectives.Components;
|
|
using Content.Server.Objectives.Systems;
|
|
using Content.Shared.Objectives.Components;
|
|
|
|
namespace Content.Server._White.Objectives.Systems;
|
|
|
|
public sealed class PickBloodCultTargetSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly BloodCultRuleSystem _cultRule = default!;
|
|
[Dependency] private readonly TargetObjectiveSystem _target = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<PickBloodCultTargetComponent, ObjectiveAssignedEvent>(OnObjectiveAssigned);
|
|
}
|
|
|
|
private void OnObjectiveAssigned(Entity<PickBloodCultTargetComponent> ent, ref ObjectiveAssignedEvent args)
|
|
{
|
|
if (!TryComp<TargetObjectiveComponent>(ent, out var targetObjective)
|
|
|| _cultRule.GetBloodCultOfferingTarget() is not { } target)
|
|
{
|
|
args.Cancelled = true;
|
|
return;
|
|
}
|
|
|
|
_target.SetTarget(ent, target, targetObjective);
|
|
}
|
|
}
|