Skip to content

Commit 676492e

Browse files
Thermal vision overlay for admins (space-wizards#42812)
* revert of the revert * tests * changes * more fun * test * ccvvvar * works but bad * now its better * more fixes * more cleanup * cleaning * last fixes before move to glasses activ * x * glasses only * working * fix toolbox * cleanup * ThermalByte added * small fix * small optimalisations * float bux fix * comments add * more comments * more comments * last fix * revert cvar delete * wrong blue shades * cvar refactor * Update Content.Shared/Atmos/EntitySystems/SharedGasTileOverlaySystem.cs Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> * Update Content.Client/Atmos/Overlays/GasTileDangerousTemperatureOverlay.cs Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> * tweak to TryGetTemperature comment * Factors are now const * renames * Interface for ThermalByte * admin button * cleanup * sandoboxenabled --------- Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
1 parent 545223a commit 676492e

6 files changed

Lines changed: 30 additions & 4 deletions

File tree

Content.Client/Sandbox/SandboxSystem.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public void Suicide()
8383
RaiseNetworkEvent(new MsgSandboxSuicide());
8484
}
8585

86+
public void ToggleThermalVision()
87+
{
88+
RaiseNetworkEvent(new MsgSandboxThermalVision());
89+
}
90+
8691
public bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
8792
{
8893
if (!SandboxAllowed)

Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Numerics;
1+
using System.Numerics;
22
using Content.Client.Administration.Managers;
33
using Content.Client.Gameplay;
44
using Content.Client.Sandbox;
@@ -137,6 +137,7 @@ private void EnsureWindow()
137137
_window.ToggleSubfloorButton.OnPressed += _ => _sandbox.ToggleSubFloor();
138138
_window.ShowMarkersButton.OnPressed += _ => _sandbox.ShowMarkers();
139139
_window.ShowBbButton.OnPressed += _ => _sandbox.ShowBb();
140+
_window.ToggleThermalVisionButton.OnToggled += _ => _sandbox.ToggleThermalVision();
140141
}
141142

142143
private void CheckSandboxVisibility()

Content.Client/UserInterface/Systems/Sandbox/Windows/SandboxWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<windows:SandboxWindow
1+
<windows:SandboxWindow
22
xmlns="https://spacestation14.io"
33
xmlns:windows="clr-namespace:Content.Client.UserInterface.Systems.Sandbox.Windows"
44
Title="{Loc sandbox-window-title}"
@@ -12,6 +12,7 @@
1212
<Label Text="{Loc sandbox-window-visibility-label}"/>
1313
<Button Name="ToggleLightButton" Access="Public" Text="{Loc sandbox-window-toggle-lights-button}" ToggleMode="True"/>
1414
<Button Name="ToggleFovButton" Access="Public" Text="{Loc sandbox-window-toggle-fov-button}" ToggleMode="True"/>
15+
<Button Name="ToggleThermalVisionButton" Access="Public" Text="{Loc sandbox-window-toggle-thermal-vision}" ToggleMode="True"/>
1516
<Button Name="ToggleShadowsButton" Access="Public" Text="{Loc sandbox-window-toggle-shadows-button}" ToggleMode="True"/>
1617
<Button Name="ToggleSubfloorButton" Access="Public" Text="{Loc sandbox-window-toggle-subfloor-button}" ToggleMode="True"/>
1718
<Button Name="AiOverlayButton" Access="Public" Text="{Loc sandbox-window-ai-overlay-button}" ToggleMode="True"/>

Content.Server/Sandbox/SandboxSystem.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Linq;
21
using Content.Server.GameTicking;
32
using Content.Shared.Access;
43
using Content.Shared.Access.Components;
@@ -7,6 +6,7 @@
76
using Content.Shared.Hands.Components;
87
using Content.Shared.Hands.EntitySystems;
98
using Content.Shared.Inventory;
9+
using Content.Shared.Overlays;
1010
using Content.Shared.PDA;
1111
using Content.Shared.Sandbox;
1212
using Robust.Server.Console;
@@ -15,6 +15,7 @@
1515
using Robust.Shared.Enums;
1616
using Robust.Shared.Player;
1717
using Robust.Shared.Prototypes;
18+
using System.Linq;
1819

1920
namespace Content.Server.Sandbox
2021
{
@@ -50,6 +51,7 @@ public override void Initialize()
5051
SubscribeNetworkEvent<MsgSandboxGiveAccess>(SandboxGiveAccessReceived);
5152
SubscribeNetworkEvent<MsgSandboxGiveAghost>(SandboxGiveAghostReceived);
5253
SubscribeNetworkEvent<MsgSandboxSuicide>(SandboxSuicideReceived);
54+
SubscribeNetworkEvent<MsgSandboxThermalVision>(UpdateSandboxThermalVision);
5355

5456
SubscribeLocalEvent<GameRunLevelChangedEvent>(GameTickerOnOnRunLevelChanged);
5557

@@ -193,5 +195,18 @@ private void UpdateSandboxStatusForAll()
193195
{
194196
RaiseNetworkEvent(new MsgSandboxStatus { SandboxAllowed = IsSandboxEnabled });
195197
}
198+
199+
private void UpdateSandboxThermalVision(MsgSandboxThermalVision message, EntitySessionEventArgs args)
200+
{
201+
if (!IsSandboxEnabled)
202+
return;
203+
204+
var ent = args.SenderSession.AttachedEntity;
205+
if (ent == null) return;
206+
if (HasComp<ThermalSightComponent>(ent))
207+
RemComp<ThermalSightComponent>(ent.Value);
208+
else
209+
EnsureComp<ThermalSightComponent>(ent.Value);
210+
}
196211
}
197212
}

Content.Shared/Sandbox/SharedSandboxSystem.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Robust.Shared.Prototypes;
1+
using Robust.Shared.Prototypes;
22
using Robust.Shared.Serialization;
33

44
namespace Content.Shared.Sandbox
@@ -24,5 +24,8 @@ protected sealed class MsgSandboxGiveAghost : EntityEventArgs {}
2424

2525
[Serializable, NetSerializable]
2626
protected sealed class MsgSandboxSuicide : EntityEventArgs {}
27+
28+
[Serializable, NetSerializable]
29+
protected sealed class MsgSandboxThermalVision : EntityEventArgs {}
2730
}
2831
}

Resources/Locale/en-US/sandbox/sandbox-manager.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ sandbox-window-toggle-suicide-button = Suicide
1919
sandbox-window-show-spawns-button = Show Spawns
2020
sandbox-window-show-bb-button = Show BB
2121
sandbox-window-show-npc-button = Show NPC
22+
sandbox-window-toggle-thermal-vision = Toggle Thermal Vision

0 commit comments

Comments
 (0)