CatStation/Content.Client/StationTeleporter/StationTeleporterNavMapControl.cs
TheShuEd bdbc143e7f
Stationary teleporters (#32134)
* sprite, start work on systems

* Woah! Its work!

* Show gateways! Yay!

* Update ring.png

* Update portal.yml

* bububui

* Fuck UI

* draw lines!

* clear old links lines

* UI button work now!

* we can cut links via UI now!

* yay! linking via UI

* comfortable linking

* Update hand_teleporter.yml

* ambience, linked entities events

* nice connect and disconnect sounds!

* unpowering and memory

* power fix

* chip added

* chip linking & auto linking

* chip examined

* auto linked chips&gates variants

* Update meta.json

* Update computers.yml

* syndicate gateway console, portal coloring, realtime UI update

* QoL update

* Circuitboards

* Update StationGatewayNavMapControl.cs

* optimize Draw(), add Filled console variant

* documentation

* mass renaming bro

* resprited

* resprite agani

* Update tags.yml

* Update Resources/Prototypes/Entities/Structures/Machines/station_teleporter.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Devices/teleporters_chips.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Content.Server/StationTeleporter/Components/TeleporterChipComponent.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Content.Shared/StationTeleporter/StationTeleporterComponent.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* renaming renaming

* sharedization

* UI fix

* Data simplify

* remove autodeletion

* PostWallDrawingAction

* Update TeleporterChipComponent.cs

* fix lines offset

* labeler renaming, rebound restiction removed

* prevent link popup and sound spamming

* auto linking refactor

* RD handheld teleporter integration

* fix randomteleport bug

* Update hand_teleporter.yml

* Update SharedStationTeleporterSystem.cs

* Update SharedStationTeleporterSystem.UI.cs

* some clean up

* first smol review pass

* and that

* review pass 2

* Update station_teleporter.yml

* review pass 3

* review pass 4

* finally

* update protos

* another clean up

* fix bugs

* add to players

* remove unnecesary update loop lol.

* Update computers.yml

* fieldrance review apply

* Kazne resprite

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
2026-07-28 11:39:26 +00:00

52 lines
1.6 KiB
C#

using System.Numerics;
using Content.Client.Pinpointer.UI;
using Robust.Client.Graphics;
namespace Content.Client.StationTeleporter;
public sealed partial class StationTeleporterNavMapControl : NavMapControl
{
private readonly HashSet<(Vector2, Vector2)> _linkedTeleportersCoordinates = new();
private readonly SharedTransformSystem _transformSystem;
public StationTeleporterNavMapControl()
{
_transformSystem = EntManager.System<SharedTransformSystem>();
MaxSelectableDistance = 30f;
WallColor = new Color(32, 96, 128);
TileColor = new Color(12, 50, 69);
BackgroundColor = Color.FromSrgb(TileColor.WithAlpha(BackgroundOpacity));
PostWallDrawingAction += DrawAllTeleporterLinks;
}
public void AddTeleporterLink(Vector2 first, Vector2 second)
{
_linkedTeleportersCoordinates.Add((first, second));
}
public void ClearTeleporterLinks()
{
_linkedTeleportersCoordinates.Clear();
}
private void DrawAllTeleporterLinks(DrawingHandleScreen handle)
{
if (Xform is null)
return;
foreach (var link in _linkedTeleportersCoordinates)
{
var pos1 = Vector2.Transform(link.Item1, _transformSystem.GetInvWorldMatrix(Xform)) - GetOffset();
pos1 = ScalePosition(new Vector2(pos1.X, -pos1.Y));
var pos2 = Vector2.Transform(link.Item2, _transformSystem.GetInvWorldMatrix(Xform)) - GetOffset();
pos2 = ScalePosition(new Vector2(pos2.X, -pos2.Y));
handle.DrawLine(pos1, pos2, Color.Aqua);
}
}
}