forked from space-syndicate/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from AwareFoxy/surg-hotfix-mood
Surgery fixes
- Loading branch information
Showing
110 changed files
with
2,179 additions
and
360 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
Content.Client/Backmen/Overlays/Shaders/SaturationScaleOverlay.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System.Numerics; | ||
using Content.Shared._CorvaxNext.Overlays; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Enums; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client._CorvaxNext.Overlays.Shaders; | ||
|
||
public sealed class SaturationScaleOverlay : Overlay | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
[Dependency] private readonly IPlayerManager _playerManager = default!; | ||
[Dependency] IEntityManager _entityManager = default!; | ||
|
||
public override bool RequestScreenTexture => true; | ||
public override OverlaySpace Space => OverlaySpace.WorldSpace; | ||
private readonly ShaderInstance _shader; | ||
private const float Saturation = 0.5f; | ||
|
||
|
||
public SaturationScaleOverlay() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
|
||
_shader = _prototypeManager.Index<ShaderPrototype>("SaturationScale").Instance().Duplicate(); | ||
} | ||
|
||
protected override bool BeforeDraw(in OverlayDrawArgs args) | ||
{ | ||
if (_playerManager.LocalEntity is not { Valid: true } player | ||
|| !_entityManager.HasComponent<SaturationScaleOverlayComponent>(player)) | ||
return false; | ||
|
||
return base.BeforeDraw(in args); | ||
} | ||
|
||
|
||
protected override void Draw(in OverlayDrawArgs args) | ||
{ | ||
if (ScreenTexture is null) | ||
return; | ||
|
||
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture); | ||
_shader.SetParameter("saturation", Saturation); | ||
|
||
var handle = args.WorldHandle; | ||
handle.SetTransform(Matrix3x2.Identity); | ||
handle.UseShader(_shader); | ||
handle.DrawRect(args.WorldBounds, Color.White); | ||
handle.UseShader(null); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
Content.Client/Backmen/Overlays/Systems/SaturationScaleSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Content.Client._CorvaxNext.Overlays.Shaders; | ||
using Content.Shared._CorvaxNext.Overlays; | ||
using Content.Shared.GameTicking; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Client._CorvaxNext.Overlays.Systems; | ||
|
||
public sealed class SaturationScaleSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IOverlayManager _overlayMan = default!; | ||
[Dependency] private readonly ISharedPlayerManager _playerMan = default!; | ||
|
||
private SaturationScaleOverlay _overlay = default!; | ||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
_overlay = new(); | ||
|
||
SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentShutdown>(OnShutdown); | ||
|
||
SubscribeLocalEvent<SaturationScaleOverlayComponent, PlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<SaturationScaleOverlayComponent, PlayerDetachedEvent>(OnPlayerDetached); | ||
|
||
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup); | ||
} | ||
|
||
|
||
private void RoundRestartCleanup(RoundRestartCleanupEvent ev) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerDetachedEvent args) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerAttachedEvent args) | ||
{ | ||
_overlayMan.AddOverlay(_overlay); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, SaturationScaleOverlayComponent component, ComponentShutdown args) | ||
{ | ||
if (uid != _playerMan.LocalEntity) | ||
return; | ||
|
||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnInit(EntityUid uid, SaturationScaleOverlayComponent component, ComponentInit args) | ||
{ | ||
if (uid != _playerMan.LocalEntity) | ||
return; | ||
|
||
_overlayMan.AddOverlay(_overlay); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Content.Shared.Alert; | ||
using Content.Shared.FixedPoint; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic; | ||
|
||
namespace Content.Server._CorvaxNext.Mood | ||
{ | ||
|
||
} |
Oops, something went wrong.