Skip to content

Commit

Permalink
Merge pull request #508 from TheArturZh/upstream-merge-38
Browse files Browse the repository at this point in the history
Upstream merge 38
  • Loading branch information
DexlerXD authored Nov 10, 2023
2 parents 27ee7d1 + e2f3bb3 commit 95d2267
Show file tree
Hide file tree
Showing 908 changed files with 145,552 additions and 141,266 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ jobs:
cd RobustToolbox
git fetch --depth=1
- name: Package all
run: |
Tools/package_server_build.py -p win-x64 linux-x64 osx-x64 linux-arm64
Tools/package_client_build.py
- name: Install dependencies
run: dotnet restore

- name: Build Packaging
run: dotnet build Content.Packaging --configuration Release --no-restore /m

- name: Package server
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64

- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ jobs:
- name: Install dependencies
run: dotnet restore

- name: Package client
run: |
Tools/package_server_build.py -p win-x64 linux-x64 osx-x64 linux-arm64
Tools/package_client_build.py
- name: Build Packaging
run: dotnet build Content.Packaging --configuration Release --no-restore /m

- name: Package server
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64

- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, Ba
component.ClientExclusive = state.ClientExclusive;
component.Priority = state.Priority;
component.AttachedEntity = EnsureEntity<T>(state.AttachedEntity, uid);
component.RaiseOnUser = state.RaiseOnUser;
component.AutoPopulate = state.AutoPopulate;
component.Temporary = state.Temporary;
component.ItemIconStyle = state.ItemIconStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? d
}
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
{
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
[GenerateTypedNameReferences]
public sealed partial class PlayerTab : Control
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;

private const string ArrowUp = "↑";
private const string ArrowDown = "↓";
private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
private IEntityManager _entManager;
private readonly AdminSystem _adminSystem;
private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();

Expand All @@ -30,7 +32,7 @@ public sealed partial class PlayerTab : Control

public PlayerTab()
{
_entManager = IoCManager.Resolve<IEntityManager>();
IoCManager.InjectDependencies(this);
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
RefreshPlayerList(_adminSystem.PlayerList);
Expand Down Expand Up @@ -95,13 +97,11 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
foreach (var child in PlayerList.Children.ToArray())
{
if (child is PlayerTabEntry)
child.Orphan();
child.Dispose();
}

_players = players;

var playerManager = IoCManager.Resolve<IPlayerManager>();
PlayerCount.Text = $"Players: {playerManager.PlayerCount}";
PlayerCount.Text = $"Players: {_playerMan.PlayerCount}";

var sortedPlayers = new List<PlayerInfo>(players);
sortedPlayers.Sort(Compare);
Expand Down
34 changes: 21 additions & 13 deletions Content.Client/DoAfter/DoAfterOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Diagnostics;
using System.Numerics;
using Content.Shared.DoAfter;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
using Robust.Client.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
Expand All @@ -16,12 +16,12 @@ public sealed class DoAfterOverlay : Overlay
{
private readonly IEntityManager _entManager;
private readonly IGameTiming _timing;
private readonly IPlayerManager _player;
private readonly SharedTransformSystem _transform;
private readonly MetaDataSystem _meta;

private readonly Texture _barTexture;
private readonly ShaderInstance _shader;
private readonly IPlayerManager _player; // SS220 Invisible-DoAfter

/// <summary>
/// Flash time for cancelled DoAfters
Expand All @@ -38,9 +38,10 @@ public DoAfterOverlay(IEntityManager entManager, IPrototypeManager protoManager,
{
_entManager = entManager;
_timing = timing;
_player = player;
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
_meta = _entManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
var sprite = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
var sprite = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);
_player = player; // SS220 Invisible-DoAfter

Expand All @@ -64,6 +65,7 @@ protected override void Draw(in OverlayDrawArgs args)
var curTime = _timing.CurTime;

var bounds = args.WorldAABB.Enlarged(5f);
var localEnt = _player.LocalSession?.AttachedEntity;

var metaQuery = _entManager.GetEntityQuery<MetaDataComponent>();
var enumerator = _entManager.AllEntityQueryEnumerator<ActiveDoAfterComponent, DoAfterComponent, SpriteComponent, TransformComponent>();
Expand Down Expand Up @@ -94,10 +96,16 @@ protected override void Draw(in OverlayDrawArgs args)

foreach (var doAfter in comp.DoAfters.Values)
{
// SS220 Invisible-DoAfter begin
if (doAfter.Args.VisibleOnlyToUser && _entManager.GetEntity(doAfter.Args.NetUser) != controlled)
continue;
// SS220 Invisible-DoAfter end
// Hide some DoAfters from other players for stealthy actions (ie: thieving gloves)
var alpha = 1f;
if (doAfter.Args.Hidden)
{
if (uid != localEnt)
continue;

// Hints to the local player that this do-after is not visible to other players.
alpha = 0.5f;
}

// Use the sprite itself if we know its bounds. This means short or tall sprites don't get overlapped
// by the bar.
Expand All @@ -119,15 +127,15 @@ protected override void Draw(in OverlayDrawArgs args)
{
var elapsed = doAfter.CancelledTime.Value - doAfter.StartTime;
elapsedRatio = (float) Math.Min(1, elapsed.TotalSeconds / doAfter.Args.Delay.TotalSeconds);
var cancelElapsed = (time - doAfter.CancelledTime.Value).TotalSeconds;
var cancelElapsed = (time - doAfter.CancelledTime.Value).TotalSeconds;
var flash = Math.Floor(cancelElapsed / FlashTime) % 2 == 0;
color = new Color(1f, 0f, 0f, flash ? 1f : 0f);
color = new Color(1f, 0f, 0f, flash ? alpha : 0f);
}
else
{
var elapsed = time - doAfter.StartTime;
elapsedRatio = (float) Math.Min(1, elapsed.TotalSeconds / doAfter.Args.Delay.TotalSeconds);
color = GetProgressColor(elapsedRatio);
color = GetProgressColor(elapsedRatio, alpha);
}

var xProgress = (EndX - StartX) * elapsedRatio + StartX;
Expand All @@ -142,14 +150,14 @@ protected override void Draw(in OverlayDrawArgs args)
handle.SetTransform(Matrix3.Identity);
}

public static Color GetProgressColor(float progress)
public static Color GetProgressColor(float progress, float alpha = 1f)
{
if (progress >= 1.0f)
{
return new Color(0f, 1f, 0f);
return new Color(0f, 1f, 0f, alpha);
}
// lerp
var hue = (5f / 18f) * progress;
return Color.FromHsv((hue, 1f, 0.75f, 1f));
return Color.FromHsv((hue, 1f, 0.75f, alpha));
}
}
43 changes: 43 additions & 0 deletions Content.Client/Overlays/ShowSyndicateIconsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Content.Shared.Overlays;
using Content.Shared.StatusIcon.Components;
using Content.Shared.NukeOps;
using Content.Shared.StatusIcon;
using Robust.Shared.Prototypes;

namespace Content.Client.Overlays;
public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateIconsComponent>
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NukeOperativeComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent nukeOperativeComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
{
return;
}

var healthIcons = SyndicateIcon(uid, nukeOperativeComponent);

args.StatusIcons.AddRange(healthIcons);
}

private IReadOnlyList<StatusIconPrototype> SyndicateIcon(EntityUid uid, NukeOperativeComponent nukeOperativeComponent)
{
var result = new List<StatusIconPrototype>();

if (_prototype.TryIndex<StatusIconPrototype>(nukeOperativeComponent.SyndStatusIcon, out var syndicateicon))
{
result.Add(syndicateicon);
}

return result;
}
}

7 changes: 1 addition & 6 deletions Content.Client/Parallax/Data/ParallaxPrototype.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Collections.Generic;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Utility;

namespace Content.Client.Parallax.Data;

/// <summary>
/// Prototype data for a parallax.
/// </summary>
[Prototype("parallax")]
public sealed class ParallaxPrototype : IPrototype
public sealed partial class ParallaxPrototype : IPrototype
{
/// <inheritdoc/>
[IdDataField]
Expand Down
49 changes: 34 additions & 15 deletions Content.Client/Storage/UI/StorageWindow.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System.Numerics;
using Robust.Client.GameObjects;
using Content.Client.Items.Systems;
using Content.Client.Message;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.IdentityManagement;
using Content.Shared.Item;
using Content.Shared.Stacks;
using Content.Shared.Storage;
using Content.Shared.Storage.EntitySystems;
using Robust.Client.UserInterface;
using Robust.Shared.Containers;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using Direction = Robust.Shared.Maths.Direction;

Expand All @@ -23,7 +23,10 @@ public sealed class StorageWindow : FancyWindow
{
private readonly IEntityManager _entityManager;

private readonly Label _information;
private readonly SharedStorageSystem _storage;
private readonly ItemSystem _item;

private readonly RichTextLabel _information;
public readonly ContainerButton StorageContainerButton;
public readonly ListContainer EntityList;
private readonly StyleBoxFlat _hoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.35f) };
Expand All @@ -32,6 +35,8 @@ public sealed class StorageWindow : FancyWindow
public StorageWindow(IEntityManager entityManager)
{
_entityManager = entityManager;
_storage = _entityManager.System<SharedStorageSystem>();
_item = _entityManager.System<ItemSystem>();
SetSize = new Vector2(240, 320);
Title = Loc.GetString("comp-storage-window-title");
RectClipContent = true;
Expand Down Expand Up @@ -60,11 +65,14 @@ public StorageWindow(IEntityManager entityManager)

StorageContainerButton.AddChild(vBox);

_information = new Label
_information = new RichTextLabel
{
Text = Loc.GetString("comp-storage-window-volume", ("itemCount", 0), ("usedVolume", 0), ("maxVolume", 0)),
VerticalAlignment = VAlignment.Center
};
_information.SetMessage(Loc.GetString("comp-storage-window-weight",
("weight", 0),
("maxWeight", 0),
("size", _item.GetItemSizeLocale(SharedStorageSystem.DefaultStorageMaxItemSize))));

vBox.AddChild(_information);

Expand Down Expand Up @@ -101,15 +109,25 @@ public void BuildEntityList(EntityUid entity, StorageComponent component)

EntityList.PopulateList(list);

// Sets information about entire storage container current capacity
if (component.StorageCapacityMax != 0)
SetStorageInformation((entity, component));
}

private void SetStorageInformation(Entity<StorageComponent> uid)
{
//todo: text is the straight agenda. What about anything else?
if (uid.Comp.MaxSlots == null)
{
_information.Text = Loc.GetString("comp-storage-window-volume", ("itemCount", storedCount),
("usedVolume", component.StorageUsed), ("maxVolume", component.StorageCapacityMax));
_information.SetMarkup(Loc.GetString("comp-storage-window-weight",
("weight", _storage.GetCumulativeItemSizes(uid, uid.Comp)),
("maxWeight", uid.Comp.MaxTotalWeight),
("size", _item.GetItemSizeLocale(_storage.GetMaxItemSize((uid, uid.Comp))))));
}
else
{
_information.Text = Loc.GetString("comp-storage-window-volume-unlimited", ("itemCount", storedCount));
_information.SetMarkup(Loc.GetString("comp-storage-window-slots",
("itemCount", uid.Comp.Container.ContainedEntities.Count),
("maxCount", uid.Comp.MaxSlots),
("size", _item.GetItemSizeLocale(_storage.GetMaxItemSize((uid, uid.Comp))))));
}
}

Expand All @@ -122,10 +140,9 @@ public void GenerateButton(ListData data, ListContainerButton button)
|| !_entityManager.EntityExists(entity))
return;

