Skip to content

Commit

Permalink
Merge branch 'master-ru' of git.arumoon.ru:Workbench-Team/space-stati…
Browse files Browse the repository at this point in the history
…on-14 into arumoon-server
  • Loading branch information
AruMoon committed Jul 30, 2023
2 parents 9ee95cd + 95bee51 commit bcd147e
Show file tree
Hide file tree
Showing 212 changed files with 5,067 additions and 479 deletions.
15 changes: 13 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
/Content.*/Administration/ @moonheart08 @PaulRitter @DrSmugleaf @Chief-Engineer
/Content.*/Station/ @moonheart08
/Content.*/Maps/ @moonheart08
/Content.*/GameTicking/ @moonheart08
/Content.*/GameTicking/ @moonheart08 @EmoGarbage404
/Resources/ServerInfo/ @moonheart08 @Chief-Engineer
/Resources/ServerInfo/Guidebook/ @moonheart08
/Resources/ServerInfo/Guidebook/ @moonheart08 @EmoGarbage404
/Resources/engineCommandPerms.yml @moonheart08 @Chief-Engineer
/Resources/clientCommandPerms.yml @moonheart08 @Chief-Engineer
/Resources/Prototypes/species.yml @moonheart08
Expand Down Expand Up @@ -39,6 +39,17 @@
/Content.*/Actions/ @ElectroJr
/Content.*/Explosion/ @ElectroJr

/Content.*/Anomaly/ @EmoGarbage404
/Content.*/Lathe/ @EmoGarbage404
/Content.*/Materials/ @EmoGarbage404
/Content.*/Mech/ @EmoGarbage404
/Content.*/Research/ @EmoGarbage404
/Content.*/Stack/ @EmoGarbage404
/Content.*/Xenoarchaeology/ @EmoGarbage404
/Content.*/Zombies/ @EmoGarbage404
/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml @EmoGarbage404
/Resources/Prototypes/Research/ @EmoGarbage404

/Content.YAMLLinter @PaulRitter @DrSmugleaf
/Content.*/Inventory @PaulRitter
/Content.*/Arcade @PaulRitter
Expand Down
9 changes: 8 additions & 1 deletion Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ protected override void Open()
{
base.Open();

_window = new AgentIDCardWindow();
_window?.Dispose();
_window = new AgentIDCardWindow(this);
if (State != null)
UpdateState(State);

Expand All @@ -39,6 +40,11 @@ private void OnJobChanged(string newJob)
SendMessage(new AgentIDCardJobChangedMessage(newJob));
}

public void OnJobIconChanged(string newJobIcon)
{
SendMessage(new AgentIDCardJobIconChangedMessage(newJobIcon));
}

/// <summary>
/// Update the UI state based on server-sent info
/// </summary>
Expand All @@ -51,6 +57,7 @@ protected override void UpdateState(BoundUserInterfaceState state)

_window.SetCurrentName(cast.CurrentName);
_window.SetCurrentJob(cast.CurrentJob);
_window.SetAllowedIcons(cast.Icons);
}

protected override void Dispose(bool disposing)
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Access/UI/AgentIDCardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@
<LineEdit Name="NameLineEdit" />
<Label Name="CurrentJob" Text="{Loc 'agent-id-card-current-job'}" />
<LineEdit Name="JobLineEdit" />
<BoxContainer Orientation="Horizontal" Visible="False">
<Label Text="{Loc 'agent-id-card-job-icon-label'}"/>
<Control HorizontalExpand="True" MinSize="50 0"/>
<GridContainer Name="IconGrid" Columns="10">
<!-- Job icon buttons are generated in the code -->
</GridContainer>
</BoxContainer>
</BoxContainer>
</DefaultWindow>
66 changes: 64 additions & 2 deletions Content.Client/Access/UI/AgentIDCardWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
using Robust.Client.UserInterface.CustomControls;
using Content.Client.Stylesheets;
using Content.Shared.StatusIcon;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client.Access.UI
{
[GenerateTypedNameReferences]
public sealed partial class AgentIDCardWindow : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
private readonly SpriteSystem _spriteSystem;
private readonly AgentIDCardBoundUserInterface _bui;

private const int JobIconColumnCount = 10;

public event Action<string>? OnNameChanged;
public event Action<string>? OnJobChanged;

public AgentIDCardWindow()
public AgentIDCardWindow(AgentIDCardBoundUserInterface bui)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_spriteSystem = _entitySystem.GetEntitySystem<SpriteSystem>();
_bui = bui;

NameLineEdit.OnTextEntered += e => OnNameChanged?.Invoke(e.Text);
NameLineEdit.OnFocusExit += e => OnNameChanged?.Invoke(e.Text);
Expand All @@ -21,6 +38,51 @@ public AgentIDCardWindow()
JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text);
}

public void SetAllowedIcons(HashSet<string> icons)
{
IconGrid.DisposeAllChildren();

var jobIconGroup = new ButtonGroup();
var i = 0;
foreach (var jobIconId in icons)
{
if (!_prototypeManager.TryIndex<StatusIconPrototype>(jobIconId, out var jobIcon))
{
continue;
}

String styleBase = StyleBase.ButtonOpenBoth;
var modulo = i % JobIconColumnCount;
if (modulo == 0)
styleBase = StyleBase.ButtonOpenRight;
else if (modulo == JobIconColumnCount - 1)
styleBase = StyleBase.ButtonOpenLeft;

// Generate buttons
var jobIconButton = new Button
{
Access = AccessLevel.Public,
StyleClasses = { styleBase },
MaxSize = new Vector2(42, 28),
Group = jobIconGroup,
Pressed = i == 0,
};

// Generate buttons textures
TextureRect jobIconTexture = new TextureRect
{
Texture = _spriteSystem.Frame0(jobIcon.Icon),
TextureScale = new Vector2(2.5f, 2.5f),
Stretch = TextureRect.StretchMode.KeepCentered,
};

jobIconButton.AddChild(jobIconTexture);
jobIconButton.OnPressed += _ => _bui.OnJobIconChanged(jobIcon.ID);
IconGrid.AddChild(jobIconButton);
i++;
}
}

