* Update ExplosionOverlaySystem.cs * noting here that this may be reverted. Not sure why transform sys is attached like this. * Noting that this may be reverted. * rapid fire spit spit spit spit spit * last one on the client. * Update SpawnExplosionWindow.xaml.cs * Update ParallaxOverlay.cs * wweeeeebbbbbbbbbbbbbbbbbbbbbbbbb edit * requested changes. * Update Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Parallax/ParallaxSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Parallax/ParallaxSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Parallax/ParallaxOverlay.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Parallax/BiomeDebugOverlay.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Overlays/StencilOverlay.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Parallax/BiomeDebugOverlay.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Client/Atmos/Overlays/GasTileOverlay.cs * Update Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
120 lines
3.8 KiB
C#
120 lines
3.8 KiB
C#
using System.Numerics;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.Console;
|
|
using Robust.Client.Player;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
[UsedImplicitly]
|
|
public sealed partial class LoadBlueprintsWindow : DefaultWindow
|
|
{
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
public LoadBlueprintsWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
}
|
|
|
|
protected override void EnteredTree()
|
|
{
|
|
var mapSystem = _entityManager.System<SharedMapSystem>();
|
|
|
|
foreach (var mapId in mapSystem.GetAllMapIds())
|
|
{
|
|
MapOptions.AddItem(mapId.ToString(), (int) mapId);
|
|
}
|
|
|
|
Reset();
|
|
|
|
MapOptions.OnItemSelected += OnOptionSelect;
|
|
RotationSpin.ValueChanged += OnRotate;
|
|
SubmitButton.OnPressed += OnSubmitButtonPressed;
|
|
TeleportButton.OnPressed += OnTeleportButtonPressed;
|
|
ResetButton.OnPressed += OnResetButtonPressed;
|
|
}
|
|
|
|
private void Reset()
|
|
{
|
|
var xformSystem = _entityManager.System<SharedTransformSystem>();
|
|
var player = _playerManager.LocalEntity;
|
|
|
|
var currentMap = MapId.Nullspace;
|
|
var position = Vector2.Zero;
|
|
var rotation = Angle.Zero;
|
|
|
|
if (_entityManager.TryGetComponent<TransformComponent>(player, out var xform))
|
|
{
|
|
currentMap = xform.MapID;
|
|
position = xformSystem.GetWorldPosition(xform);
|
|
|
|
if (_entityManager.TryGetComponent<TransformComponent>(xform.GridUid, out var gridXform))
|
|
{
|
|
rotation = xformSystem.GetWorldRotation(gridXform);
|
|
}
|
|
else
|
|
{
|
|
// MapId moment
|
|
rotation = xformSystem.GetWorldRotation(xform) - xform.LocalRotation;
|
|
}
|
|
}
|
|
|
|
if (currentMap != MapId.Nullspace)
|
|
MapOptions.Select((int) currentMap);
|
|
|
|
XCoordinate.Value = (int) position.X;
|
|
YCoordinate.Value = (int) position.Y;
|
|
|
|
RotationSpin.OverrideValue(Wraparound((int) rotation.Degrees));
|
|
}
|
|
|
|
private void OnResetButtonPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
Reset();
|
|
}
|
|
|
|
private void OnRotate(ValueChangedEventArgs e)
|
|
{
|
|
var newValue = Wraparound(e.Value);
|
|
|
|
if (e.Value == newValue) return;
|
|
|
|
RotationSpin.OverrideValue(newValue);
|
|
}
|
|
|
|
private int Wraparound(int value)
|
|
{
|
|
var newValue = (value % 360);
|
|
if (newValue < 0)
|
|
newValue += 360;
|
|
|
|
return newValue;
|
|
}
|
|
|
|
private void OnOptionSelect(OptionButton.ItemSelectedEventArgs obj)
|
|
{
|
|
MapOptions.SelectId(obj.Id);
|
|
}
|
|
|
|
private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
|
$"tp {XCoordinate.Value} {YCoordinate.Value} {new MapId(MapOptions.SelectedId)}");
|
|
}
|
|
|
|
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
if (MapPath.Text.Length == 0) return;
|
|
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
|
$"loadbp {new MapId(MapOptions.SelectedId)} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
|
|
}
|
|
}
|
|
}
|