Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New artifact trigger: Expressiveness #1642

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;

/// <summary>
/// Triggers when a nearby entity emotes
/// </summary>
[RegisterComponent]
public sealed partial class ArtifactExpressionTriggerComponent : Component
{
/// <summary>
/// How close to the emote event the artifact has to be for it to trigger.
/// </summary>
[DataField("range")]
public float Range = 2f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;
using Content.Server.Chat.Systems;
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Systems;

public sealed class ArtifacExpressionTriggerSystem : EntitySystem
{
[Dependency] private readonly ArtifactSystem _artifact = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<TransformComponent, EmoteEvent>(OnEmote);
}

private void OnEmote(EntityUid emoter, TransformComponent component, EmoteEvent args)
{
var emoterXform = Transform(emoter);

var toActivate = new List<Entity<ArtifactExpressionTriggerComponent>>();
var query = EntityQueryEnumerator<ArtifactExpressionTriggerComponent, TransformComponent>();

while (query.MoveNext(out var uid, out var trigger, out var xform))
{
if (!emoterXform.Coordinates.TryDistance(EntityManager, xform.Coordinates, out var distance))
continue;

if (distance > trigger.Range)
continue;

toActivate.Add((uid, trigger));
}

foreach (var a in toActivate)
{
_artifact.TryActivateArtifact(a);
}
}
}
1 change: 1 addition & 0 deletions Resources/Locale/en-US/xenoarchaeology/artifact-hints.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ artifact-trigger-hint-examine = Examination
artifact-trigger-hint-resurrection = Resurrection
artifact-trigger-hint-medical = Therapeutic chemicals
artifact-trigger-hint-funny = Slapstick comedy
artifact-trigger-hint-expression = Expressiveness

artifact-trigger-hint-drink-classic-martini = Beverage "Classically shaken"
artifact-trigger-hint-drink-caffine = Beverage "Caffinated"
Expand Down
25 changes: 18 additions & 7 deletions Resources/Prototypes/_Impstation/XenoArch/artifact_triggers.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- type: artifactTrigger
id: TriggerExpression
targetDepth: 2
triggerProb: 0.5
triggerHint: artifact-trigger-hint-expression
components:
- type: ArtifactExpressionTrigger
range: 4

- type: artifactTrigger
id: TriggerResurrection
targetDepth: 4
Expand All @@ -22,6 +31,15 @@
components:
- type: ArtifactStunTrigger

- type: artifactTrigger
id: TriggerExpressionDeep
targetDepth: 4
triggerProb: 0.7
triggerHint: artifact-trigger-hint-expression
components:
- type: ArtifactExpressionTrigger
range: 3

# Separate drinks into twenty chunks. one chunk has a total probability of 1/20, so all drinks together have same prob as normal trigger
# Some Chunks have multiple drinks (such as the tricky drink chunk)

Expand Down Expand Up @@ -388,13 +406,6 @@
- !type:ActivateArtifact

# Below exist to pad out the depth 4 triggers. Can remove some of those when we get more triggers implemented
- type: artifactTrigger
id: TriggerMusicDeep
targetDepth: 4
triggerHint: artifact-trigger-hint-music
components:
- type: ArtifactMusicTrigger

- type: artifactTrigger
id: TriggerExamineDeep
targetDepth: 4
Expand Down
Loading