Skip to content

Commit

Permalink
Cherry-picked commit e61260849bf6c6be98ea77189497267e4db51726 from De…
Browse files Browse the repository at this point in the history
…ltaV-Station/Delta-v/master
  • Loading branch information
deltanedas authored and PrMirrorBot committed Apr 7, 2024
1 parent b702cbd commit e76a3ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Content.Server.Objectives.Components;

/// <summary>
/// Requires that the player dies to be complete.
/// Requires that the player becomes psionic to be complete.
/// </summary>
[RegisterComponent, Access(typeof(BecomePsionicConditionSystem))]
public sealed partial class BecomePsionicConditionComponent : Component
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,24 @@
using Content.Shared.Mind;
using Content.Shared.Objectives.Components;

namespace Content.Server.Objectives.Systems
namespace Content.Server.Objectives.Systems;

public sealed class BecomePsionicConditionSystem : EntitySystem
{
public sealed class BecomePsionicConditionSystem : EntitySystem
public override void Initialize()
{
private EntityQuery<MetaDataComponent> _metaQuery;

public override void Initialize()
{
base.Initialize();
base.Initialize();

SubscribeLocalEvent<BecomePsionicConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
}
SubscribeLocalEvent<BecomePsionicConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
}

private void OnGetProgress(EntityUid uid, BecomePsionicConditionComponent comp, ref ObjectiveGetProgressEvent args)
{
args.Progress = GetProgress(args.Mind);
}
private void OnGetProgress(Entity<BecomePsionicConditionComponent> ent, ref ObjectiveGetProgressEvent args)
{
args.Progress = GetProgress(args.Mind);
}

private float GetProgress(MindComponent mind)
{
var entMan = IoCManager.Resolve<IEntityManager>();
if (HasComp<PsionicComponent>(mind.CurrentEntity))
return 1;
return 0;
}
private float GetProgress(MindComponent mind)
{
return HasComp<PsionicComponent>(mind.OwnedEntity) ? 1 : 0;
}
}

0 comments on commit e76a3ea

Please sign in to comment.