-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Psionic-related Antag Objectives. (#345)
* Adds Psionic-related Antag Objectives. Look at them. * Adds NotJobsRequirement, which should probably replace NotJob
- Loading branch information
Showing
11 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Content.Server/DeltaV/Objectives/Components/NotJobsRequirementComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Content.Server.Objectives.Systems; | ||
using Content.Shared.Roles; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; | ||
|
||
/// <summary> | ||
/// Requires that the player not have a certain job to have this objective. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(NotJobsRequirementSystem))] | ||
public sealed partial class NotJobsRequirementComponent : Component | ||
{ | ||
/// <summary> | ||
/// ID of the job to ban from having this objective. | ||
/// </summary> | ||
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))] | ||
public List<string> Jobs = new(); | ||
} |
31 changes: 31 additions & 0 deletions
31
Content.Server/DeltaV/Objectives/Systems/NotJobsRequirementSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Content.Server.Objectives.Components; | ||
using Content.Shared.Objectives.Components; | ||
using Content.Shared.Roles.Jobs; | ||
|
||
namespace Content.Server.Objectives.Systems; | ||
|
||
/// <summary> | ||
/// Handles checking the job blacklist for this objective. | ||
/// </summary> | ||
public sealed class NotJobsRequirementSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<NotJobsRequirementComponent, RequirementCheckEvent>(OnCheck); | ||
} | ||
|
||
private void OnCheck(EntityUid uid, NotJobsRequirementComponent comp, ref RequirementCheckEvent args) | ||
{ | ||
if (args.Cancelled) | ||
return; | ||
|
||
// if player has no job then don't care | ||
if (!TryComp<JobComponent>(args.MindId, out var job)) | ||
return; | ||
foreach (string forbidJob in comp.Jobs) | ||
if (job.PrototypeId == forbidJob) | ||
args.Cancelled = true; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Server/Nyanotrasen/Objectives/Components/BecomeGolemConditionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Content.Server.Objectives.Systems; | ||
|
||
namespace Content.Server.Objectives.Components; | ||
|
||
/// <summary> | ||
/// Requires that the player dies to be complete. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(BecomeGolemConditionSystem))] | ||
public sealed partial class BecomeGolemConditionComponent : Component | ||
{ | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Server/Nyanotrasen/Objectives/Components/BecomePsionicConditionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Content.Server.Objectives.Systems; | ||
|
||
namespace Content.Server.Objectives.Components; | ||
|
||
/// <summary> | ||
/// Requires that the player dies to be complete. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(BecomePsionicConditionSystem))] | ||
public sealed partial class BecomePsionicConditionComponent : Component | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Server/Nyanotrasen/Objectives/Components/RaiseGlimmerConditionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Content.Server.Objectives.Systems; | ||
|
||
namespace Content.Server.Objectives.Components; | ||
|
||
/// <summary> | ||
/// Requires that the player dies to be complete. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(RaiseGlimmerConditionSystem))] | ||
public sealed partial class RaiseGlimmerConditionComponent : Component | ||
{ | ||
[DataField("target"), ViewVariables(VVAccess.ReadWrite)] | ||
public int Target; | ||
} |
34 changes: 34 additions & 0 deletions
34
Content.Server/Nyanotrasen/Objectives/Systems/BecomeGolemConditionSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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; | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Content.Server/Nyanotrasen/Objectives/Systems/BecomePsionicConditionSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Content.Shared.Abilities.Psionics; | ||
using Content.Server.Objectives.Components; | ||
using Content.Shared.Mind; | ||
using Content.Shared.Objectives.Components; | ||
|
||
namespace Content.Server.Objectives.Systems | ||
{ | ||
public sealed class BecomePsionicConditionSystem : EntitySystem | ||
{ | ||
private EntityQuery<MetaDataComponent> _metaQuery; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<BecomePsionicConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress); | ||
} | ||
|
||
private void OnGetProgress(EntityUid uid, BecomePsionicConditionComponent comp, 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; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
Content.Server/Nyanotrasen/Objectives/Systems/RaiseGlimmerConditionSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Content.Shared.Psionics.Glimmer; | ||
using Content.Server.Objectives.Components; | ||
using Content.Shared.Objectives.Components; | ||
|
||
namespace Content.Server.Objectives.Systems | ||
{ | ||
public sealed class RaiseGlimmerConditionSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntitySystemManager _sysMan = default!; | ||
[Dependency] private readonly MetaDataSystem _metaData = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RaiseGlimmerConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress); | ||
SubscribeLocalEvent<RaiseGlimmerConditionComponent, ObjectiveAfterAssignEvent>(OnAfterAssign); | ||
} | ||
|
||
private void OnAfterAssign(EntityUid uid, RaiseGlimmerConditionComponent comp, ref ObjectiveAfterAssignEvent args) | ||
{ | ||
var title = Loc.GetString("objective-condition-raise-glimmer-title", ("target", comp.Target)); | ||
var description = Loc.GetString("objective-condition-raise-glimmer-description", ("target", comp.Target)); | ||
|
||
_metaData.SetEntityName(uid, title, args.Meta); | ||
_metaData.SetEntityDescription(uid, description, args.Meta); | ||
} | ||
|
||
private void OnGetProgress(EntityUid uid, RaiseGlimmerConditionComponent comp, ref ObjectiveGetProgressEvent args) | ||
{ | ||
args.Progress = GetProgress(comp.Target); | ||
} | ||
|
||
private float GetProgress(int target) | ||
{ | ||
var glimmer = _sysMan.GetEntitySystem<GlimmerSystem>().Glimmer; | ||
var progress = Math.Min((float) glimmer / (float) target, 1f); | ||
return progress; | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Resources/Locale/en-US/nyanotrasen/objectives/conditions/conditions.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
objective-condition-raise-glimmer-title = Ensure glimmer reaches {$target}Ψ. | ||
objective-condition-raise-glimmer-description = We need you to pump the noösphere surrounding the station to at least {$target}Ψ and keep it that way. | ||
objective-condition-become-psionic-title = Become psionic | ||
objective-condition-become-psionic-description = We need you to acquire psionics and keep them until your mission is complete. | ||
objective-condition-become-golem-title = Get golemized | ||
objective-condition-become-golem-description = We'd like to understand more of the golemization process. Become a golem, survive, and we'll debrief you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters