forked from impstation/imp-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/impstation/imp-station-14
- Loading branch information
Showing
8 changed files
with
136 additions
and
16 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...Impstation/Xenoarchaeology/XenoArtifacts/Effects/Components/KnockdownArtifactComponent.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,26 @@ | ||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; | ||
|
||
/// <summary> | ||
/// Knocksdown everything within range, or on the entire local grid. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class KnockdownArtifactComponent : Component | ||
{ | ||
/// <summary> | ||
/// How close do you have to be to get knocked down? | ||
/// </summary> | ||
[DataField("range"), ViewVariables(VVAccess.ReadWrite)] | ||
public float Range = 8f; | ||
|
||
/// <summary> | ||
/// How strongly does stuff get thrown? | ||
/// </summary> | ||
[DataField("entireGrid"), ViewVariables(VVAccess.ReadWrite)] | ||
public bool EntireGrid = false; | ||
|
||
/// <summary> | ||
/// How long to remain knocked down for? | ||
/// </summary> | ||
[DataField("knockdownTime"), ViewVariables(VVAccess.ReadWrite)] | ||
public float KnockdownTime = 3f; | ||
} |
72 changes: 72 additions & 0 deletions
72
...rver/_Impstation/Xenoarchaeology/XenoArtifacts/Effects/Systems/KnockdownArtifactSystem.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,72 @@ | ||
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; | ||
using Content.Shared.Buckle.Components; | ||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events; | ||
using Content.Shared.Maps; | ||
using Content.Shared.Throwing; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Random; | ||
using Content.Shared.StatusEffect; | ||
using Content.Server.Stunnable; | ||
|
||
|
||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; | ||
|
||
public sealed class KnockdownArtifactSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly EntityLookupSystem _lookup = default!; | ||
[Dependency] private readonly StunSystem _stuns = default!; | ||
|
||
private EntityQuery<BuckleComponent> _buckleQuery; | ||
private EntityQuery<StatusEffectsComponent> _statusQuery; | ||
|
||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<KnockdownArtifactComponent, ArtifactActivatedEvent>(OnActivated); | ||
_buckleQuery = GetEntityQuery<BuckleComponent>(); | ||
_statusQuery = GetEntityQuery<StatusEffectsComponent>(); | ||
|
||
} | ||
|
||
private void OnActivated(EntityUid uid, KnockdownArtifactComponent component, ArtifactActivatedEvent args) | ||
{ | ||
var transform = Transform(uid); | ||
var gridUid = transform.GridUid; | ||
// knock over everyone on the same grid, fall back to range if not on a grid. | ||
if (component.EntireGrid && gridUid != null) { | ||
var gridTransform = Transform((EntityUid)gridUid); | ||
var childEnumerator = gridTransform.ChildEnumerator; | ||
while (childEnumerator.MoveNext(out var child)) | ||
{ | ||
if (!_buckleQuery.TryGetComponent(child, out var buckle) || buckle.Buckled) | ||
continue; | ||
|
||
if (!_statusQuery.TryGetComponent(child, out var status)) | ||
continue; | ||
|
||
_stuns.TryParalyze(child, TimeSpan.FromSeconds(component.KnockdownTime), true, status); | ||
} | ||
|
||
|
||
|
||
} | ||
else // knock over only people in range | ||
{ | ||
var ents = _lookup.GetEntitiesInRange(uid, component.Range); | ||
if (args.Activator != null) | ||
ents.Add(args.Activator.Value); | ||
foreach (var ent in ents) | ||
{ | ||
if (!_buckleQuery.TryGetComponent(ent, out var buckle) || buckle.Buckled) | ||
continue; | ||
|
||
if (!_statusQuery.TryGetComponent(ent, out var status)) | ||
continue; | ||
|
||
_stuns.TryParalyze(ent, TimeSpan.FromSeconds(component.KnockdownTime), true, status); | ||
} | ||
|
||
} | ||
} | ||
} |
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
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
Binary file modified
BIN
+3.91 KB
(820%)
Resources/Textures/Clothing/Head/Hardsuits/mime.rsi/icon-flash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file modified
BIN
+3.95 KB
(900%)
Resources/Textures/Clothing/Head/Hardsuits/mime.rsi/on-equipped-HELMET.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.