Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/upstream/master' into upst…
Browse files Browse the repository at this point in the history
…ream-sync

# Conflicts:
#	Resources/Prototypes/Accents/word_replacements.yml
#	Resources/Prototypes/Entities/Clothing/Shoes/boots.yml
#	Resources/Prototypes/Loadouts/loadout_groups.yml
#	Resources/Prototypes/Roles/Jobs/Security/detective.yml
#	Resources/Prototypes/Species/human.yml
#	Resources/ServerInfo/Guidebook/Antagonist/Traitors.xml
#	Resources/Textures/Clothing/Head/Helmets/security.rsi/equipped-HELMET.png
#	Resources/Textures/Clothing/Head/Helmets/security.rsi/icon.png
#	Resources/Textures/Clothing/Head/Helmets/security.rsi/inhand-left.png
#	Resources/Textures/Clothing/Head/Helmets/security.rsi/inhand-right.png
#	Resources/Textures/Structures/Wallmounts/signs.rsi/meta.json
  • Loading branch information
Morb0 committed Aug 23, 2024
2 parents ccb042d + 42078b4 commit 07a34aa
Show file tree
Hide file tree
Showing 243 changed files with 19,772 additions and 8,018 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />

<OptionButton Name="AlertLevelButton" StyleClasses="OpenRight" Access="Public" />
<OptionButton Name="AlertLevelButton" ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}" StyleClasses="OpenRight" Access="Public" />

<Control MinSize="10 10" />

<RichTextLabel Name="CountdownLabel" VerticalExpand="True" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" Access="Public" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}" Access="Public" />
</BoxContainer>
</controls:FancyWindow>
3 changes: 0 additions & 3 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
<ProjectReference Include="..\Corvax\Content.Corvax.Interfaces.Shared\Content.Corvax.Interfaces.Shared.csproj" />
<ProjectReference Include="..\Corvax\Content.Corvax.Interfaces.Client\Content.Corvax.Interfaces.Client.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Spawners\" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
</Project>
4 changes: 2 additions & 2 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private void OnToggleGhosts(EntityUid uid, GhostComponent component, ToggleGhost
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);

var locId = GhostVisibility ? "ghost-gui-toggle-ghost-visibility-popup-off" : "ghost-gui-toggle-ghost-visibility-popup-on";
Popup.PopupEntity(Loc.GetString(locId), args.Performer);
if (uid == _playerManager.LocalEntity)
ToggleGhostVisibility();

Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Launcher/LauncherConnecting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public sealed class LauncherConnecting : Robust.Client.State.State
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClipboardManager _clipboard = default!;

private LauncherConnectingGui? _control;

Expand Down Expand Up @@ -58,7 +59,7 @@ private set

