Files
wwdpublic/Content.Server/Nyanotrasen/Objectives/Systems/BecomeGolemConditionSystem.cs
JJ 4996db833f Adds Psionic-related Antag Objectives. (#345)
* Adds Psionic-related Antag Objectives.

Look at them.

* Adds NotJobsRequirement, which should probably replace NotJob
2023-10-28 21:06:51 +02:00

35 lines
1.1 KiB
C#

using Content.Server.Objectives.Components;
using Content.Shared.Mind;
using Content.Shared.Objectives.Components;
namespace Content.Server.Objectives.Systems
{
public sealed class BecomeGolemConditionSystem : EntitySystem
{
private EntityQuery<MetaDataComponent> _metaQuery;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BecomeGolemConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
}
private void OnGetProgress(EntityUid uid, BecomeGolemConditionComponent comp, ref ObjectiveGetProgressEvent args)
{
args.Progress = GetProgress(args.Mind);
}
private float GetProgress(MindComponent mind)
{
var entMan = IoCManager.Resolve<IEntityManager>();
if (!_metaQuery.TryGetComponent(mind.OwnedEntity, out var meta))
return 0;
/*EntityManager.TryGetComponent<GolemComponent>(mind.CurrentEntity, out var GolemComp);
if(GolemComp)
return 1; TODO: Add this code back once Golems are implemented. */
return 0;
}
}
}