Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role Types #33420

Merged
merged 118 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
375f87b
mindcomponent namespace
Errant-4 Aug 5, 2024
92d68be
wip MindRole stuff
Errant-4 Aug 7, 2024
76c4f1b
admin player tab
Errant-4 Aug 8, 2024
b9cd645
mindroletype comment
Errant-4 Aug 8, 2024
bc6d845
mindRolePrototype redesign
Errant-4 Aug 8, 2024
bd600ff
broken param
Errant-4 Aug 8, 2024
03f6c49
Merge branch 'master' into charwindow
Errant-4 Aug 10, 2024
82fb313
wip RoleType implementation
Errant-4 Aug 10, 2024
befa79a
basic role type switching for antags
Errant-4 Aug 10, 2024
3abc649
traitor fix
Errant-4 Aug 10, 2024
768a612
fix AdminPanel update
Errant-4 Aug 10, 2024
c6de6f9
the renameningTM
Errant-4 Aug 10, 2024
d3f9249
cleanup
Errant-4 Aug 10, 2024
a190d8a
feature uncreeping
Errant-4 Aug 11, 2024
663e79a
roletypes on mind roles
Errant-4 Aug 11, 2024
492dde2
update MindComponent.RoleType when MindRoles change
Errant-4 Aug 12, 2024
cac46c5
ghostrole configuration
Errant-4 Aug 12, 2024
dca30cd
ghostrole config improvements
Errant-4 Aug 12, 2024
a75a5ae
live update of roleType on the character window
Errant-4 Aug 12, 2024
086b54e
logging stuff and notes
Errant-4 Aug 12, 2024
620bc00
remove thing no one asked for
Errant-4 Aug 12, 2024
be32335
Merge branch 'master' into roletype
Errant-4 Aug 15, 2024
9977cf3
weh
Errant-4 Aug 16, 2024
1318979
Merge branch 'master' into roletype
Errant-4 Aug 16, 2024
e5fab3a
Mind Role Entities wip
Errant-4 Aug 21, 2024
142385f
headrev count fix
Errant-4 Aug 21, 2024
3656b21
silicon stuff, cleanup
Errant-4 Aug 21, 2024
bf44800
exclusive antag config, cleanup
Errant-4 Aug 21, 2024
75cf0f4
jobroleadd overwerite
Errant-4 Aug 21, 2024
99e19a2
logging stuff
Errant-4 Aug 21, 2024
a94807c
Merge branch 'master' into roleent
Errant-4 Aug 21, 2024
f199b84
MindHasRole cleanup, admin log stuff
Errant-4 Aug 22, 2024
6ea3967
last second cleanup
Errant-4 Aug 22, 2024
2859aa4
Merge branch 'master' into roleent
Errant-4 Aug 22, 2024
37764c2
Merge branch 'master' into roletype
Errant-4 Aug 22, 2024
08f6826
Merge branch 'roleent' into roletype_roleent
Errant-4 Aug 24, 2024
5be2367
Merge branch 'master' into roleent
Errant-4 Aug 24, 2024
90ff3db
ocd
Errant-4 Aug 24, 2024
b9fa9e7
Merge branch 'roleent' into roletype_roleent
Errant-4 Aug 24, 2024
cfbe25d
Merge branch 'master' into roletype3
Errant-4 Oct 17, 2024
f6e57ca
Merge branch 'master' into roletype3
Errant-4 Oct 17, 2024
22101a4
move roletypeprototype to its own file, minor note stuff
Errant-4 Oct 18, 2024
f48f6ab
remove Roletype.Created
Errant-4 Oct 19, 2024
957e08c
Merge branch 'master' into roletype3
Errant-4 Nov 6, 2024
6aece35
log stuff
Errant-4 Nov 7, 2024
0455e88
roletype setup for ghostroles and autotraitor reinforcements
Errant-4 Nov 7, 2024
3994e3f
ghostrole type configs
Errant-4 Nov 7, 2024
50208c5
adjustable admin overlay
Errant-4 Nov 10, 2024
2fcde7f
cleanup
Errant-4 Nov 11, 2024
4baa99f
fix this in its own PR
Errant-4 Nov 11, 2024
4a72b2b
silicon antagonist
Errant-4 Nov 11, 2024
f9f988a
borg stuff
Errant-4 Nov 11, 2024
6c39596
Merge branch 'master' into roletype3
Errant-4 Nov 11, 2024
16d27f7
mmi roletype handling
Errant-4 Nov 12, 2024
bd57632
spawnable borg roletype handling
Errant-4 Nov 12, 2024
8534391
weh
Errant-4 Nov 12, 2024
f1abf4c
ghost role cleanup
Errant-4 Nov 14, 2024
4eb19bd
weh
Errant-4 Nov 14, 2024
d9df3af
RoleEvent update
Errant-4 Nov 14, 2024
24889f4
polish
Errant-4 Nov 14, 2024
91d05d9
log stuff
Errant-4 Nov 14, 2024
9684a4c
admin overlay config
Errant-4 Nov 14, 2024
b223db5
ghostrolecomponent cleanup
Errant-4 Nov 14, 2024
f3f5fd7
weh
Errant-4 Nov 14, 2024
ebca92b
Merge branch 'master' into roletype3
Errant-4 Nov 14, 2024
0b627db
admin overlay code cleanup
Errant-4 Nov 17, 2024
2383468
minor cleanup
Errant-4 Nov 17, 2024
49e48ac
Obsolete MindRoleAddedEvent
Errant-4 Nov 17, 2024
1f074ba
comment
Errant-4 Nov 17, 2024
5ad5e8b
minor code cleanup
Errant-4 Nov 18, 2024
8221762
MindOnDoGreeting fix
Errant-4 Nov 19, 2024
a0da29f
Role update message
Errant-4 Nov 19, 2024
00d72c2
fix duplicate job greeting for cyborgs
Errant-4 Nov 19, 2024
41d43f3
fix emag job message dupe
Errant-4 Nov 19, 2024
ba4df25
nicer-looking role type update
Errant-4 Nov 19, 2024
b1d23e6
crew aligned
Errant-4 Nov 19, 2024
2c90199
Merge branch 'master' into roletype3
Errant-4 Nov 20, 2024
ba5a32c
syndicate assault borg role fix
Errant-4 Nov 20, 2024
72c1d94
fix test fail
Errant-4 Nov 20, 2024
1e77012
Merge branch 'master' into roletype3
Errant-4 Nov 27, 2024
b5e2ba7
fix a merge mistake
Errant-4 Nov 27, 2024
3c4205c
Merge branch 'master' into roletype3
Errant-4 Dec 2, 2024
0eaae98
fix LoneOp role type
Errant-4 Dec 2, 2024
a21358b
Update Content.Client/Administration/AdminNameOverlay.cs
Errant-4 Dec 7, 2024
95968ac
Update Content.Shared/Roles/SharedRoleSystem.cs
Errant-4 Dec 7, 2024
14db0df
comment formatting
Errant-4 Dec 7, 2024
8d3caf9
change logging category
Errant-4 Dec 7, 2024
806ad20
fix a space
Errant-4 Dec 10, 2024
8337dca
use MindAddRoles
Errant-4 Dec 10, 2024
a8e892b
get MindComponent from TryGetMind
Errant-4 Dec 10, 2024
17a1124
move var declaration outside loop
Errant-4 Dec 10, 2024
8c7fac1
remove TryComp
Errant-4 Dec 10, 2024
cd6e947
take RoleEnum behind the barn
Errant-4 Dec 10, 2024
00edcbb
don't use ensurecomp unnecessarily
Errant-4 Dec 10, 2024
ba10059
cvar comments
Errant-4 Dec 10, 2024
c7fd3ee
toggleableghostrolecomponent documentation
Errant-4 Dec 10, 2024
00e47f2
skrek
Errant-4 Dec 11, 2024
eb06fc1
use EntProtoId
Errant-4 Dec 11, 2024
f85a075
mindrole config
Errant-4 Dec 12, 2024
1e11d69
merge baserolecomponent into basemindrolecomponent
Errant-4 Dec 13, 2024
ae47430
ai and borg silicon role tweaks
Errant-4 Dec 13, 2024
bfadf7b
Merge branch 'master' into roletype3
Errant-4 Dec 27, 2024
b003f16
formatting
Errant-4 Dec 29, 2024
f519d1e
I will end you (the color)
Errant-4 Dec 29, 2024
494df5b
use LocId type for a locale id
Errant-4 Dec 29, 2024
9460324
update RoleEvent documentation
Errant-4 Dec 29, 2024
c91e700
update RoleEvent documentation
Errant-4 Dec 29, 2024
9c8bff2
remove obsolete MindRoleAddedEvent
Errant-4 Dec 29, 2024
72a45f5
refine MindRolesUpdate()
Errant-4 Dec 29, 2024
e2f52e4
use dependency
Errant-4 Jan 10, 2025
6042f8b
inject dependency
Errant-4 Jan 10, 2025
f131815
roleType.Name no longer required
Errant-4 Jan 10, 2025
77d287d
reformatted draw code logic
Errant-4 Jan 10, 2025
27ab3cb
GhostRoleMarkerRoleComponent comment
Errant-4 Jan 10, 2025
a254a03
minor SharedRoleSystem cleanup
Errant-4 Jan 10, 2025
c326482
StartingMindRoleComponent, unhardcode roundstart silicon
Errant-4 Jan 11, 2025
1424ce3
Update Content.Shared/Roles/SharedRoleSystem.cs
slarticodefast Jan 11, 2025
b1f8d2f
remove a whitespace
slarticodefast Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -197,6 +197,7 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Character => Compare(x.CharacterName, y.CharacterName),
Header.Job => Compare(x.StartingJob, y.StartingJob),
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 @@ -24,6 +24,11 @@
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Label Name="RoleTypeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Label Name="OverallPlaytimeLabel"
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public PlayerTabEntry(PlayerInfo player, StyleBoxFlat styleBoxFlat)
if (player.IdentityName != player.CharacterName)
CharacterLabel.Text += $" [{player.IdentityName}]";
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 @@ -32,6 +32,13 @@
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/>
<Label Name="PlaytimeLabel"
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public PlayerTabHeader()
CharacterLabel.OnKeyBindDown += CharacterClicked;
JobLabel.OnKeyBindDown += JobClicked;
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
RoleTypeLabel.OnKeyBindDown += RoleTypeClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
}

