Skip to content

Commit

Permalink
fix and buff the handheld mass scanner (#31284)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmoGarbage404 authored Aug 21, 2024
1 parent 758f0ef commit 65c0b69
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl

public bool ShowIFF { get; set; } = true;
public bool ShowDocks { get; set; } = true;
public bool RotateWithEntity { get; set; } = true;

/// <summary>
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
Expand Down Expand Up @@ -109,6 +110,8 @@ public void UpdateState(NavInterfaceState state)

ActualRadarRange = Math.Clamp(ActualRadarRange, WorldMinRange, WorldMaxRange);

RotateWithEntity = state.RotateWithEntity;

_docks = state.Docks;
}

Expand Down Expand Up @@ -138,7 +141,8 @@ protected override void Draw(DrawingHandleScreen handle)
var mapPos = _transform.ToMapCoordinates(_coordinates.Value);
var offset = _coordinates.Value.Position;
var posMatrix = Matrix3Helpers.CreateTransform(offset, _rotation.Value);
var (_, ourEntRot, ourEntMatrix) = _transform.GetWorldPositionRotationMatrix(_coordinates.Value.EntityId);
var ourEntRot = RotateWithEntity ? _transform.GetWorldRotation(xform) : _rotation.Value;
var ourEntMatrix = Matrix3Helpers.CreateTransform(_transform.GetWorldPosition(xform), ourEntRot);
var ourWorldMatrix = Matrix3x2.Multiply(posMatrix, ourEntMatrix);
Matrix3x2.Invert(ourWorldMatrix, out var ourWorldMatrixInvert);

Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Shuttles/Systems/RadarConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ protected override void UpdateState(EntityUid uid, RadarConsoleComponent compone
state = _console.GetNavState(uid, docks);
}

state.RotateWithEntity = !component.FollowEntity;

_uiSystem.SetUiState(uid, RadarConsoleUiKey.Key, new NavBoundUserInterfaceState(state));
}
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/Shuttles/BUIStates/NavInterfaceState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public sealed class NavInterfaceState

public Dictionary<NetEntity, List<DockingPortState>> Docks;

public bool RotateWithEntity = true;

public NavInterfaceState(
float maxRange,
NetCoordinates? coordinates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
visible: true
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: RadarConsole
maxRange: 64
maxRange: 256
followEntity: true
- type: Appearance
- type: GenericVisualizer
Expand All @@ -25,8 +25,7 @@
True: { visible: true }
False: { visible: false }
- type: PowerCellDraw
drawRate: 3
useRate: 100
drawRate: 1.5
- type: ActivatableUI
key: enum.RadarConsoleUiKey.Key
inHandsOnly: true
Expand Down

0 comments on commit 65c0b69

Please sign in to comment.