DieConditionSystem.cs 655 B

12345678910111213141516171819202122
  1. using Content.Server.Objectives.Components;
  2. using Content.Shared.Mind;
  3. using Content.Shared.Objectives.Components;
  4. namespace Content.Server.Objectives.Systems;
  5. public sealed class DieConditionSystem : EntitySystem
  6. {
  7. [Dependency] private readonly SharedMindSystem _mind = default!;
  8. public override void Initialize()
  9. {
  10. base.Initialize();
  11. SubscribeLocalEvent<DieConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
  12. }
  13. private void OnGetProgress(EntityUid uid, DieConditionComponent comp, ref ObjectiveGetProgressEvent args)
  14. {
  15. args.Progress = _mind.IsCharacterDeadIc(args.Mind) ? 1f : 0f;
  16. }
  17. }