protected override void Startup()
{
_control = new LauncherConnectingGui(this, _random, _prototypeManager, _cfg);
_control = new LauncherConnectingGui(this, _random, _prototypeManager, _cfg, _clipboard);

_userInterfaceManager.StateRoot.AddChild(_control);

Expand Down
35 changes: 26 additions & 9 deletions Content.Client/Launcher/LauncherConnectingGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,38 @@
<Control VerticalExpand="True" Margin="0 0 0 8">
<BoxContainer Orientation="Vertical" Name="ConnectingStatus">
<Label Text="{Loc 'connecting-in-progress'}" Align="Center" />
<!-- Who the fuck named these cont- oh wait I did -->
<Label Name="ConnectStatus" StyleClasses="LabelSubText" Align="Center" />
</BoxContainer>
<BoxContainer Orientation="Vertical" Name="ConnectFail" Visible="False">
<BoxContainer Orientation="Vertical" Name="ConnectFail" Visible="False" SeparationOverride="10">
<RichTextLabel Name="ConnectFailReason" VerticalAlignment="Stretch"/>
<Button Name="RetryButton" Text="{Loc 'connecting-retry'}"
HorizontalAlignment="Center"
VerticalExpand="True" VerticalAlignment="Bottom" />
<BoxContainer Orientation="Horizontal" Align="Center">
<Button Name="RetryButton"
Text="{Loc 'connecting-retry'}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StyleClasses="OpenRight"/>
<Button Name="CopyButton"
Text="{Loc 'connecting-copy'}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StyleClasses="OpenLeft"/>
</BoxContainer>
</BoxContainer>
<BoxContainer Orientation="Vertical" Name="Disconnected">
<BoxContainer Orientation="Vertical" Name="Disconnected" Visible="False" SeparationOverride="10">
<Label Text="{Loc 'connecting-disconnected'}" Align="Center" />
<Label Name="DisconnectReason" Align="Center" />
<Button Name="ReconnectButton" Text="{Loc 'connecting-reconnect'}"
HorizontalAlignment="Center"
VerticalExpand="True" VerticalAlignment="Bottom" />
<BoxContainer Orientation="Horizontal" Align="Center" VerticalAlignment="Bottom">
<Button Name="ReconnectButton"
Text="{Loc 'connecting-reconnect'}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StyleClasses="OpenRight"/>
<Button Name="CopyButtonDisconnected"
Text="{Loc 'connecting-copy'}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StyleClasses="OpenLeft"/>
</BoxContainer>
</BoxContainer>
</Control>
<Label Name="ConnectingAddress" StyleClasses="LabelSubText" HorizontalAlignment="Center" />
Expand Down
27 changes: 25 additions & 2 deletions Content.Client/Launcher/LauncherConnectingGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ public sealed partial class LauncherConnectingGui : Control
private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototype;
private readonly IConfigurationManager _cfg;
private readonly IClipboardManager _clipboard;

public LauncherConnectingGui(LauncherConnecting state, IRobustRandom random,
IPrototypeManager prototype, IConfigurationManager config)
IPrototypeManager prototype, IConfigurationManager config, IClipboardManager clipboard)
{
_state = state;
_random = random;
_prototype = prototype;
_cfg = config;
_clipboard = clipboard;

RobustXamlLoader.Load(this);

Expand All @@ -44,8 +46,11 @@ public LauncherConnectingGui(LauncherConnecting state, IRobustRandom random,
Stylesheet = IoCManager.Resolve<IStylesheetManager>().SheetSpace;

ChangeLoginTip();
ReconnectButton.OnPressed += ReconnectButtonPressed;
RetryButton.OnPressed += ReconnectButtonPressed;
ReconnectButton.OnPressed += ReconnectButtonPressed;

CopyButton.OnPressed += CopyButtonPressed;
CopyButtonDisconnected.OnPressed += CopyButtonDisconnectedPressed;
ExitButton.OnPressed += _ => _state.Exit();

var addr = state.Address;
Expand Down Expand Up @@ -78,6 +83,24 @@ private void ReconnectButtonPressed(BaseButton.ButtonEventArgs args)
_state.RetryConnect();
}

private void CopyButtonPressed(BaseButton.ButtonEventArgs args)
{
CopyText(ConnectFailReason.Text);
}

private void CopyButtonDisconnectedPressed(BaseButton.ButtonEventArgs args)
{
CopyText(DisconnectReason.Text);
}

private void CopyText(string? text)
{
if (!string.IsNullOrEmpty(text))
{
_clipboard.SetText(text);
}
}

private void ConnectFailReasonChanged(string? reason)
{
ConnectFailReason.SetMessage(reason == null
Expand Down
6 changes: 5 additions & 1 deletion Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl

public bool ShowIFF { get; set; } = true;
public bool ShowDocks { get; set; } = true;
public bool RotateWithEntity { get; set; } = true;

/// <summary>
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
Expand Down Expand Up @@ -109,6 +110,8 @@ public void UpdateState(NavInterfaceState state)

ActualRadarRange = Math.Clamp(ActualRadarRange, WorldMinRange, WorldMaxRange);

RotateWithEntity = state.RotateWithEntity;

_docks = state.Docks;
}

Expand Down Expand Up @@ -138,7 +141,8 @@ protected override void Draw(DrawingHandleScreen handle)
var mapPos = _transform.ToMapCoordinates(_coordinates.Value);
var offset = _coordinates.Value.Position;
var posMatrix = Matrix3Helpers.CreateTransform(offset, _rotation.Value);
var (_, ourEntRot, ourEntMatrix) = _transform.GetWorldPositionRotationMatrix(_coordinates.Value.EntityId);
var ourEntRot = RotateWithEntity ? _transform.GetWorldRotation(xform) : _rotation.Value;
var ourEntMatrix = Matrix3Helpers.CreateTransform(_transform.GetWorldPosition(xform), ourEntRot);
var ourWorldMatrix = Matrix3x2.Multiply(posMatrix, ourEntMatrix);
Matrix3x2.Invert(ourWorldMatrix, out var ourWorldMatrixInvert);

Expand Down
119 changes: 119 additions & 0 deletions Content.Client/Silicons/StationAi/StationAiOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System.Numerics;
using Content.Shared.Silicons.StationAi;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;

namespace Content.Client.Silicons.StationAi;

public sealed class StationAiOverlay : Overlay
{
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;

public override OverlaySpace Space => OverlaySpace.WorldSpace;

private readonly HashSet<Vector2i> _visibleTiles = new();

private IRenderTexture? _staticTexture;
private IRenderTexture? _stencilTexture;

public StationAiOverlay()
{
IoCManager.InjectDependencies(this);
}

protected override void Draw(in OverlayDrawArgs args)
{
if (_stencilTexture?.Texture.Size != args.Viewport.Size)
{
_staticTexture?.Dispose();
_stencilTexture?.Dispose();
_stencilTexture = _clyde.CreateRenderTarget(args.Viewport.Size, new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb), name: "station-ai-stencil");
_staticTexture = _clyde.CreateRenderTarget(args.Viewport.Size,
new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb),
name: "station-ai-static");
}

var worldHandle = args.WorldHandle;

var worldBounds = args.WorldBounds;

var playerEnt = _player.LocalEntity;
_entManager.TryGetComponent(playerEnt, out TransformComponent? playerXform);
var gridUid = playerXform?.GridUid ?? EntityUid.Invalid;
_entManager.TryGetComponent(gridUid, out MapGridComponent? grid);

var invMatrix = args.Viewport.GetWorldToLocalMatrix();

if (grid != null)
{
// TODO: Pass in attached entity's grid.
// TODO: Credit OD on the moved to code
// TODO: Call the moved-to code here.

_visibleTiles.Clear();
var lookups = _entManager.System<EntityLookupSystem>();
var xforms = _entManager.System<SharedTransformSystem>();
_entManager.System<StationAiVisionSystem>().GetView((gridUid, grid), worldBounds, _visibleTiles);

var gridMatrix = xforms.GetWorldMatrix(gridUid);
var matty = Matrix3x2.Multiply(gridMatrix, invMatrix);

// Draw visible tiles to stencil
worldHandle.RenderInRenderTarget(_stencilTexture!, () =>
{
worldHandle.SetTransform(matty);

foreach (var tile in _visibleTiles)
{
var aabb = lookups.GetLocalBounds(tile, grid.TileSize);
worldHandle.DrawRect(aabb, Color.White);
}
},
Color.Transparent);

// Once this is gucci optimise rendering.
worldHandle.RenderInRenderTarget(_staticTexture!,
() =>
{
worldHandle.SetTransform(invMatrix);
var shader = _proto.Index<ShaderPrototype>("CameraStatic").Instance();
worldHandle.UseShader(shader);
worldHandle.DrawRect(worldBounds, Color.White);
},
Color.Black);
}
// Not on a grid
else
{
worldHandle.RenderInRenderTarget(_stencilTexture!, () =>
{
},
Color.Transparent);

worldHandle.RenderInRenderTarget(_staticTexture!,
() =>
{
worldHandle.SetTransform(Matrix3x2.Identity);
worldHandle.DrawRect(worldBounds, Color.Black);
}, Color.Black);
}

// Use the lighting as a mask
worldHandle.UseShader(_proto.Index<ShaderPrototype>("StencilMask").Instance());
worldHandle.DrawTextureRect(_stencilTexture!.Texture, worldBounds);

// Draw the static
worldHandle.UseShader(_proto.Index<ShaderPrototype>("StencilDraw").Instance());
worldHandle.DrawTextureRect(_staticTexture!.Texture, worldBounds);

worldHandle.SetTransform(Matrix3x2.Identity);
worldHandle.UseShader(null);

}
}
80 changes: 80 additions & 0 deletions Content.Client/Silicons/StationAi/StationAiSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Content.Shared.Silicons.StationAi;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Silicons.StationAi;