Expand All @@ -30,6 +31,7 @@ public Label GetHeader(Header header)
Header.Character => CharacterLabel,
Header.Job => JobLabel,
Header.Antagonist => AntagonistLabel,
Header.RoleType => RoleTypeLabel,
Header.Playtime => PlaytimeLabel,
_ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
};
Expand All @@ -41,6 +43,7 @@ public void ResetHeaderText()
CharacterLabel.Text = Loc.GetString("player-tab-character");
JobLabel.Text = Loc.GetString("player-tab-job");
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 @@ -75,6 +78,11 @@ private void AntagonistClicked(GUIBoundKeyEventArgs args)
HeaderClicked(args, Header.Antagonist);
}

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

private void PlaytimeClicked(GUIBoundKeyEventArgs args)
{
HeaderClicked(args, Header.Playtime);
Expand All @@ -90,6 +98,7 @@ protected override void Dispose(bool disposing)
CharacterLabel.OnKeyBindDown -= CharacterClicked;
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
RoleTypeLabel.OnKeyBindDown -= RoleTypeClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
}
}
Expand All @@ -100,6 +109,7 @@ public enum Header
Character,
Job,
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"/>
Errant-4 marked this conversation as resolved.
Show resolved Hide resolved
<BoxContainer Orientation="Horizontal">
<SpriteView OverrideDirection="South" Scale="2 2" Name="SpriteView" Access="Public" SetSize="64 64"/>
<BoxContainer Orientation="Vertical" VerticalAlignment="Top">
Expand Down
17 changes: 13 additions & 4 deletions Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Content.Shared.Inventory;
using Content.Shared.Mind;
using Content.Shared.PDA;
using Content.Shared.Players;
using Content.Shared.Players.PlayTimeTracking;
using Content.Shared.Popups;
using Content.Shared.Roles;
Expand All @@ -32,6 +31,7 @@
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Server.Administration.Systems;

