Skip to content

Commit

Permalink
Merge pull request #492 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored Feb 27, 2024
2 parents 781d6fd + 3aa6b86 commit cc2a875
Show file tree
Hide file tree
Showing 843 changed files with 9,417 additions and 2,953 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
private SharedTransformSystem? _xformSystem = null;


private readonly SpawnExplosionEui _eui;
Expand Down Expand Up @@ -102,9 +103,13 @@ private void SetLocation()
if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform))
return;

_xformSystem ??= _entMan.SystemOrNull<SharedTransformSystem>();
if (_xformSystem is null)
return;

_pausePreview = true;
MapOptions.Select(_mapData.IndexOf(transform.MapID));
(MapX.Value, MapY.Value) = transform.MapPosition.Position;
(MapX.Value, MapY.Value) = _xformSystem.GetWorldPosition(transform);
_pausePreview = false;

UpdatePreview();
Expand Down
10 changes: 7 additions & 3 deletions Content.Client/Atmos/Overlays/GasTileOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed class GasTileOverlay : Overlay
{
private readonly IEntityManager _entManager;
private readonly IMapManager _mapManager;
private readonly SharedTransformSystem _xformSystem;

public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
private readonly ShaderInstance _shader;
Expand Down Expand Up @@ -51,6 +52,7 @@ public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IR
{
_entManager = entManager;
_mapManager = IoCManager.Resolve<IMapManager>();
_xformSystem = _entManager.System<SharedTransformSystem>();
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
ZIndex = GasOverlayZIndex;

Expand Down Expand Up @@ -156,7 +158,8 @@ protected override void Draw(in OverlayDrawArgs args)
_fireFrameCounter,
_shader,
overlayQuery,
xformQuery);
xformQuery,
_xformSystem);

var mapUid = _mapManager.GetMapEntityId(args.MapId);

Expand Down Expand Up @@ -194,15 +197,16 @@ protected override void Draw(in OverlayDrawArgs args)
int[] fireFrameCounter,
ShaderInstance shader,
EntityQuery<GasTileOverlayComponent> overlayQuery,
EntityQuery<TransformComponent> xformQuery) state) =>
EntityQuery<TransformComponent> xformQuery,
SharedTransformSystem xformSystem) state) =>
{
if (!state.overlayQuery.TryGetComponent(uid, out var comp) ||
!state.xformQuery.TryGetComponent(uid, out var gridXform))
{
return true;
}

var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invMatrix) = state.xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
state.drawHandle.SetTransform(worldMatrix);
var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize);
var localBounds = new Box2i(
Expand Down
33 changes: 0 additions & 33 deletions Content.Client/Backmen/Chat/ShadowkinChatUpdateSystem.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Content.Client/CardboardBox/CardboardBoxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg)
if (!xformQuery.TryGetComponent(source, out var xform))
return;

var sourcePos = _transform.GetMapCoordinates(source, xform);
var sourcePos = _transform.GetMapCoordinates((source, xform));

//Any mob that can move should be surprised?
//God mind rework needs to come faster so it can just check for mind
Expand Down
50 changes: 0 additions & 50 deletions Content.Client/CartridgeLoader/Cartridges/NewsReadUi.cs

This file was deleted.

54 changes: 54 additions & 0 deletions Content.Client/CartridgeLoader/Cartridges/NewsReaderUi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Content.Client.UserInterface.Fragments;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.CartridgeLoader;
using Robust.Client.UserInterface;

namespace Content.Client.CartridgeLoader.Cartridges;

public sealed partial class NewsReaderUi : UIFragment
{
private NewsReaderUiFragment? _fragment;

public override Control GetUIFragmentRoot()
{
return _fragment!;
}

public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner)
{
_fragment = new NewsReaderUiFragment();

_fragment.OnNextButtonPressed += () =>
{
SendNewsReaderMessage(NewsReaderUiAction.Next, userInterface);
};
_fragment.OnPrevButtonPressed += () =>
{
SendNewsReaderMessage(NewsReaderUiAction.Prev, userInterface);
};
_fragment.OnNotificationSwithPressed += () =>
{
SendNewsReaderMessage(NewsReaderUiAction.NotificationSwitch, userInterface);
};
}

public override void UpdateState(BoundUserInterfaceState state)
{
switch (state)
{
case NewsReaderBoundUserInterfaceState cast:
_fragment?.UpdateState(cast.Article, cast.TargetNum, cast.TotalNum, cast.NotificationOn);
break;
case NewsReaderEmptyBoundUserInterfaceState empty:
_fragment?.UpdateEmptyState(empty.NotificationOn);
break;
}
}

