Skip to content

Commit

Permalink
Merge branch 'master' into psionics
Browse files Browse the repository at this point in the history
Signed-off-by: PHCodes <[email protected]>
  • Loading branch information
PHCodes authored Oct 5, 2023
2 parents 3d416fa + 94dd919 commit 268273f
Show file tree
Hide file tree
Showing 174 changed files with 3,077 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:
changelog:
runs-on: ubuntu-latest
runs-on: self-hosted
if: github.event.pull_request.merged == true
permissions:
contents: write
Expand Down
48 changes: 48 additions & 0 deletions Content.Client/DeltaV/Hologram/HologramSystem.cs
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);
}
}
44 changes: 44 additions & 0 deletions Content.Client/Nyanotrasen/Overlays/DogVisionOverlay.cs
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);
}
}
51 changes: 51 additions & 0 deletions Content.Client/Nyanotrasen/Overlays/DogVisionSystem.cs
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);
}
}
}
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();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc 'reverse-engineering-machine-menu-title'}"
MinSize="620 280"
SetSize="620 280">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Margin="10 10 10 10" MinWidth="150" Orientation="Vertical" VerticalExpand="True" SizeFlagsStretchRatio="1">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<Button Name="ScanButton"
Text="{Loc 'reverse-engineering-machine-scan-button'}"
ToolTip="{Loc 'reverse-engineering-machine-scan-tooltip-info'}">
</Button>
<Button Name="SafetyButton"
Text="{Loc 'reverse-engineering-machine-safety-button'}"
ToolTip="{Loc 'reverse-engineering-machine-safety-tooltip-info'}"
ToggleMode="True">
</Button>
<Button Name="AutoScanButton"
Text="{Loc 'reverse-engineering-machine-autoscan-button'}"
ToolTip="{Loc 'reverse-engineering-machine-autoscan-tooltip-info'}"
ToggleMode="True">
</Button>
<Button Name="StopButton"
Text="{Loc 'reverse-engineering-machine-stop-button'}"
ToolTip="{Loc 'reverse-engineering-machine-stop-tooltip-info'}">
</Button>
<Button Name="EjectButton"
Text="{Loc 'reverse-engineering-machine-eject-button'}"
ToolTip="{Loc 'reverse-engineering-machine-eject-tooltip-info'}">
</Button>
<BoxContainer MinHeight="5"></BoxContainer>
</BoxContainer>
<BoxContainer Orientation="Vertical">
<Label Name="ProgressLabel"></Label>
<ProgressBar
Name="ProgressBar"
MinValue="0"
MaxValue="1"
SetHeight="20">
</ProgressBar>
<Label Name="TotalProgressLabel"></Label>
<ProgressBar
Name="TotalProgressBar"
MinValue="0"
MaxValue="1"
SetHeight="20">
</ProgressBar>
</BoxContainer>
</BoxContainer>
<customControls:VSeparator StyleClasses="LowDivider"/>
<PanelContainer Margin="10 10 10 10" HorizontalExpand="True" SizeFlagsStretchRatio="3">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000FF" />
</PanelContainer.PanelOverride>
<BoxContainer Margin="10 10 10 10" Orientation="Horizontal">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" >
<BoxContainer VerticalExpand="True">
<RichTextLabel Name="Information"> </RichTextLabel>
</BoxContainer>
</BoxContainer>
<BoxContainer VerticalExpand="False" Orientation="Vertical" MaxSize="64 64">
<SpriteView
Name="ItemDisplay"
OverrideDirection="South"
VerticalExpand="False"
SetSize="64 64"
MaxSize="64 64"
Scale="2 2">
</SpriteView>
</BoxContainer>
<BoxContainer VerticalExpand="True"></BoxContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
</controls:FancyWindow>
Loading

0 comments on commit 268273f

Please sign in to comment.