public void SetCurrentName(string name)
{
NameLineEdit.Text = name;
Expand Down
5 changes: 2 additions & 3 deletions Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System.Linq;
using System.Numerics;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
using System.Numerics;
using static Robust.Client.UserInterface.Controls.BoxContainer;

namespace Content.Client.Chemistry.UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ private void SystemFlipConstructionPrototype(object? sender, EventArgs eventArgs
return;
}

if (_selected == null || _selected.Mirror == String.Empty)
if (_selected == null || _selected.Mirror == null)
{
return;
}
Expand Down
28 changes: 12 additions & 16 deletions Content.Client/CrewManifest/CrewManifestUi.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using Content.Shared.CCVar;
using Content.Shared.CrewManifest;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
Expand Down Expand Up @@ -100,8 +102,15 @@ public void Populate(string name, CrewManifestEntries? entries)

private sealed class CrewManifestSection : BoxContainer
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
private readonly SpriteSystem _spriteSystem = default!;

public CrewManifestSection(string sectionTitle, List<CrewManifestEntry> entries, IResourceCache cache, CrewManifestSystem crewManifestSystem)
{
IoCManager.InjectDependencies(this);
_spriteSystem = _entitySystem.GetEntitySystem<SpriteSystem>();

Orientation = LayoutOrientation.Vertical;
HorizontalExpand = true;

Expand All @@ -122,9 +131,6 @@ public CrewManifestSection(string sectionTitle, List<CrewManifestEntry> entries,

AddChild(gridContainer);

var path = new ResPath("/Textures/Interface/Misc/job_icons.rsi");
cache.TryGetResource(path, out RSIResource? rsi);

foreach (var entry in entries)
{
var name = new RichTextLabel()
Expand All @@ -143,25 +149,15 @@ public CrewManifestSection(string sectionTitle, List<CrewManifestEntry> entries,
title.SetMessage(entry.JobTitle);


if (rsi != null)
if (_prototypeManager.TryIndex<StatusIconPrototype>(entry.JobIcon, out var jobIcon))
{
var icon = new TextureRect()
{
TextureScale = new Vector2(2, 2),
Stretch = TextureRect.StretchMode.KeepCentered
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = _spriteSystem.Frame0(jobIcon.Icon),
};

if (rsi.RSI.TryGetState(entry.JobIcon, out _))
{
var specifier = new SpriteSpecifier.Rsi(path, entry.JobIcon);
icon.Texture = specifier.Frame0();
}
else if (rsi.RSI.TryGetState("Unknown", out _))
{
var specifier = new SpriteSpecifier.Rsi(path, "Unknown");
icon.Texture = specifier.Frame0();
}

titleContainer.AddChild(icon);
titleContainer.AddChild(title);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Decals/DecalPlacementSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void SetActive(bool active)

public sealed class PlaceDecalActionEvent : WorldTargetActionEvent
{
[DataField("decalId", customTypeSerializer:typeof(PrototypeIdSerializer<DecalPrototype>))]
[DataField("decalId", customTypeSerializer:typeof(PrototypeIdSerializer<DecalPrototype>), required:true)]
public string DecalId = string.Empty;

[DataField("color")]
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/LateJoin/LateJoinGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Client.Players.PlayTimeTracking;
using Content.Shared.CCVar;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -233,8 +234,8 @@ private void RebuildUI()
Stretch = TextureRect.StretchMode.KeepCentered
};

var specifier = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/job_icons.rsi"), prototype.Icon);
icon.Texture = _sprites.Frame0(specifier);
var jobIcon = _prototypeManager.Index<StatusIconPrototype>(prototype.Icon);
icon.Texture = _sprites.Frame0(jobIcon.Icon);
jobSelector.AddChild(icon);

var jobLabel = new Label
Expand Down
13 changes: 5 additions & 8 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Content.Shared.Traits;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
Expand Down Expand Up @@ -583,7 +584,7 @@ private void UpdateRoleRequirements()

foreach (var job in jobs)
{
var selector = new JobPrioritySelector(job);
var selector = new JobPrioritySelector(job, _prototypeManager);

if (!_requirements.IsAllowed(job, out var reason))
{
Expand Down Expand Up @@ -1201,7 +1202,7 @@ public JobPriority Priority
private Label _requirementsLabel;
private Label _jobTitle;

public JobPrioritySelector(JobPrototype job)
public JobPrioritySelector(JobPrototype job, IPrototypeManager prototypeManager)
{
Job = job;

Expand Down Expand Up @@ -1231,12 +1232,8 @@ public JobPrioritySelector(JobPrototype job)
Stretch = TextureRect.StretchMode.KeepCentered
};

if (job.Icon != null)
{
var specifier = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/job_icons.rsi"),
job.Icon);
icon.Texture = specifier.Frame0();
}
var jobIcon = prototypeManager.Index<StatusIconPrototype>(job.Icon);
icon.Texture = jobIcon.Icon.Frame0();

_requirementsLabel = new Label()
{
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Salvage/SalvageMagnetComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Shared.Salvage;
using Robust.Shared.GameStates;

namespace Content.Client.Salvage;

[NetworkedComponent, RegisterComponent]
public sealed class SalvageMagnetComponent : SharedSalvageMagnetComponent {}
Loading

0 comments on commit bcd147e

Please sign in to comment.