mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
* mass clean up
(cherry picked from commit 12bb873b02c1ef50e20763542b030452cc0613da)
* Revert "Centrifuge buff (#393)"
This reverts commit 2a59a18230.
(cherry picked from commit 9ee495ab4bb365e1ccd3dc627ecb55114fea6944)
* Shoving merge conflict
* fix rich traitor
* fix test
* yml
* fix test
* fix test
* ohh
78 lines
2.4 KiB
C#
78 lines
2.4 KiB
C#
using Content.Shared._White.Overlays;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client._White.Overlays;
|
|
|
|
public sealed class RemoteViewOverlaySystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPlayerManager _player = default!;
|
|
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
|
|
|
RemoteControlOverlay _overlay = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<RemoteControlOverlayComponent, ComponentInit>(OnInit);
|
|
SubscribeLocalEvent<RemoteControlOverlayComponent, ComponentShutdown>(OnShutdown);
|
|
|
|
SubscribeLocalEvent<RemoteControlOverlayComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
|
|
SubscribeLocalEvent<RemoteControlOverlayComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
|
|
|
|
|
|
_overlay = new();
|
|
}
|
|
|
|
private void OnPlayerAttached(EntityUid uid, RemoteControlOverlayComponent comp, LocalPlayerAttachedEvent args)
|
|
{
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void OnPlayerDetached(EntityUid uid, RemoteControlOverlayComponent comp, LocalPlayerDetachedEvent args)
|
|
{
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
|
|
private void OnInit(EntityUid uid, RemoteControlOverlayComponent comp, ComponentInit args)
|
|
{
|
|
if (_player.LocalEntity == uid)
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void OnShutdown(EntityUid uid, RemoteControlOverlayComponent comp, ComponentShutdown args)
|
|
{
|
|
if (_player.LocalEntity == uid)
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
}
|
|
|
|
public sealed class RemoteControlOverlay : Overlay
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
//public override bool RequestScreenTexture => true;
|
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
|
|
|
private readonly ShaderInstance _shader;
|
|
|
|
public RemoteControlOverlay()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_shader = _prototype.Index<ShaderPrototype>("RemoteControl").InstanceUnique();
|
|
}
|
|
|
|
protected override void Draw(in OverlayDrawArgs args)
|
|
{
|
|
var worldHandle = args.WorldHandle;
|
|
|
|
worldHandle.UseShader(_shader);
|
|
worldHandle.DrawRect(args.WorldBounds, Color.White);
|
|
worldHandle.UseShader(null);
|
|
}
|
|
}
|