Skip to content

Commit

Permalink
Merge pull request #526 from TheArturZh/upstream-merge-39
Browse files Browse the repository at this point in the history
Upstream merge 39
  • Loading branch information
DexlerXD authored Nov 25, 2023
2 parents 3601888 + 745c170 commit eb485ae
Show file tree
Hide file tree
Showing 655 changed files with 518,308 additions and 461,725 deletions.
1 change: 1 addition & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Robust.Shared.ContentPack;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Mapping;
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Alerts;
Expand Down
32 changes: 24 additions & 8 deletions Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.Chat.UI
{
Expand All @@ -13,7 +14,8 @@ public enum SpeechType : byte
{
Emote,
Say,
Whisper
Whisper,
Looc
}

/// <summary>
Expand Down Expand Up @@ -60,12 +62,15 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, Enti
case SpeechType.Whisper:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");

case SpeechType.Looc:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox", Color.FromHex("#48d1cc"));

default:
throw new ArgumentOutOfRangeException();
}
}

public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
{
_chatManager = chatManager;
_senderEntity = senderEntity;
Expand All @@ -75,7 +80,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;

var bubble = BuildBubble(text, speechStyleClass);
var bubble = BuildBubble(text, speechStyleClass, fontColor);

AddChild(bubble);

Expand All @@ -86,7 +91,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
_verticalOffsetAchieved = -ContentSize.Y;
}

protected abstract Control BuildBubble(string text, string speechStyleClass);
protected abstract Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null);

protected override void FrameUpdate(FrameEventArgs args)
{
Expand Down Expand Up @@ -164,18 +169,29 @@ public void FadeNow()

public sealed class TextSpeechBubble : SpeechBubble
{
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass)
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass, fontColor)
{
}

protected override Control BuildBubble(string text, string speechStyleClass)
protected override Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null)
{
var label = new RichTextLabel
{
MaxWidth = 256,
};
label.SetMessage(text);

if (fontColor != null)
{
var msg = new FormattedMessage();
msg.PushColor(fontColor.Value);
msg.AddMarkup(text);
label.SetMessage(msg);
}
else
{
label.SetMessage(text);
}

var panel = new PanelContainer
{
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/Construction/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Construction
Expand Down Expand Up @@ -197,7 +198,7 @@ public bool TrySpawnGhost(
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
comp.Prototype = prototype;
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
_ghosts.Add(ghost.Value.Id, ghost.Value);
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
sprite.Color = new Color(48, 255, 48, 128);

Expand Down Expand Up @@ -264,7 +265,7 @@ public void TryStartConstruction(EntityUid ghostId, ConstructionGhostComponent?
}

var transform = EntityManager.GetComponent<TransformComponent>(ghostId);
var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.Id);
var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.GetHashCode());
RaiseNetworkEvent(msg);
}

Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Construction/UI/ConstructionMenuPresenter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Linq;
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
using Content.Shared.Construction.Prototypes;
using Content.Shared.Tag;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Placement;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
Expand All @@ -25,6 +27,7 @@ internal sealed class ConstructionMenuPresenter : IDisposable
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

private readonly IConstructionMenuView _constructionView;

