mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* arrow * yoink orginal arrow rsi * done * fixes * i just learnd about ignored components * Update Content.Client/DirectionalArrowIndicator/DirectionalArrowIndicatorComponent.cs Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * customArrows * docs * more docs * teg and blue arrow * misc * fixes * remove color * imma dummy * meta * soon to obsolete * class not partial --------- Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Content.Shared.Examine;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Spawners;
|
|
|
|
namespace Content.Client.DirectionalArrowIndicator;
|
|
|
|
/// <summary>
|
|
/// System responsible for handling <see cref="DirectionalArrowIndicatorComponent"/>s,
|
|
/// spawning directional arrow indicators clientside when an entity is examined.
|
|
/// </summary>
|
|
public sealed partial class DirectionalArrowIndicatorSystem : EntitySystem
|
|
{
|
|
[Dependency] private TransformSystem _transform = default!;
|
|
|
|
private const float EdgeOffset = 0.78125f; // Used for moving arrow to the edge of the tile by default.
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<DirectionalArrowIndicatorComponent, ExaminedEvent>(OnExamined);
|
|
}
|
|
|
|
private void OnExamined(Entity<DirectionalArrowIndicatorComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
var arrows = ent.Comp.Arrows;
|
|
var lifetime = ent.Comp.Lifetime;
|
|
|
|
if (arrows.Count == 0)
|
|
arrows.Add(new ArrowSpawnData());
|
|
|
|
foreach (var arrowData in ent.Comp.Arrows)
|
|
{
|
|
var spawnedEnt = Spawn(arrowData.ArrowType, new EntityCoordinates(ent, arrowData.Offset.X, arrowData.Offset.Y + EdgeOffset));
|
|
|
|
_transform.SetLocalRotation(spawnedEnt, arrowData.Rotation);
|
|
|
|
EnsureComp<TimedDespawnComponent>(spawnedEnt, out var timedDespawn);
|
|
timedDespawn.Lifetime = lifetime;
|
|
}
|
|
}
|
|
}
|