Термалки (#466)

* - add: Rewrite night vision.

* - add: Thermals.

* - remove: Remove stuff from maps.

* - fix: Descriptions.
This commit is contained in:
Aviu00
2024-07-19 16:27:01 +00:00
committed by GitHub
parent 42b4aa4cef
commit 781e266fc2
36 changed files with 514 additions and 138 deletions

View File

@@ -72,6 +72,7 @@ public sealed class NightVisionSystem : SharedNightVisionSystem
if (_player.LocalSession != player)
return;
UpdateOverlay(active);
UpdateNightVision(active);
}
@@ -80,16 +81,31 @@ public sealed class NightVisionSystem : SharedNightVisionSystem
if (_player.LocalSession?.AttachedEntity != uid)
return;
UpdateOverlay(active);
UpdateNightVision(active);
}
private void UpdateNightVision(bool active)
public void UpdateOverlay(bool active)
{
if (_player.LocalEntity == null)
{
_overlayMan.RemoveOverlay(_overlay);
return;
}
var uid = _player.LocalEntity.Value;
active |= TryComp<NightVisionComponent>(uid, out var nv) && nv.IsActive ||
TryComp<ThermalVisionComponent>(uid, out var thermal) && thermal.IsActive ||
HasComp<TemporaryNightVisionComponent>(uid) ||
HasComp<TemporaryThermalVisionComponent>(uid);
if (active)
_overlayMan.AddOverlay(_overlay);
else
_overlayMan.RemoveOverlay(_overlay);
}
private void UpdateNightVision(bool active)
{
_lightManager.DrawLighting = !active;
}