SurviveConditionSystem.cs 754 B

12345678910111213141516171819202122232425
  1. using Content.Server.Objectives.Components;
  2. using Content.Shared.Objectives.Components;
  3. using Content.Shared.Mind;
  4. namespace Content.Server.Objectives.Systems;
  5. /// <summary>
  6. /// Handles progress for the survive objective condition.
  7. /// </summary>
  8. public sealed class SurviveConditionSystem : EntitySystem
  9. {
  10. [Dependency] private readonly SharedMindSystem _mind = default!;
  11. public override void Initialize()
  12. {
  13. base.Initialize();
  14. SubscribeLocalEvent<SurviveConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
  15. }
  16. private void OnGetProgress(EntityUid uid, SurviveConditionComponent comp, ref ObjectiveGetProgressEvent args)
  17. {
  18. args.Progress = _mind.IsCharacterDeadIc(args.Mind) ? 0f : 1f;
  19. }
  20. }