Expand All @@ -48,6 +48,7 @@ public sealed class AdminSystem : EntitySystem
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly PlayTimeTrackingManager _playTime = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedRoleSystem _role = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
Expand Down Expand Up @@ -165,7 +166,8 @@ private void OnIdentityChanged(ref IdentityChangedEvent ev)
private void OnRoleEvent(RoleEvent ev)
{
var session = _minds.GetSession(ev.Mind);
if (!ev.Antagonist || session == null)

if (!ev.RoleTypeUpdate || session == null)
return;

UpdatePlayerList(session);
Expand Down Expand Up @@ -239,9 +241,16 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
}

var antag = false;

RoleTypePrototype roleType = new();
var startingRole = string.Empty;
if (_minds.TryGetMind(session, out var mindId, out _))
if (_minds.TryGetMind(session, out var mindId, out var mindComp))
{
if (_proto.TryIndex(mindComp.RoleType, out var role))
roleType = role;
else
Log.Error($"{ToPrettyString(mindId)} has invalid Role Type '{mindComp.RoleType}'. Displaying '{Loc.GetString(roleType.Name)}' instead");

antag = _role.MindIsAntagonist(mindId);
startingRole = _jobs.MindTryGetJobName(mindId);
}
Expand All @@ -255,7 +264,7 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
overallPlaytime = playTime;
}

