|
1 | | -using System.Linq; |
2 | 1 | using Content.Server.GameTicking; |
3 | 2 | using Content.Shared.Access; |
4 | 3 | using Content.Shared.Access.Components; |
|
7 | 6 | using Content.Shared.Hands.Components; |
8 | 7 | using Content.Shared.Hands.EntitySystems; |
9 | 8 | using Content.Shared.Inventory; |
| 9 | +using Content.Shared.Overlays; |
10 | 10 | using Content.Shared.PDA; |
11 | 11 | using Content.Shared.Sandbox; |
12 | 12 | using Robust.Server.Console; |
|
15 | 15 | using Robust.Shared.Enums; |
16 | 16 | using Robust.Shared.Player; |
17 | 17 | using Robust.Shared.Prototypes; |
| 18 | +using System.Linq; |
18 | 19 |
|
19 | 20 | namespace Content.Server.Sandbox |
20 | 21 | { |
@@ -50,6 +51,7 @@ public override void Initialize() |
50 | 51 | SubscribeNetworkEvent<MsgSandboxGiveAccess>(SandboxGiveAccessReceived); |
51 | 52 | SubscribeNetworkEvent<MsgSandboxGiveAghost>(SandboxGiveAghostReceived); |
52 | 53 | SubscribeNetworkEvent<MsgSandboxSuicide>(SandboxSuicideReceived); |
| 54 | + SubscribeNetworkEvent<MsgSandboxThermalVision>(UpdateSandboxThermalVision); |
53 | 55 |
|
54 | 56 | SubscribeLocalEvent<GameRunLevelChangedEvent>(GameTickerOnOnRunLevelChanged); |
55 | 57 |
|
@@ -193,5 +195,18 @@ private void UpdateSandboxStatusForAll() |
193 | 195 | { |
194 | 196 | RaiseNetworkEvent(new MsgSandboxStatus { SandboxAllowed = IsSandboxEnabled }); |
195 | 197 | } |
| 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 | + } |
196 | 211 | } |
197 | 212 | } |
0 commit comments