_entityManager.TryGetComponent(entity, out ItemComponent? item);
_entityManager.TryGetComponent(entity, out StackComponent? stack);
_entityManager.TryGetComponent(entity, out ItemComponent? item);
var count = stack?.Count ?? 1;
var size = item?.Size;

var spriteView = new SpriteView
{
Expand All @@ -147,12 +164,14 @@ public void GenerateButton(ListData data, ListContainerButton button)
HorizontalExpand = true,
ClipText = true,
Text = _entityManager.GetComponent<MetaDataComponent>(Identity.Entity(entity, _entityManager)).EntityName +
(count > 1 ? $" x {count}" : string.Empty),
(count > 1 ? $" x {count}" : string.Empty)
},
new Label
{
Align = Label.AlignMode.Right,
Text = size.ToString() ?? Loc.GetString("comp-storage-no-item-size"),
Text = item?.Size != null
? $"{_item.GetItemSizeWeight(item.Size)}"
: Loc.GetString("comp-storage-no-item-size")
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class ToggleableLightVisualsComponent : Component
/// Sprite layer that will have its visibility toggled when this item is toggled.
/// </summary>
[DataField("spriteLayer")]
public string SpriteLayer = "light";
public string? SpriteLayer = "light";

/// <summary>
/// Layers to add to the sprite of the player that is holding this entity (while the component is toggled on).
Expand Down
Loading

0 comments on commit 95d2267

Please sign in to comment.