-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Try-to-fix-the-mess-Colin-made
Signed-off-by: Debug <[email protected]>
- Loading branch information
Showing
295 changed files
with
114,190 additions
and
197 deletions.
There are no files selected for viewing
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,48 @@ | ||
using Content.Shared.DeltaV.Hologram; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.DeltaV.Hologram; | ||
|
||
public sealed class HologramSystem : SharedHologramSystem | ||
{ | ||
[Dependency] private readonly IPrototypeManager _protoMan = default!; | ||
[Dependency] private readonly OccluderSystem _occluder = default!; | ||
[Dependency] private readonly EntityManager _entMan = default!; | ||
|
||
private ShaderInstance _shader = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
_shader = _protoMan.Index<ShaderPrototype>("Hologram").InstanceUnique(); | ||
SubscribeLocalEvent<HologramComponent, ComponentShutdown>(OnShutdown); | ||
SubscribeLocalEvent<HologramComponent, ComponentStartup>(OnStartup); | ||
} | ||
|
||
private void SetShader(EntityUid uid, bool enabled, HologramComponent? component = null, SpriteComponent? sprite = null) | ||
{ | ||
if (!Resolve(uid, ref component, ref sprite, false)) | ||
return; | ||
|
||
sprite.PostShader = enabled ? _shader : null; | ||
} | ||
|
||
private void OnStartup(EntityUid uid, HologramComponent component, ComponentStartup args) | ||
{ | ||
SetShader(uid, true, component); | ||
|
||
component.Occludes = _entMan.TryGetComponent<OccluderComponent>(uid, out var occluder) && occluder.Enabled; | ||
if (component.Occludes) | ||
_occluder.SetEnabled(uid, false); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, HologramComponent component, ComponentShutdown args) | ||
{ | ||
SetShader(uid, false, component); | ||
if (component.Occludes) | ||
_occluder.SetEnabled(uid, true); | ||
} | ||
} |
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,44 @@ | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Enums; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Abilities; | ||
|
||
namespace Content.Client.Nyanotrasen.Overlays; | ||
|
||
public sealed partial class DogVisionOverlay : 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 _dogVisionShader; | ||
|
||
public DogVisionOverlay() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
_dogVisionShader = _prototypeManager.Index<ShaderPrototype>("DogVision").Instance().Duplicate(); | ||
} | ||
|
||
protected override void Draw(in OverlayDrawArgs args) | ||
{ | ||
if (ScreenTexture == null) | ||
return; | ||
if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} player) | ||
return; | ||
if (!_entityManager.HasComponent<DogVisionComponent>(player)) | ||
return; | ||
|
||
_dogVisionShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture); | ||
|
||
|
||
var worldHandle = args.WorldHandle; | ||
var viewport = args.WorldBounds; | ||
worldHandle.SetTransform(Matrix3.Identity); | ||
worldHandle.UseShader(_dogVisionShader); | ||
worldHandle.DrawRect(viewport, Color.White); | ||
} | ||
} |
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,51 @@ | ||
using Content.Shared.Abilities; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Player; | ||
|
||
namespace Content.Client.Nyanotrasen.Overlays; | ||
|
||
public sealed partial 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, PlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<DogVisionComponent, PlayerDetachedEvent>(OnPlayerDetached); | ||
|
||
_overlay = new(); | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, DogVisionComponent component, PlayerAttachedEvent args) | ||
{ | ||
_overlayMan.AddOverlay(_overlay); | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, DogVisionComponent component, PlayerDetachedEvent 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); | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
Content.Client/Nyanotrasen/ReverseEngineering/ReverseEngineeringMachineBoundUserInterface.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,75 @@ | ||
using Content.Shared.ReverseEngineering; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Nyanotrasen.ReverseEngineering; | ||
|
||
[UsedImplicitly] | ||
public sealed class ReverseEngineeringMachineBoundUserInterface : BoundUserInterface | ||
{ | ||
private ReverseEngineeringMachineMenu? _revMenu; | ||
|
||
public ReverseEngineeringMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_revMenu = new ReverseEngineeringMachineMenu(); | ||
|
||
_revMenu.OnClose += Close; | ||
_revMenu.OpenCentered(); | ||
|
||
_revMenu.OnScanButtonPressed += _ => | ||
{ | ||
SendMessage(new ReverseEngineeringMachineScanButtonPressedMessage()); | ||
}; | ||
|
||
_revMenu.OnSafetyButtonToggled += safetyArgs => | ||
{ | ||
SendMessage(new ReverseEngineeringMachineSafetyButtonToggledMessage(safetyArgs.Pressed)); | ||
}; | ||
|
||
_revMenu.OnAutoScanButtonToggled += autoArgs => | ||
{ | ||
SendMessage(new ReverseEngineeringMachineAutoScanButtonToggledMessage(autoArgs.Pressed)); | ||
}; | ||
|
||
_revMenu.OnStopButtonPressed += _ => | ||
{ | ||
SendMessage(new ReverseEngineeringMachineStopButtonPressedMessage()); | ||
}; | ||
|
||
_revMenu.OnEjectButtonPressed += _ => | ||
{ | ||
SendMessage(new ReverseEngineeringMachineEjectButtonPressedMessage()); | ||
}; | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
switch (state) | ||
{ | ||
case ReverseEngineeringMachineScanUpdateState msg: | ||
_revMenu?.SetButtonsDisabled(msg); | ||
_revMenu?.UpdateInformationDisplay(msg); | ||
_revMenu?.UpdateProbeTickProgressBar(msg); | ||
break; | ||
} | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (!disposing) | ||
return; | ||
|
||
_revMenu?.Dispose(); | ||
} | ||
} | ||
|
Oops, something went wrong.