Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/wizards/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml
#	Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabHeader.xaml
#	Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabHeader.xaml.cs
#	Content.Server/Administration/Systems/AdminSystem.cs
#	Content.Server/Connection/ConnectionManager.cs
#	Content.Server/Entry/EntryPoint.cs
#	Content.Server/Ghost/Roles/GhostRoleSystem.cs
#	Content.Server/IoC/ServerContentIoC.cs
#	Resources/Locale/en-US/_strings/administration/antag.ftl
#	Resources/Locale/en-US/_strings/advertisements/vending/pride.ftl
#	Resources/Locale/en-US/_strings/mind/role-types.ftl
#	Resources/Prototypes/Entities/Markers/Spawners/ghost_roles.yml
#	Resources/Prototypes/Entities/Mobs/Player/dragon.yml
#	Resources/Prototypes/Entities/Mobs/Player/silicon.yml
#	Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/reinforcement_teleporter.yml
#	Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml
#	Resources/Textures/Interface/Misc/job_icons.rsi/meta.json
  • Loading branch information
VigersRay committed Jan 14, 2025
2 parents 46a1233 + 8e7f440 commit 5c219f5
Show file tree
Hide file tree
Showing 167 changed files with 20,488 additions and 12,043 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Get Engine Tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
36 changes: 30 additions & 6 deletions Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
using System.Linq;
using System.Numerics;
using Content.Client.Administration.Systems;
using Content.Shared.CCVar;
using Content.Shared.Mind;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Shared;
using Robust.Shared.Enums;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.Administration;

internal sealed class AdminNameOverlay : Overlay
{
[Dependency] private readonly IConfigurationManager _config = default!;

private readonly AdminSystem _system;
private readonly IEntityManager _entityManager;
private readonly IEyeManager _eyeManager;
private readonly EntityLookupSystem _entityLookup;
private readonly IUserInterfaceManager _userInterfaceManager;
private readonly Font _font;

//TODO make this adjustable via GUI
private readonly ProtoId<RoleTypePrototype>[] _filter =
["SoloAntagonist", "TeamAntagonist", "SiliconAntagonist", "FreeAgent"];
private readonly string _antagLabelClassic = Loc.GetString("admin-overlay-antag-classic");
private readonly Color _antagColorClassic = Color.OrangeRed;

public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, EntityLookupSystem entityLookup, IUserInterfaceManager userInterfaceManager)
{
IoCManager.InjectDependencies(this);

_system = system;
_entityManager = entityManager;
_eyeManager = eyeManager;
Expand All @@ -35,6 +48,9 @@ protected override void Draw(in OverlayDrawArgs args)
{
var viewport = args.WorldAABB;

//TODO make this adjustable via GUI
var classic = _config.GetCVar(CCVars.AdminOverlayClassic);

foreach (var playerInfo in _system.PlayerList)
{
var entity = _entityManager.GetEntity(playerInfo.NetEntity);
Expand Down Expand Up @@ -64,12 +80,20 @@ protected override void Draw(in OverlayDrawArgs args)
var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center +
new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec(
aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f);
if (playerInfo.Antag)

if (classic && playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", uiScale, Color.OrangeRed);
;
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), _antagLabelClassic, uiScale, _antagColorClassic);
}
args.ScreenHandle.DrawString(_font, screenCoordinates+lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White);
else if (!classic && _filter.Contains(playerInfo.RoleProto.ID))
{
var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper();
var color = playerInfo.RoleProto.Color;

args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), label, uiScale, color);
}

args.ScreenHandle.DrawString(_font, screenCoordinates + lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Job => Compare(x.StartingJob, y.StartingJob),
Header.Sponsor => string.Compare(x.SponsorTitle!, y.SponsorTitle, StringComparison.Ordinal), // Sunrise-Sponsors
Header.Antagonist => x.Antag.CompareTo(y.Antag),
Header.RoleType => Compare(x.RoleProto.Name , y.RoleProto.Name),
Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default),
_ => 1
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Label Name="RoleTypeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<!-- Sunrise-Start -->
<Button Name="ObjectivesButton"
Text="{Loc player-tab-objectives-button}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public PlayerTabEntry(PlayerInfo player, StyleBoxFlat styleBoxFlat)
CharacterLabel.Text += $" [{player.IdentityName}]";
SponsorLabel.Text = player.IsSponsor ? player.SponsorTitle : ""; // Sunrise-Sponsors
AntagonistLabel.Text = Loc.GetString(player.Antag ? "player-tab-is-antag-yes" : "player-tab-is-antag-no");
RoleTypeLabel.Text = Loc.GetString(player.RoleProto.Name);
RoleTypeLabel.FontColorOverride = player.RoleProto.Color;
BackgroundColorPanel.PanelOverride = styleBoxFlat;
OverallPlaytimeLabel.Text = player.PlaytimeString;
PlayerEntity = player.NetEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@
Text="{Loc player-tab-antagonist}"
MouseFilter="Pass"/>
<cc:VSeparator/>
<Label Name="RoleTypeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-roletype}"
MouseFilter="Pass"/>
<cc:VSeparator/>
<!-- Sunrise-Start -->
<Label Name="EntityDeleteLabel"
<Label Name="ObjectivesLabel"
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
ClipText="True"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public PlayerTabHeader()
JobLabel.OnKeyBindDown += JobClicked;
SponsorLabel.OnKeyBindDown += SponsorClicked; // Sunrise-Sponsors
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
RoleTypeLabel.OnKeyBindDown += RoleTypeClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
}