Expand Down Expand Up @@ -152,6 +155,11 @@ private void OnViewPopulateRecipes(object? sender, (string search, string catago
if (recipe.Hide)
continue;

if (_playerManager.LocalSession == null
|| _playerManager.LocalEntity == null
|| (recipe.EntityWhitelist != null && !recipe.EntityWhitelist.IsValid(_playerManager.LocalEntity.Value)))
continue;

if (!string.IsNullOrEmpty(search))
{
if (!recipe.Name.ToLowerInvariant().Contains(search.Trim().ToLowerInvariant()))
Expand Down
24 changes: 15 additions & 9 deletions Content.Client/Decals/DecalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public sealed class DecalSystem : SharedDecalSystem

private DecalOverlay _overlay = default!;

private HashSet<uint> _removedUids = new();
private readonly List<Vector2i> _removedChunks = new();

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -65,26 +68,27 @@ private void OnHandleState(EntityUid gridUid, DecalGridComponent gridComp, ref C
return;

// is this a delta or full state?
var removedChunks = new List<Vector2i>();
_removedChunks.Clear();

if (!state.FullState)
{
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
if (!state.AllChunks!.Contains(key))
removedChunks.Add(key);
_removedChunks.Add(key);
}
}
else
{
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
if (!state.Chunks.ContainsKey(key))
removedChunks.Add(key);
_removedChunks.Add(key);
}
}

if (removedChunks.Count > 0)
RemoveChunks(gridUid, gridComp, removedChunks);
if (_removedChunks.Count > 0)
RemoveChunks(gridUid, gridComp, _removedChunks);

if (state.Chunks.Count > 0)
UpdateChunks(gridUid, gridComp, state.Chunks);
Expand Down Expand Up @@ -137,9 +141,10 @@ private void UpdateChunks(EntityUid gridId, DecalGridComponent gridComp, Diction
{
if (chunkCollection.TryGetValue(indices, out var chunk))
{
var removedUids = new HashSet<uint>(chunk.Decals.Keys);
removedUids.ExceptWith(newChunkData.Decals.Keys);
foreach (var removedUid in removedUids)
_removedUids.Clear();
_removedUids.UnionWith(chunk.Decals.Keys);
_removedUids.ExceptWith(newChunkData.Decals.Keys);
foreach (var removedUid in _removedUids)
{
OnDecalRemoved(gridId, removedUid, gridComp, indices, chunk);
gridComp.DecalIndex.Remove(removedUid);
Expand All @@ -166,7 +171,8 @@ private void RemoveChunks(EntityUid gridId, DecalGridComponent gridComp, IEnumer

foreach (var index in chunks)
{
if (!chunkCollection.TryGetValue(index, out var chunk)) continue;
if (!chunkCollection.TryGetValue(index, out var chunk))
continue;

foreach (var decalId in chunk.Decals.Keys)
{
Expand Down
13 changes: 7 additions & 6 deletions Content.Client/Decals/Overlays/DecalOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,22 @@ protected override void Draw(in OverlayDrawArgs args)
{
// Shouldn't need to clear cached textures unless the prototypes get reloaded.
var handle = args.WorldHandle;
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
var xformSystem = _entManager.System<TransformSystem>();
var eyeAngle = args.Viewport.Eye?.Rotation ?? Angle.Zero;

foreach (var (decalGrid, xform) in _entManager.EntityQuery<DecalGridComponent, TransformComponent>(true))
var gridQuery = _entManager.AllEntityQueryEnumerator<DecalGridComponent, TransformComponent>();

while (gridQuery.MoveNext(out var decalGrid, out var xform))
{
if (xform.MapID != args.MapId)
continue;

var zIndexDictionary = decalGrid.DecalRenderIndex;

if (zIndexDictionary.Count == 0)
continue;

if (xform.MapID != args.MapId)
continue;

var (_, worldRot, worldMatrix) = xformSystem.GetWorldPositionRotationMatrix(xform, xformQuery);
var (_, worldRot, worldMatrix) = xformSystem.GetWorldPositionRotationMatrix(xform);

handle.SetTransform(worldMatrix);

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Drugs/DrugOverlaySystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Drugs;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Drugs;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Drunk/DrunkSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Drunk;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Drunk;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/Blinding/BlindingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Robust.Client.Player;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.GameTicking;
using Robust.Shared.Player;

namespace Content.Client.Eye.Blinding;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/Blinding/BlurryVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Eye.Blinding.Components;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Eye.Blinding;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/EyeLerpingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Physics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Client.Eye;
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ protected override void Open()
{
base.Open();

_window = new GatewayWindow();
_window = new GatewayWindow(EntMan.GetNetEntity(Owner));

_window.OpenPortal += destination =>
{
SendMessage(new GatewayOpenPortalMessage(destination));
Expand Down
25 changes: 20 additions & 5 deletions Content.Client/Gateway/UI/GatewayWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@
Title="{Loc 'gateway-window-title'}"
MinSize="800 360">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Name="NextCloseLabel"
Text="{Loc 'gateway-window-portal-closing'}"
Margin="5"></Label>
<ProgressBar Name="NextCloseBar"
<BoxContainer Orientation="Horizontal">
<!-- This is wide as shit but makes it consistent with the cooldown label +
handles localisations a bit better -->
<Label Name="NextUnlockLabel"
Text="{Loc 'gateway-window-portal-unlock'}"
Margin="5"
SetWidth="128"/>
<ProgressBar Name="NextUnlockBar"
HorizontalExpand="True"
MinValue="0"
MaxValue="1"
SetHeight="25"/>
<Label Name="NextUnlockText" Text="0" Margin="5"/>
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Name="NextReadyLabel"
Text="{Loc 'gateway-window-portal-cooldown'}"
Margin="5"
SetWidth="128"/>
<ProgressBar Name="NextReadyBar"
HorizontalExpand="True"
MinValue="0"
MaxValue="1"
Expand Down
Loading

0 comments on commit eb485ae

Please sign in to comment.