* Adds dogvision to game * Added DogVision to vulps, corgi, walter and mcgriff * changelog * locale fix + added category * Buffed vulps * Removed dog vision from vulps, nerfed eyesight --------- Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// Inspired by Nyanotrasen
|
|
|
|
using Content.Shared.Abilities;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Client._Sunrise.Overlays;
|
|
public sealed class DogVisionSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPlayerManager _player = default!;
|
|
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
|
|
|
private DogVisionOverlay _overlay = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DogVisionComponent, ComponentInit>(OnDogVisionInit);
|
|
SubscribeLocalEvent<DogVisionComponent, ComponentShutdown>(OnDogVisionShutdown);
|
|
|
|
SubscribeLocalEvent<DogVisionComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
|
|
SubscribeLocalEvent<DogVisionComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
|
|
|
|
_overlay = new();
|
|
}
|
|
|
|
private void OnPlayerAttached(EntityUid uid, DogVisionComponent component, LocalPlayerAttachedEvent args)
|
|
{
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void OnPlayerDetached(EntityUid uid, DogVisionComponent component, LocalPlayerDetachedEvent args)
|
|
{
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
|
|
private void OnDogVisionInit(EntityUid uid, DogVisionComponent component, ComponentInit args)
|
|
{
|
|
if (_player.LocalPlayer?.ControlledEntity == uid)
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void OnDogVisionShutdown(EntityUid uid, DogVisionComponent component, ComponentShutdown args)
|
|
{
|
|
if (_player.LocalPlayer?.ControlledEntity == uid)
|
|
{
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
}
|
|
}
|