Expand All @@ -32,6 +33,7 @@ public Label GetHeader(Header header)
Header.Job => JobLabel,
Header.Sponsor => SponsorLabel, // Sunrise-Sponsors
Header.Antagonist => AntagonistLabel,
Header.RoleType => RoleTypeLabel,
Header.Playtime => PlaytimeLabel,
_ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
};
Expand All @@ -44,6 +46,7 @@ public void ResetHeaderText()
JobLabel.Text = Loc.GetString("player-tab-job");
SponsorLabel.Text = Loc.GetString("player-tab-sponsor"); // Sunrise-Sponsors
AntagonistLabel.Text = Loc.GetString("player-tab-antagonist");
RoleTypeLabel.Text = Loc.GetString("player-tab-roletype");
PlaytimeLabel.Text = Loc.GetString("player-tab-playtime");
}

Expand Down Expand Up @@ -78,6 +81,11 @@ private void AntagonistClicked(GUIBoundKeyEventArgs args)
HeaderClicked(args, Header.Antagonist);
}

private void RoleTypeClicked(GUIBoundKeyEventArgs args)
{
HeaderClicked(args, Header.RoleType);
}

// Sunrise-Sponsors-Start
private void SponsorClicked(GUIBoundKeyEventArgs args)
{
Expand All @@ -100,6 +108,7 @@ protected override void Dispose(bool disposing)
CharacterLabel.OnKeyBindDown -= CharacterClicked;
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
RoleTypeLabel.OnKeyBindDown -= RoleTypeClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
}
}
Expand All @@ -111,6 +120,7 @@ public enum Header
Job,
Sponsor, // Sunrise-Sponsors
Antagonist,
RoleType,
Playtime
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
using Content.Client.UserInterface.Systems.Character.Windows;
using Content.Client.UserInterface.Systems.Objectives.Controls;
using Content.Shared.Input;
using Content.Shared.Objectives.Systems;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input.Binding;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Content.Client.CharacterInfo.CharacterInfoSystem;
using static Robust.Client.UserInterface.Controls.BaseButton;
Expand All @@ -24,10 +27,25 @@ namespace Content.Client.UserInterface.Systems.Character;
[UsedImplicitly]
public sealed class CharacterUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>, IOnSystemChanged<CharacterInfoSystem>
{
[Dependency] private readonly IEntityManager _ent = default!;
[Dependency] private readonly ILogManager _logMan = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

[UISystemDependency] private readonly CharacterInfoSystem _characterInfo = default!;
[UISystemDependency] private readonly SpriteSystem _sprite = default!;

private ISawmill _sawmill = default!;

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

_sawmill = _logMan.GetSawmill("character");

SubscribeNetworkEvent<MindRoleTypeChangedEvent>(OnRoleTypeChanged);
}

private CharacterWindow? _window;
private MenuButton? CharacterButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.CharacterButton;

Expand Down Expand Up @@ -110,6 +128,9 @@ private void CharacterUpdated(CharacterData data)
var (entity, job, objectives, briefing, entityName) = data;

_window.SpriteView.SetEntity(entity);

UpdateRoleType();

_window.NameLabel.Text = entityName;
_window.SubText.Text = job;
_window.Objectives.RemoveAllChildren();
Expand Down Expand Up @@ -173,6 +194,37 @@ private void CharacterUpdated(CharacterData data)
_window.RolePlaceholder.Visible = briefing == null && !controls.Any() && !objectives.Any();
}

private void OnRoleTypeChanged(MindRoleTypeChangedEvent ev, EntitySessionEventArgs _)
{
UpdateRoleType();
}

private void UpdateRoleType()
{
if (_window == null || !_window.IsOpen)
return;

if (!_ent.TryGetComponent<MindContainerComponent>(_player.LocalEntity, out var container)
|| container.Mind is null)
return;

if (!_ent.TryGetComponent<MindComponent>(container.Mind.Value, out var mind))
return;

var roleText = Loc.GetString("role-type-crew-aligned-name");
var color = Color.White;
if (_prototypeManager.TryIndex(mind.RoleType, out var proto))
{
roleText = Loc.GetString(proto.Name);
color = proto.Color;
}
else
_sawmill.Error($"{_player.LocalEntity} has invalid Role Type '{mind.RoleType}'. Displaying '{roleText}' instead");

_window.RoleType.Text = roleText;
_window.RoleType.FontColorOverride = color;
}

private void CharacterDetached(EntityUid uid)
{
CloseWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
MinHeight="545">
<ScrollContainer>
<BoxContainer Orientation="Vertical">
<Label Name="RoleType" VerticalAlignment="Top" Margin="0 6 0 10" HorizontalAlignment="Center" StyleClasses="LabelHeading" Access="Public"/>
<BoxContainer Orientation="Horizontal">
<SpriteView OverrideDirection="South" Scale="2 2" Name="SpriteView" Access="Public" SetSize="64 64"/>
<BoxContainer Orientation="Vertical" VerticalAlignment="Top">
Expand Down
2 changes: 1 addition & 1 deletion Content.PatreonParser/Content.PatreonParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
Expand Down
Loading

0 comments on commit 5c219f5

Please sign in to comment.