private void SendNewsReaderMessage(NewsReaderUiAction action, BoundUserInterface userInterface)
{
var newsMessage = new NewsReaderUiMessageEvent(action);
var message = new CartridgeUiMessage(newsMessage);
userInterface.SendMessage(message);
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
<cartridges:NewsReadUiFragment xmlns:cartridges="clr-namespace:Content.Client.CartridgeLoader.Cartridges"
<cartridges:NewsReaderUiFragment xmlns:cartridges="clr-namespace:Content.Client.CartridgeLoader.Cartridges"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns="https://spacestation14.io" Margin="1 0 2 0">
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns="https://spacestation14.io"
Margin="1 0 2 0"
Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5,5,5,5">
<Button
Name="Prev"
MinWidth="64"
Disabled="True"
HorizontalAlignment="Left"
Text="{Loc 'news-read-ui-past-text'}"
Text="{Loc 'news-read-ui-prev-text'}"
ToolTip="{Loc 'news-read-ui-prev-tooltip'}"
Access="Public"
HorizontalExpand="True"/>
<Button
Name="Next"
MinWidth="64"
Disabled="True"
HorizontalAlignment="Right"
Text="{Loc 'news-read-ui-next-text'}" />
Text="{Loc 'news-read-ui-next-text'}"
ToolTip="{Loc 'news-read-ui-next-tooltip'}"/>
</BoxContainer>
<controls:StripeBack Name="АrticleNameContainer">
<PanelContainer>
Expand Down Expand Up @@ -46,9 +55,11 @@
</PanelContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5,5,5,5">
<Button
Name="NotificationSwith"
Name="NotificationSwitch"
ToolTip="{Loc news-reader-ui-mute-tooltip}"
MinWidth="20"/>
<RichTextLabel Margin="5,2,2,2" Name="ShareTime" VerticalAlignment="Top"/>
<customControls:VSeparator Margin="2 0"/>
<RichTextLabel Margin="5,2,2,2" Name="Author" VerticalAlignment="Top" HorizontalAlignment="Right"/>
</BoxContainer>
</cartridges:NewsReadUiFragment>
</cartridges:NewsReaderUiFragment>
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,20 @@
namespace Content.Client.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class NewsReadUiFragment : BoxContainer
public sealed partial class NewsReaderUiFragment : BoxContainer
{
public event Action? OnNextButtonPressed;
public event Action? OnPrevButtonPressed;

public event Action? OnNotificationSwithPressed;

public NewsReadUiFragment()
public NewsReaderUiFragment()
{
RobustXamlLoader.Load(this);
Orientation = LayoutOrientation.Vertical;
HorizontalExpand = true;
VerticalExpand = true;

Next.OnPressed += _ => OnNextButtonPressed?.Invoke();
Prev.OnPressed += _ => OnPrevButtonPressed?.Invoke();
NotificationSwith.OnPressed += _ => OnNotificationSwithPressed?.Invoke();
NotificationSwitch.OnPressed += _ => OnNotificationSwithPressed?.Invoke();
}

public void UpdateState(NewsArticle article, int targetNum, int totalNum, bool notificationOn)
Expand All @@ -33,17 +30,20 @@ public void UpdateState(NewsArticle article, int targetNum, int totalNum, bool n
ShareTime.Visible = true;
Author.Visible = true;

PageName.Text = article.Name;
PageName.Text = article.Title;
PageText.SetMarkup(article.Content);

PageNum.Text = $"{targetNum}/{totalNum}";

NotificationSwith.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off");
NotificationSwitch.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off");

string shareTime = article.ShareTime.ToString("hh\\:mm\\:ss");
string shareTime = article.ShareTime.ToString(@"hh\:mm\:ss");
ShareTime.SetMarkup(Loc.GetString("news-read-ui-time-prefix-text") + " " + shareTime);

Author.SetMarkup(Loc.GetString("news-read-ui-author-prefix") + " " + (article.Author != null ? article.Author : Loc.GetString("news-read-ui-no-author")));

Prev.Disabled = targetNum <= 1;
Next.Disabled = targetNum >= totalNum;
}

public void UpdateEmptyState(bool notificationOn)
Expand All @@ -55,6 +55,6 @@ public void UpdateEmptyState(bool notificationOn)

PageName.Text = Loc.GetString("news-read-ui-not-found-text");

NotificationSwith.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off");
NotificationSwitch.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off");
}
}
6 changes: 0 additions & 6 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"tsay \"{CommandParsing.Escape(str)}\"");
break;

// Parkstation-Shadowkin chat start
case ChatSelectChannel.Empathy:
_consoleHost.ExecuteCommand($"esay \"{CommandParsing.Escape(str)}\"");
break;
// Parkstation-Shadowkin chat end

default:
throw new ArgumentOutOfRangeException(nameof(channel), channel, null);
}
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public abstract class SpeechBubble : Control
{
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;

public enum SpeechType : byte
Expand Down Expand Up @@ -82,6 +83,7 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, ChatMessage messa
public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null)
{
IoCManager.InjectDependencies(this);
_xformSystem = _entityManager.System<SharedTransformSystem>();
_senderEntity = senderEntity;

// Use text clipping so new messages don't overlap old ones being pushed up.
Expand Down Expand Up @@ -140,7 +142,7 @@ protected override void FrameUpdate(FrameEventArgs args)
}

var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
var worldPos = xform.WorldPosition + offset;
var worldPos = _xformSystem.GetWorldPosition(xform) + offset;

var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
Expand Down
15 changes: 15 additions & 0 deletions Content.Client/Chemistry/UI/InjectorStatusControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Client.Stylesheets;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
Expand All @@ -14,6 +15,10 @@ public sealed class InjectorStatusControl : Control
private readonly SharedSolutionContainerSystem _solutionContainers;
private readonly RichTextLabel _label;

private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume;
private InjectorToggleMode PrevToggleState;

public InjectorStatusControl(Entity<InjectorComponent> parent, SharedSolutionContainerSystem solutionContainers)
{
_parent = parent;
Expand All @@ -29,6 +34,16 @@ protected override void FrameUpdate(FrameEventArgs args)
if (!_solutionContainers.TryGetSolution(_parent.Owner, InjectorComponent.SolutionName, out _, out var solution))
return;

// only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume
&& PrevToggleState == _parent.Comp.ToggleState)
return;

PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume;
PrevToggleState = _parent.Comp.ToggleState;

// Update current volume and injector state
var modeStringLocalized = Loc.GetString(_parent.Comp.ToggleState switch
{
Expand Down
Loading

0 comments on commit cc2a875

Please sign in to comment.