Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Oct 16, 2024
1 parent 0f19b64 commit 56ce403
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Content.Client/_White/Overlays/BaseSwitchableOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Content.Client._White.Overlays;

public sealed class BaseSwitchableOverlay<TComp> : Overlay
public abstract class BaseSwitchableOverlay<TComp> : Overlay
where TComp : SwitchableOverlayComponent
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/_White/Overlays/NightVisionOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared._White.Overlays;

namespace Content.Client._White.Overlays;

public sealed class NightVisionOverlay : BaseSwitchableOverlay<NightVisionComponent>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

namespace Content.Client._White.Overlays;

public sealed class NightOverlaySystem : SwitchableOverlaySystem<NightVisionComponent, ToggleNightVisionEvent>
public sealed class NightVisionSystem : SwitchableOverlaySystem<NightVisionComponent, ToggleNightVisionEvent>
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly ILightManager _lightManager = default!;

private BaseSwitchableOverlay<NightVisionComponent> _overlay = default!;
private NightVisionOverlay _overlay = default!;

public override void Initialize()
{
Expand All @@ -22,7 +22,7 @@ public override void Initialize()
SubscribeLocalEvent<NightVisionComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRestart);

_overlay = new BaseSwitchableOverlay<NightVisionComponent>();
_overlay = new NightVisionOverlay();
}

private void OnPlayerAttached(EntityUid uid, NightVisionComponent component, PlayerAttachedEvent args)
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/_White/Overlays/ThermalOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared._White.Overlays;

namespace Content.Client._White.Overlays;

public sealed class ThermalOverlay : BaseSwitchableOverlay<ThermalVisionComponent>;
10 changes: 7 additions & 3 deletions Content.Client/_White/Overlays/ThermalVisionOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ protected override void Draw(in OverlayDrawArgs args)

var worldHandle = args.WorldHandle;
var eye = args.Viewport.Eye;
var mapId = eye?.Position.MapId;
var eyeRot = eye?.Rotation ?? default;

if (eye == null)
return;

var mapId = eye.Position.MapId;
var eyeRot = eye.Rotation;

_entries.Clear();
var entities = _entity.EntityQueryEnumerator<BodyComponent, SpriteComponent, TransformComponent>();
Expand Down Expand Up @@ -105,7 +109,7 @@ private void Render(Entity<SpriteComponent, TransformComponent, BodyComponent> e
private bool CanSee(EntityUid uid, SpriteComponent sprite, BodyComponent body)
{
return sprite.Visible
&& body.Thermal
&& body.ThermalVisibility
&& (!_entity.TryGetComponent(uid, out StealthComponent? stealth)
|| _stealth.GetVisibility(uid, stealth) > 0.5f);
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/_White/Overlays/ThermalVisionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class ThermalVisionSystem : SwitchableOverlaySystem<ThermalVisionC
[Dependency] private readonly IOverlayManager _overlayMan = default!;

private ThermalVisionOverlay _thermalOverlay = default!;
private BaseSwitchableOverlay<ThermalVisionComponent> _overlay = default!;
private ThermalOverlay _overlay = default!;

public override void Initialize()
{
Expand All @@ -23,7 +23,7 @@ public override void Initialize()
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRestart);

_thermalOverlay = new ThermalVisionOverlay();
_overlay = new BaseSwitchableOverlay<ThermalVisionComponent>();
_overlay = new ThermalOverlay();
}

private void OnPlayerAttached(EntityUid uid, ThermalVisionComponent component, PlayerAttachedEvent args)
Expand Down
5 changes: 0 additions & 5 deletions Content.Server/_White/Overlays/NightOverlaySystem.cs

This file was deleted.

5 changes: 5 additions & 0 deletions Content.Server/_White/Overlays/NightVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared._White.Overlays;

namespace Content.Server._White.Overlays;

public sealed class NightVisionSystem : SwitchableOverlaySystem<NightVisionComponent, ToggleNightVisionEvent>;
2 changes: 1 addition & 1 deletion Content.Shared/Body/Components/BodyComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public sealed partial class BodyComponent : Component

// WD EDIT START
[DataField, AutoNetworkedField]
public bool Thermal = true;
public bool ThermalVisibility = true;
// WD EDIT END
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
cell_slot:
name: power-cell-slot-component-slot-name-default
- type: Body
thermal: false # WD EDIT
thermalVisibility: false # WD EDIT
- type: StatusEffects
allowed:
- Stun
Expand Down
Binary file removed Resources/Prototypes/Entities/Mobs/Entities.lnk
Binary file not shown.
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
bodyType: Kinematic
- type: Body
prototype: Aghost
thermal: false # WD EDIT
thermalVisibility: false # WD EDIT
- type: Access
groups:
- AllAccess
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/_White/Research/experimental.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id: NightVisionTech
name: research-technology-night-vision
icon:
sprite: White/Clothing/Head/nightvision.rsi
sprite: _White/Clothing/Eyes/Goggles/nightvision.rsi
state: icon
discipline: Experimental
tier: 2
Expand All @@ -16,7 +16,7 @@
id: ThermalVisionTech
name: research-technology-thermal-vision
icon:
sprite: Clothing/Eyes/Glasses/thermal.rsi
sprite: _White/Clothing/Eyes/Goggles/thermal.rsi
state: icon
discipline: Experimental
tier: 2
Expand Down

0 comments on commit 56ce403

Please sign in to comment.