public sealed partial class StationAiSystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayMgr = default!;
[Dependency] private readonly IPlayerManager _player = default!;

private StationAiOverlay? _overlay;

public override void Initialize()
{
base.Initialize();
// InitializeAirlock();
// InitializePowerToggle();

SubscribeLocalEvent<StationAiOverlayComponent, LocalPlayerAttachedEvent>(OnAiAttached);
SubscribeLocalEvent<StationAiOverlayComponent, LocalPlayerDetachedEvent>(OnAiDetached);
SubscribeLocalEvent<StationAiOverlayComponent, ComponentInit>(OnAiOverlayInit);
SubscribeLocalEvent<StationAiOverlayComponent, ComponentRemove>(OnAiOverlayRemove);
}

private void OnAiOverlayInit(Entity<StationAiOverlayComponent> ent, ref ComponentInit args)
{
var attachedEnt = _player.LocalEntity;

if (attachedEnt != ent.Owner)
return;

AddOverlay();
}

private void OnAiOverlayRemove(Entity<StationAiOverlayComponent> ent, ref ComponentRemove args)
{
var attachedEnt = _player.LocalEntity;

if (attachedEnt != ent.Owner)
return;

RemoveOverlay();
}

private void AddOverlay()
{
if (_overlay != null)
return;

_overlay = new StationAiOverlay();
_overlayMgr.AddOverlay(_overlay);
}

private void RemoveOverlay()
{
if (_overlay == null)
return;

_overlayMgr.RemoveOverlay(_overlay);
_overlay = null;
}

private void OnAiAttached(Entity<StationAiOverlayComponent> ent, ref LocalPlayerAttachedEvent args)
{
AddOverlay();
}

private void OnAiDetached(Entity<StationAiOverlayComponent> ent, ref LocalPlayerDetachedEvent args)
{
RemoveOverlay();
}

public override void Shutdown()
{
base.Shutdown();
_overlayMgr.RemoveOverlay<StationAiOverlay>();
}
}
Loading

0 comments on commit 07a34aa

Please sign in to comment.