return new PlayerInfo(name, entityName, identityName, startingRole, antag, GetNetEntity(session?.AttachedEntity), data.UserId,
return new PlayerInfo(name, entityName, identityName, startingRole, antag, roleType, GetNetEntity(session?.AttachedEntity), data.UserId,
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime);
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Antag/Components/AntagSelectionComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public partial struct AntagSelectionDefinition()
/// List of Mind Role Prototypes to be added to the player's mind.
/// </summary>
[DataField]
public List<ProtoId<EntityPrototype>>? MindRoles;
public List<EntProtoId>? MindRoles;

/// <summary>
/// A set of starting gear that's equipped to the player.
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ private void SpawnPlayer(ICommonSession player,
_mind.SetUserId(newMind, data.UserId);

var jobPrototype = _prototypeManager.Index<JobPrototype>(jobId);
_roles.MindAddJobRole(newMind, silent: silent, jobPrototype:jobId);
var jobName = _jobs.MindTryGetJobName(newMind);

_playTimeTrackings.PlayerRolesChanged(player);

Expand All @@ -233,6 +231,9 @@ private void SpawnPlayer(ICommonSession player,

_mind.TransferTo(newMind, mob);

_roles.MindAddJobRole(newMind, silent: silent, jobPrototype:jobId);
var jobName = _jobs.MindTryGetJobName(newMind);

if (lateJoin && !silent)
{
if (jobPrototype.JoinNotifyCrew)
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Ghost/ObserverRoleComponent.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace Content.Server.Ghost;
using Content.Shared.Roles;

namespace Content.Server.Ghost;

/// <summary>
/// This is used to mark Observers properly, as they get Minds
/// </summary>
[RegisterComponent]
public sealed partial class ObserverRoleComponent : Component
public sealed partial class ObserverRoleComponent : BaseMindRoleComponent
{
public string Name => Loc.GetString("observer-role-name");
}
Loading
Loading