fix and buff the handheld mass scanner (#31284)

This commit is contained in:
Nemanja
2024-08-21 14:33:01 -04:00
committed by GitHub
parent 758f0efed2
commit 65c0b699f2
4 changed files with 11 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
public bool ShowIFF { get; set; } = true; public bool ShowIFF { get; set; } = true;
public bool ShowDocks { get; set; } = true; public bool ShowDocks { get; set; } = true;
public bool RotateWithEntity { get; set; } = true;
/// <summary> /// <summary>
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates. /// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
@@ -109,6 +110,8 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
ActualRadarRange = Math.Clamp(ActualRadarRange, WorldMinRange, WorldMaxRange); ActualRadarRange = Math.Clamp(ActualRadarRange, WorldMinRange, WorldMaxRange);
RotateWithEntity = state.RotateWithEntity;
_docks = state.Docks; _docks = state.Docks;
} }
@@ -138,7 +141,8 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
var mapPos = _transform.ToMapCoordinates(_coordinates.Value); var mapPos = _transform.ToMapCoordinates(_coordinates.Value);
var offset = _coordinates.Value.Position; var offset = _coordinates.Value.Position;
var posMatrix = Matrix3Helpers.CreateTransform(offset, _rotation.Value); 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); var ourWorldMatrix = Matrix3x2.Multiply(posMatrix, ourEntMatrix);
Matrix3x2.Invert(ourWorldMatrix, out var ourWorldMatrixInvert); Matrix3x2.Invert(ourWorldMatrix, out var ourWorldMatrixInvert);

View File

@@ -53,6 +53,8 @@ public sealed class RadarConsoleSystem : SharedRadarConsoleSystem
state = _console.GetNavState(uid, docks); state = _console.GetNavState(uid, docks);
} }
state.RotateWithEntity = !component.FollowEntity;
_uiSystem.SetUiState(uid, RadarConsoleUiKey.Key, new NavBoundUserInterfaceState(state)); _uiSystem.SetUiState(uid, RadarConsoleUiKey.Key, new NavBoundUserInterfaceState(state));
} }
} }

View File

@@ -20,6 +20,8 @@ public sealed class NavInterfaceState
public Dictionary<NetEntity, List<DockingPortState>> Docks; public Dictionary<NetEntity, List<DockingPortState>> Docks;
public bool RotateWithEntity = true;
public NavInterfaceState( public NavInterfaceState(
float maxRange, float maxRange,
NetCoordinates? coordinates, NetCoordinates? coordinates,

View File

@@ -15,7 +15,7 @@
visible: true visible: true
map: [ "enum.PowerDeviceVisualLayers.Powered" ] map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: RadarConsole - type: RadarConsole
maxRange: 64 maxRange: 256
followEntity: true followEntity: true
- type: Appearance - type: Appearance
- type: GenericVisualizer - type: GenericVisualizer
@@ -25,8 +25,7 @@
True: { visible: true } True: { visible: true }
False: { visible: false } False: { visible: false }
- type: PowerCellDraw - type: PowerCellDraw
drawRate: 3 drawRate: 1.5
useRate: 100
- type: ActivatableUI - type: ActivatableUI
key: enum.RadarConsoleUiKey.Key key: enum.RadarConsoleUiKey.Key
inHandsOnly: true inHandsOnly: true