]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Role Types (#33420)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Sat, 11 Jan 2025 21:17:26 +0000 (22:17 +0100)
committerGitHub <noreply@github.com>
Sat, 11 Jan 2025 21:17:26 +0000 (22:17 +0100)
* mindcomponent namespace

* wip MindRole stuff

* admin player tab

* mindroletype comment

* mindRolePrototype redesign

* broken param

* wip RoleType implementation

* basic role type switching for antags

* traitor fix

* fix AdminPanel update

* the renameningTM

* cleanup

* feature uncreeping

* roletypes on mind roles

* update MindComponent.RoleType when MindRoles change

* ghostrole configuration

* ghostrole config improvements

* live update of roleType on the character window

* logging stuff and notes

* remove thing no one asked for

* weh

* Mind Role Entities wip

* headrev count fix

* silicon stuff, cleanup

* exclusive antag config, cleanup

* jobroleadd overwerite

* logging stuff

* MindHasRole cleanup, admin log stuff

* last second cleanup

* ocd

* move roletypeprototype to its own file, minor note stuff

* remove Roletype.Created

* log stuff

* roletype setup for ghostroles and autotraitor reinforcements

* ghostrole type configs

* adjustable admin overlay

* cleanup

* fix this in its own PR

* silicon antagonist

* borg stuff

* mmi roletype handling

* spawnable borg roletype handling

* weh

* ghost role cleanup

* weh

* RoleEvent update

* polish

* log stuff

* admin overlay config

* ghostrolecomponent cleanup

* weh

* admin overlay code cleanup

* minor cleanup

* Obsolete MindRoleAddedEvent

* comment

* minor code cleanup

* MindOnDoGreeting fix

* Role update message

* fix duplicate job greeting for cyborgs

* fix emag job message dupe

* nicer-looking role type update

* crew aligned

* syndicate assault borg role fix

* fix test fail

* fix a merge mistake

* fix LoneOp role type

* Update Content.Client/Administration/AdminNameOverlay.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* Update Content.Shared/Roles/SharedRoleSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* comment formatting

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* change logging category

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* fix a space

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* use MindAddRoles

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* get MindComponent from TryGetMind

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* move var declaration outside loop

* remove TryComp

* take RoleEnum behind the barn

* don't use ensurecomp unnecessarily

* cvar comments

* toggleableghostrolecomponent documentation

* skrek

* use EntProtoId

* mindrole config

* merge baserolecomponent into basemindrolecomponent

* ai and borg silicon role tweaks

* formatting

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* I will end you (the color)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* use LocId type for a locale id

* update RoleEvent documentation

* update RoleEvent documentation

* remove obsolete MindRoleAddedEvent

* refine MindRolesUpdate()

* use dependency

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* inject dependency

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* roleType.Name no longer required

* reformatted draw code logic

* GhostRoleMarkerRoleComponent comment

* minor SharedRoleSystem cleanup

* StartingMindRoleComponent, unhardcode roundstart silicon

* Update Content.Shared/Roles/SharedRoleSystem.cs

* remove a whitespace

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
65 files changed:
Content.Client/Administration/AdminNameOverlay.cs
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml.cs
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabHeader.xaml
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabHeader.xaml.cs
Content.Client/UserInterface/Systems/Character/CharacterUIController.cs
Content.Client/UserInterface/Systems/Character/Windows/CharacterWindow.xaml
Content.Server/Administration/Systems/AdminSystem.cs
Content.Server/Antag/Components/AntagSelectionComponent.cs
Content.Server/GameTicking/GameTicker.Spawning.cs
Content.Server/Ghost/ObserverRoleComponent.cs
Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs
Content.Server/Ghost/Roles/GhostRoleMarkerRoleComponent.cs
Content.Server/Ghost/Roles/GhostRoleSystem.cs
Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs
Content.Server/Players/PlayTimeTracking/PlayTimeTrackingSystem.cs
Content.Server/Roles/Jobs/JobSystem.cs
Content.Server/Roles/RoleBriefingComponent.cs
Content.Server/Roles/RoleSystem.cs
Content.Server/Silicons/Borgs/BorgSystem.MMI.cs
Content.Server/Silicons/Borgs/BorgSystem.cs
Content.Server/Silicons/Laws/SiliconLawSystem.cs
Content.Shared/Administration/PlayerInfo.cs
Content.Shared/CCVar/CCVars.Interface.cs
Content.Shared/Mind/MindComponent.cs
Content.Shared/Mind/RoleTypePrototype.cs [new file with mode: 0644]
Content.Shared/Roles/MindIsAntagonistEvent.cs
Content.Shared/Roles/MindRoleAddedEvent.cs [deleted file]
Content.Shared/Roles/MindRoleComponent.cs
Content.Shared/Roles/RoleAddedEvent.cs
Content.Shared/Roles/RoleEvent.cs
Content.Shared/Roles/RoleRemovedEvent.cs
Content.Shared/Roles/SharedRoleSystem.cs
Content.Shared/Roles/SiliconBrainRoleComponent.cs [new file with mode: 0644]
Content.Shared/Roles/StartingMindRoleComponent.cs [new file with mode: 0644]
Resources/Locale/en-US/administration/antag.ftl
Resources/Locale/en-US/administration/ui/tabs/player-tab.ftl
Resources/Locale/en-US/mind/role-types.ftl [new file with mode: 0644]
Resources/Prototypes/Entities/Markers/Spawners/ghost_roles.yml
Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Entities/Mobs/NPCs/behonker.yml
Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml
Resources/Prototypes/Entities/Mobs/NPCs/hellspawn.yml
Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml
Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml
Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml
Resources/Prototypes/Entities/Mobs/NPCs/space.yml
Resources/Prototypes/Entities/Mobs/Player/dragon.yml
Resources/Prototypes/Entities/Mobs/Player/familiars.yml
Resources/Prototypes/Entities/Mobs/Player/guardian.yml
Resources/Prototypes/Entities/Mobs/Player/humanoid.yml
Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Resources/Prototypes/Entities/Mobs/Player/skeleton.yml
Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/reinforcement_teleporter.yml
Resources/Prototypes/Entities/Objects/Fun/pai.yml
Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml
Resources/Prototypes/GameRules/roundstart.yml
Resources/Prototypes/Roles/MindRoles/mind_roles.yml
Resources/Prototypes/Roles/role_types.yml [new file with mode: 0644]
Resources/Prototypes/XenoArch/Effects/utility_effects.yml

index e2db7a8d6b4cbc8c7637eb819be6123d8688dd8a..47d251910cb59fafe342e8c98f01c56b572a0fd9 100644 (file)
@@ -1,16 +1,21 @@
+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;
@@ -18,8 +23,16 @@ internal sealed class AdminNameOverlay : Overlay
     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;
@@ -35,6 +48,9 @@ internal sealed class AdminNameOverlay : Overlay
     {
         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);
@@ -64,12 +80,20 @@ internal sealed class AdminNameOverlay : Overlay
             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);
         }
     }
index 043bf343ecf26da5fbe4a7f862adc9a7d1ea297c..b7231869c9edd36feafe2ce95f3590a201b89022 100644 (file)
@@ -197,6 +197,7 @@ public sealed partial class PlayerTab : Control
             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
         };
index e1371ec6f73b7b67670c4416527f12efee316e0e..54e51747fb9e8028648b7c987bc28e9bf1986d16 100644 (file)
                HorizontalExpand="True"
                ClipText="True"/>
         <customControls:VSeparator/>
+        <Label Name="RoleTypeLabel"
+               SizeFlagsStretchRatio="2"
+               HorizontalExpand="True"
+               ClipText="True"/>
+        <customControls:VSeparator/>
         <Label Name="OverallPlaytimeLabel"
                SizeFlagsStretchRatio="1"
                HorizontalExpand="True"
index 89c5808afc7a7f5436ad8896de50bfd3038f8de4..e876b8cff5370e4c8b74004ef3c22fc749094a8e 100644 (file)
@@ -23,6 +23,8 @@ public sealed partial class PlayerTabEntry : PanelContainer
         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;
index 05007b0fea1b8263279700251e2f645007167682..9ae1724945de59d0d3cdeffa89109a18b4e51a44 100644 (file)
                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"
index cf7ceff23c40190b55719c0d4374f51a44d9621a..5a076a40b63ed626ca910bb0a9ab1377d20940c6 100644 (file)
@@ -19,6 +19,7 @@ public sealed partial class PlayerTabHeader : Control
         CharacterLabel.OnKeyBindDown += CharacterClicked;
         JobLabel.OnKeyBindDown += JobClicked;
         AntagonistLabel.OnKeyBindDown += AntagonistClicked;
+        RoleTypeLabel.OnKeyBindDown += RoleTypeClicked;
         PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
     }
 
@@ -30,6 +31,7 @@ public sealed partial class PlayerTabHeader : Control
             Header.Character => CharacterLabel,
             Header.Job => JobLabel,
             Header.Antagonist => AntagonistLabel,
+            Header.RoleType => RoleTypeLabel,
             Header.Playtime => PlaytimeLabel,
             _ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
         };
@@ -41,6 +43,7 @@ public sealed partial class PlayerTabHeader : Control
         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");
     }
 
@@ -75,6 +78,11 @@ public sealed partial class PlayerTabHeader : Control
         HeaderClicked(args, Header.Antagonist);
     }
 
+    private void RoleTypeClicked(GUIBoundKeyEventArgs args)
+    {
+        HeaderClicked(args, Header.RoleType);
+    }
+
     private void PlaytimeClicked(GUIBoundKeyEventArgs args)
     {
         HeaderClicked(args, Header.Playtime);
@@ -90,6 +98,7 @@ public sealed partial class PlayerTabHeader : Control
             CharacterLabel.OnKeyBindDown -= CharacterClicked;
             JobLabel.OnKeyBindDown -= JobClicked;
             AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
+            RoleTypeLabel.OnKeyBindDown -= RoleTypeClicked;
             PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
         }
     }
@@ -100,6 +109,7 @@ public sealed partial class PlayerTabHeader : Control
         Character,
         Job,
         Antagonist,
+        RoleType,
         Playtime
     }
 }
index 1e4d2f2765797aae14c56d6967a3eb03bc5a5833..c9251000a3c9d8801388d41b3bb75699236efb15 100644 (file)
@@ -7,7 +7,9 @@ using Content.Client.UserInterface.Systems.Character.Controls;
 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;
@@ -15,6 +17,7 @@ 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;
@@ -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;
 
@@ -110,6 +128,9 @@ public sealed class CharacterUIController : UIController, IOnStateEntered<Gamepl
         var (entity, job, objectives, briefing, entityName) = data;
 
         _window.SpriteView.SetEntity(entity);
+
+        UpdateRoleType();
+
         _window.NameLabel.Text = entityName;
         _window.SubText.Text = job;
         _window.Objectives.RemoveAllChildren();
@@ -173,6 +194,37 @@ public sealed class CharacterUIController : UIController, IOnStateEntered<Gamepl
         _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();
index c5307ab900e53d1ad38e10fd9beb76e94284bbd4..fd51403053f193a8e9dfcbe40af248e6997d6327 100644 (file)
@@ -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">
index 620880360359f8546cb970a9316b68b5a063dcf0..68b376610b30e91c4211a07bfad242289164fbcf 100644 (file)
@@ -17,7 +17,6 @@ using Content.Shared.IdentityManagement;
 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;
@@ -32,6 +31,7 @@ using Robust.Shared.Configuration;
 using Robust.Shared.Enums;
 using Robust.Shared.Network;
 using Robust.Shared.Player;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.Administration.Systems;
 
@@ -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!;
@@ -165,7 +166,8 @@ public sealed class AdminSystem : EntitySystem
     private void OnRoleEvent(RoleEvent ev)
     {
         var session = _minds.GetSession(ev.Mind);
-        if (!ev.Antagonist || session == null)
+
+        if (!ev.RoleTypeUpdate || session == null)
             return;
 
         UpdatePlayerList(session);
@@ -239,9 +241,16 @@ public sealed class AdminSystem : EntitySystem
         }
 
         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);
         }
@@ -255,7 +264,7 @@ public sealed class AdminSystem : EntitySystem
             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);
     }
 
index 502fb8eda2c5ff11aedcb8d74536ed519228c22a..35c6f8bc3a40986cb31884fd6eef48d48e3ca7dd 100644 (file)
@@ -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.
index 4bda391ae27280f0146136a3d22ec0ac6a22527b..605e2520809b0a5a36ed78c7b097bc230367b3cf 100644 (file)
@@ -222,8 +222,6 @@ namespace Content.Server.GameTicking
             _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);
 
@@ -233,6 +231,9 @@ namespace Content.Server.GameTicking
 
             _mind.TransferTo(newMind, mob);
 
+            _roles.MindAddJobRole(newMind, silent: silent, jobPrototype:jobId);
+            var jobName = _jobs.MindTryGetJobName(newMind);
+
             if (lateJoin && !silent)
             {
                 if (jobPrototype.JoinNotifyCrew)
index 24e592eb946e3751c586c22125c563105a09be10..8421fb734382af994f6304d868131ef20377c0ce 100644 (file)
@@ -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");
 }
index 3dea97cb5d020a368a66e5f41c604892b6253854..5dd390bd722c1e765d9b80a97b93355563e3485f 100644 (file)
@@ -72,12 +72,16 @@ public sealed partial class GhostRoleComponent : Component
         }
     }
 
-    [DataField("allowSpeech")]
-    [ViewVariables(VVAccess.ReadWrite)]
+    /// <summary>
+    /// The mind roles that will be added to the mob's mind entity
+    /// </summary>
+    [DataField, Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // Don't make eye contact
+    public List<EntProtoId> MindRoles = new() { "MindRoleGhostRoleNeutral" };
+
+    [DataField]
     public bool AllowSpeech { get; set; } = true;
 
-    [DataField("allowMovement")]
-    [ViewVariables(VVAccess.ReadWrite)]
+    [DataField]
     public bool AllowMovement { get; set; }
 
     [ViewVariables(VVAccess.ReadOnly)]
@@ -107,3 +111,4 @@ public sealed partial class GhostRoleComponent : Component
     [Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // also FIXME Friends
     public ProtoId<JobPrototype>? JobProto = null;
 }
+
index fa95014f21b1f56c5cfe629511ab7df17d0838ac..3e6280235ea711f8e8278e0424b99e0b23854917 100644 (file)
@@ -9,39 +9,81 @@ namespace Content.Server.Ghost.Roles.Components;
 [RegisterComponent, Access(typeof(ToggleableGhostRoleSystem))]
 public sealed partial class ToggleableGhostRoleComponent : Component
 {
-    [DataField("examineTextMindPresent")]
+    /// <summary>
+    /// The text shown on the entity's Examine when it is controlled by a player
+    /// </summary>
+    [DataField]
     public string ExamineTextMindPresent = string.Empty;
 
-    [DataField("examineTextMindSearching")]
+    /// <summary>
+    /// The text shown on the entity's Examine when it is waiting for a controlling player
+    /// </summary>
+    [DataField]
     public string ExamineTextMindSearching = string.Empty;
 
-    [DataField("examineTextNoMind")]
+    /// <summary>
+    /// The text shown on the entity's Examine when it has no controlling player
+    /// </summary>
+    [DataField]
     public string ExamineTextNoMind = string.Empty;
 
-    [DataField("beginSearchingText")]
+    /// <summary>
+    /// The popup text when the entity (PAI/positronic brain) it is activated to seek a controlling player
+    /// </summary>
+    [DataField]
     public string BeginSearchingText = string.Empty;
 
-    [DataField("roleName")]
+    /// <summary>
+    /// The name shown on the Ghost Role list
+    /// </summary>
+    [DataField]
     public string RoleName = string.Empty;
 
-    [DataField("roleDescription")]
+    /// <summary>
+    /// The description shown on the Ghost Role list
+    /// </summary>
+    [DataField]
     public string RoleDescription = string.Empty;
 
-    [DataField("roleRules")]
+    /// <summary>
+    /// The introductory message shown when trying to take the ghost role/join the raffle
+    /// </summary>
+    [DataField]
     public string RoleRules = string.Empty;
 
-    [DataField("wipeVerbText")]
+    /// <summary>
+    /// A list of mind roles that will be added to the entity's mind
+    /// </summary>
+    [DataField]
+    public List<EntProtoId> MindRoles;
+
+    /// <summary>
+    /// The displayed name of the verb to wipe the controlling player
+    /// </summary>
+    [DataField]
     public string WipeVerbText = string.Empty;
 
-    [DataField("wipeVerbPopup")]
+    /// /// <summary>
+    /// The popup message when wiping the controlling player
+    /// </summary>
+    [DataField]
     public string WipeVerbPopup = string.Empty;
 
-    [DataField("stopSearchVerbText")]
+    /// <summary>
+    /// The displayed name of the verb to stop searching for a controlling player
+    /// </summary>
+    [DataField]
     public string StopSearchVerbText = string.Empty;
 
-    [DataField("stopSearchVerbPopup")]
+    /// /// <summary>
+    /// The popup message when stopping to search for a controlling player
+    /// </summary>
+    [DataField]
     public string StopSearchVerbPopup = string.Empty;
 
+    /// /// <summary>
+    /// The prototype ID of the job that will be given to the controlling mind
+    /// </summary>
     [DataField("job")]
-    public ProtoId<JobPrototype>? JobProto = null;
+    public ProtoId<JobPrototype>? JobProto;
 }
index 3dfa37a6b1392966fbe21db13c78e7715fb56ec1..da3e89ba2bbe655644cf0de926c6d63d724eee4b 100644 (file)
@@ -3,11 +3,13 @@
 namespace Content.Server.Ghost.Roles;
 
 /// <summary>
-/// This is used for round end display of ghost roles.
-/// It may also be used to ensure some ghost roles count as antagonists in future.
+/// Added to mind role entities to tag that they are a ghostrole.
+/// It also holds the name for the round end display
 /// </summary>
 [RegisterComponent]
 public sealed partial class GhostRoleMarkerRoleComponent : BaseMindRoleComponent
 {
-    [DataField("name")] public string? Name;
+    //TODO does anything still use this? It gets populated by GhostRolesystem but I don't see anything ever reading it
+    [DataField] public string? Name;
+
 }
index cd01c964ef6cba244de2c59f3f994d696fbd270f..7375dee1103f76f386627eee52ba761ad1c81561 100644 (file)
@@ -33,7 +33,6 @@ using Content.Server.Popups;
 using Content.Shared.Verbs;
 using Robust.Shared.Collections;
 using Content.Shared.Ghost.Roles.Components;
-using Content.Shared.Roles.Jobs;
 
 namespace Content.Server.Ghost.Roles;
 
@@ -514,13 +513,13 @@ public sealed class GhostRoleSystem : EntitySystem
         var newMind = _mindSystem.CreateMind(player.UserId,
             EntityManager.GetComponent<MetaDataComponent>(mob).EntityName);
 
-        _roleSystem.MindAddRole(newMind, "MindRoleGhostMarker");
-
-        if(_roleSystem.MindHasRole<GhostRoleMarkerRoleComponent>(newMind!, out var markerRole))
-            markerRole.Value.Comp2.Name = role.RoleName;
-
         _mindSystem.SetUserId(newMind, player.UserId);
         _mindSystem.TransferTo(newMind, mob);
+
+        _roleSystem.MindAddRoles(newMind.Owner, role.MindRoles, newMind.Comp);
+
+        if (_roleSystem.MindHasRole<GhostRoleMarkerRoleComponent>(newMind!, out var markerRole))
+            markerRole.Value.Comp2.Name = role.RoleName;
     }
 
     /// <summary>
index 1f46bacaa07dd038d3c6f3aa2bd3dafe6ab0186c..7bb25a63fbd03515ae5457e5c75a522ad694c4c5 100644 (file)
@@ -51,10 +51,13 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem
 
         var ghostRole = EnsureComp<GhostRoleComponent>(uid);
         EnsureComp<GhostTakeoverAvailableComponent>(uid);
+
+        //GhostRoleComponent inherits custom settings from the ToggleableGhostRoleComponent
         ghostRole.RoleName = Loc.GetString(component.RoleName);
         ghostRole.RoleDescription = Loc.GetString(component.RoleDescription);
         ghostRole.RoleRules = Loc.GetString(component.RoleRules);
         ghostRole.JobProto = component.JobProto;
+        ghostRole.MindRoles = component.MindRoles;
     }
 
     private void OnExamined(EntityUid uid, ToggleableGhostRoleComponent component, ExaminedEvent args)
index 0896731a2e2c278da46d1a970b0f45fc0ae1e929..b8c0d3f45009e43eabf703685eb8ef67498f7dcd 100644 (file)
@@ -49,8 +49,8 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
         SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundEnd);
         SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
         SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
-        SubscribeLocalEvent<RoleAddedEvent>(OnRoleAdd);
-        SubscribeLocalEvent<RoleRemovedEvent>(OnRoleRemove);
+        SubscribeLocalEvent<RoleAddedEvent>(OnRoleEvent);
+        SubscribeLocalEvent<RoleRemovedEvent>(OnRoleEvent);
         SubscribeLocalEvent<AFKEvent>(OnAFK);
         SubscribeLocalEvent<UnAFKEvent>(OnUnAFK);
         SubscribeLocalEvent<MobStateChangedEvent>(OnMobStateChanged);
@@ -121,13 +121,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
         return GetTimedRoles(contentData.Mind.Value);
     }
 
-    private void OnRoleRemove(RoleRemovedEvent ev)
-    {
-        if (_minds.TryGetSession(ev.Mind, out var session))
-            _tracking.QueueRefreshTrackers(session);
-    }
-
-    private void OnRoleAdd(RoleAddedEvent ev)
+    private void OnRoleEvent(RoleEvent ev)
     {
         if (_minds.TryGetSession(ev.Mind, out var session))
             _tracking.QueueRefreshTrackers(session);
index 7e69d9d92bc4b7e57f98e47c0f9dc2af23be842a..28cfbe76b51c066ce9dcad46e533b44cadc7f0ef 100644 (file)
@@ -19,10 +19,25 @@ public sealed class JobSystem : SharedJobSystem
     public override void Initialize()
     {
         base.Initialize();
-        SubscribeLocalEvent<MindComponent, MindRoleAddedEvent>(MindOnDoGreeting);
+        SubscribeLocalEvent<RoleAddedEvent>(OnRoleAddedEvent);
+        SubscribeLocalEvent<RoleRemovedEvent>(OnRoleRemovedEvent);
     }
 
-    private void MindOnDoGreeting(EntityUid mindId, MindComponent component, ref MindRoleAddedEvent args)
+    private void OnRoleAddedEvent(RoleAddedEvent args)
+    {
+        MindOnDoGreeting(args.MindId, args.Mind, args);
+
+        if (args.RoleTypeUpdate)
+            _roles.RoleUpdateMessage(args.Mind);
+    }
+
+    private void OnRoleRemovedEvent(RoleRemovedEvent args)
+    {
+        if (args.RoleTypeUpdate)
+            _roles.RoleUpdateMessage(args.Mind);
+    }
+
+    private void MindOnDoGreeting(EntityUid mindId, MindComponent component, RoleAddedEvent args)
     {
         if (args.Silent)
             return;
index 3577033f7dcc4d267e96f669b9168ec9320f0c90..f4d3fe6353819959641e4d4d5036fa5f0bb62ded 100644 (file)
@@ -1,11 +1,13 @@
-namespace Content.Server.Roles;
+using Content.Shared.Roles;
+
+namespace Content.Server.Roles;
 
 /// <summary>
 /// Adds a briefing to the character info menu, does nothing else.
 /// </summary>
 [RegisterComponent]
-public sealed partial class RoleBriefingComponent : Component
+public sealed partial class RoleBriefingComponent : BaseMindRoleComponent
 {
-    [DataField("briefing"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField]
     public string Briefing;
 }
index 333f4f9b606f90023db1a549325a5b6af5a63622..278ac485797368ce0df5f3befe2a033fb33eee75 100644 (file)
@@ -1,10 +1,16 @@
+using Content.Server.Chat.Managers;
+using Content.Shared.Chat;
 using Content.Shared.Mind;
 using Content.Shared.Roles;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.Roles;
 
 public sealed class RoleSystem : SharedRoleSystem
 {
+    [Dependency] private readonly IChatManager _chat = default!;
+    [Dependency] private readonly IPrototypeManager _proto = default!;
+
     public string? MindGetBriefing(EntityUid? mindId)
     {
         if (mindId == null)
@@ -37,6 +43,32 @@ public sealed class RoleSystem : SharedRoleSystem
 
         return ev.Briefing;
     }
+
+    public void RoleUpdateMessage(MindComponent mind)
+    {
+        if (mind.Session is null)
+            return;
+
+        if (!_proto.TryIndex(mind.RoleType, out var proto))
+            return;
+
+        var roleText = Loc.GetString(proto.Name);
+        var color = proto.Color;
+
+        var session = mind.Session;
+
+        //TODO add audio? Would need to be optional so it does not play on role changes that already come with their own audio
+        // _audio.PlayGlobal(Sound, session);
+
+        var message = Loc.GetString("role-type-update-message", ("color", color), ("role", roleText));
+        var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
+        _chat.ChatMessageToOne(ChatChannel.Server,
+            message,
+            wrappedMessage,
+            default,
+            false,
+            session.Channel);
+    }
 }
 
 /// <summary>
index 76ccb21da353be4b5eefd25c8fb117c9c2a3f6d4..7435e38f5acfe719455b971d1cdc6b9dded4a6b3 100644 (file)
@@ -1,5 +1,7 @@
-using Content.Shared.Containers.ItemSlots;
+using Content.Server.Roles;
+using Content.Shared.Containers.ItemSlots;
 using Content.Shared.Mind.Components;
+using Content.Shared.Roles;
 using Content.Shared.Silicons.Borgs.Components;
 using Robust.Shared.Containers;
 
@@ -8,6 +10,9 @@ namespace Content.Server.Silicons.Borgs;
 /// <inheritdoc/>
 public sealed partial class BorgSystem
 {
+
+    [Dependency] private readonly SharedRoleSystem _roles = default!;
+
     public void InitializeMMI()
     {
         SubscribeLocalEvent<MMIComponent, ComponentInit>(OnMMIInit);
@@ -41,8 +46,13 @@ public sealed partial class BorgSystem
         Dirty(uid, component);
 
         if (_mind.TryGetMind(ent, out var mindId, out var mind))
+        {
             _mind.TransferTo(mindId, uid, true, mind: mind);
 
+            if (!_roles.MindHasRole<SiliconBrainRoleComponent>(mindId))
+                _roles.MindAddRole(mindId, "MindRoleSiliconBrain", silent: true);
+        }
+
         _appearance.SetData(uid, MMIVisuals.BrainPresent, true);
     }
 
@@ -75,7 +85,12 @@ public sealed partial class BorgSystem
         RemComp(uid, component);
 
         if (_mind.TryGetMind(linked, out var mindId, out var mind))
+        {
+            if (_roles.MindHasRole<SiliconBrainRoleComponent>(mindId))
+                _roles.MindRemoveRole<SiliconBrainRoleComponent>(mindId);
+
             _mind.TransferTo(mindId, uid, true, mind: mind);
+        }
 
         _appearance.SetData(linked, MMIVisuals.BrainPresent, false);
     }
index ff204bfa8ceb0c351b5a1f72362ca479bd6f3cd6..5b4b0c08ca716a317e1220e662de82961e8b6bcf 100644 (file)
@@ -5,7 +5,6 @@ using Content.Server.DeviceNetwork.Systems;
 using Content.Server.Explosion.EntitySystems;
 using Content.Server.Hands.Systems;
 using Content.Server.PowerCell;
-using Content.Shared.Access.Systems;
 using Content.Shared.Alert;
 using Content.Shared.Database;
 using Content.Shared.IdentityManagement;
index 1ff5126bc6a5ac60699ae93362a2248aecf315bc..109c183f04011b144a87dbcb6274b3dcd1b7d4fa 100644 (file)
@@ -193,7 +193,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
     private void EnsureSubvertedSiliconRole(EntityUid mindId)
     {
         if (!_roles.MindHasRole<SubvertedSiliconRoleComponent>(mindId))
-            _roles.MindAddRole(mindId, "MindRoleSubvertedSilicon");
+            _roles.MindAddRole(mindId, "MindRoleSubvertedSilicon", silent: true);
     }
 
     private void RemoveSubvertedSiliconRole(EntityUid mindId)
index 89d1477d6b339e6d2309a9e64b7dfdce8e40dae0..b26ecc499f97282bc9fe9c9d36466120063be64f 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Mind;
 using Robust.Shared.Network;
 using Robust.Shared.Serialization;
 
@@ -10,6 +11,7 @@ public sealed record PlayerInfo(
     string IdentityName,
     string StartingJob,
     bool Antag,
+    RoleTypePrototype RoleProto,
     NetEntity? NetEntity,
     NetUserId SessionId,
     bool Connected,
index 79a28e6b4e6a745f00451490d57299348a257b0b..569303f1cff1f25b3d266f6b2b8176ffd45be392 100644 (file)
@@ -4,21 +4,42 @@ namespace Content.Shared.CCVar;
 
 public sealed partial class CCVars
 {
+    /// <summary>
+    /// The sound played when clicking a UI button
+    /// </summary>
     public static readonly CVarDef<string> UIClickSound =
         CVarDef.Create("interface.click_sound", "/Audio/UserInterface/click.ogg", CVar.REPLICATED);
 
+    /// <summary>
+    /// The sound played when the mouse hovers over a clickable UI element
+    /// </summary>
     public static readonly CVarDef<string> UIHoverSound =
         CVarDef.Create("interface.hover_sound", "/Audio/UserInterface/hover.ogg", CVar.REPLICATED);
 
+    /// <summary>
+    /// The layout style of the UI
+    /// </summary>
     public static readonly CVarDef<string> UILayout =
         CVarDef.Create("ui.layout", "Default", CVar.CLIENTONLY | CVar.ARCHIVE);
 
+    /// <summary>
+    /// The dimensions for the chat window in Default UI mode
+    /// </summary>
     public static readonly CVarDef<string> DefaultScreenChatSize =
         CVarDef.Create("ui.default_chat_size", "", CVar.CLIENTONLY | CVar.ARCHIVE);
 
+    /// <summary>
+    /// The width of the chat panel in Separated UI mode
+    /// </summary>
     public static readonly CVarDef<string> SeparatedScreenChatSize =
         CVarDef.Create("ui.separated_chat_size", "0.6,0", CVar.CLIENTONLY | CVar.ARCHIVE);
 
     public static readonly CVarDef<bool> OutlineEnabled =
         CVarDef.Create("outline.enabled", true, CVar.CLIENTONLY);
+
+    /// <summary>
+    /// If true, the admin overlay will be displayed in the old style (showing only "ANTAG")
+    /// </summary>
+    public static readonly CVarDef<bool> AdminOverlayClassic =
+        CVarDef.Create("ui.admin_overlay_classic", false, CVar.CLIENTONLY | CVar.ARCHIVE);
 }
index 07571103ada370e04c5a294aec7bbfb1404157e2..fa48511a2a36a345919183cbee75095f868398e3 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.Mind.Components;
 using Robust.Shared.GameStates;
 using Robust.Shared.Network;
 using Robust.Shared.Player;
+using Robust.Shared.Prototypes;
 
 namespace Content.Shared.Mind;
 
@@ -101,6 +102,12 @@ public sealed partial class MindComponent : Component
     [DataField, AutoNetworkedField]
     public List<EntityUid> MindRoles = new List<EntityUid>();
 
+    /// <summary>
+    ///     The mind's current antagonist/special role, or lack thereof;
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public ProtoId<RoleTypePrototype> RoleType = "Neutral";
+
     /// <summary>
     ///     The session of the player owning this mind.
     ///     Can be null, in which case the player is currently not logged in.
diff --git a/Content.Shared/Mind/RoleTypePrototype.cs b/Content.Shared/Mind/RoleTypePrototype.cs
new file mode 100644 (file)
index 0000000..e473b67
--- /dev/null
@@ -0,0 +1,25 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Mind;
+
+/// <summary>
+///     The core properties of Role Types
+/// </summary>
+[Prototype, Serializable]
+public sealed class RoleTypePrototype : IPrototype
+{
+    [IdDataField]
+    public string ID { get; private set; } = default!;
+
+    /// <summary>
+    ///     The role's name as displayed on the UI.
+    /// </summary>
+    [DataField]
+    public LocId Name = "role-type-crew-aligned-name";
+
+    /// <summary>
+    ///     The role's displayed color.
+    /// </summary>
+    [DataField]
+    public Color Color { get; private set; } = Color.FromHex("#eeeeee");
+}
index aad35783596146db648de58da6f1e5dc0e57db9a..3649ee117ac5d8d8512622c5c0235efcd5fe21c1 100644 (file)
@@ -5,6 +5,6 @@ namespace Content.Shared.Roles;
 ///     depending on their roles.
 /// </summary>
 /// <param name="IsAntagonist">Whether or not the player is an antagonist.</param>
-/// <param name="IsExclusiveAntagonist">Whether or not AntagSelectionSystem should exclude this player from other antag roles</param
+/// <param name="IsExclusiveAntagonist">Whether or not AntagSelectionSystem should exclude this player from other antag roles</param>
 [ByRefEvent]
 public record struct MindIsAntagonistEvent(bool IsAntagonist, bool IsExclusiveAntagonist);
diff --git a/Content.Shared/Roles/MindRoleAddedEvent.cs b/Content.Shared/Roles/MindRoleAddedEvent.cs
deleted file mode 100644 (file)
index 4f6b50d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Content.Shared.Roles;
-
-/// <summary>
-///     Raised on mind entities when a role is added to them.
-///     <see cref="RoleAddedEvent"/> for the one raised on player entities.
-/// </summary>
-[ByRefEvent]
-public readonly record struct MindRoleAddedEvent(bool Silent);
index a3dd0b3bc6da890bc26b03401ef8d01d27f64974..f1eb7a5516d5651bd80674128b13bd3d178c82ab 100644 (file)
@@ -1,5 +1,4 @@
 using Content.Shared.Mind;
-using JetBrains.Annotations;
 using Robust.Shared.GameStates;
 using Robust.Shared.Prototypes;
 
@@ -18,6 +17,12 @@ public sealed partial class MindRoleComponent : BaseMindRoleComponent
     [DataField]
     public bool Antag { get; set; } = false;
 
+    /// <summary>
+    ///     The mind's current antagonist/special role, or lack thereof;
+    /// </summary>
+    [DataField]
+    public ProtoId<RoleTypePrototype>? RoleType;
+
     /// <summary>
     ///     True if this mindrole is an exclusive antagonist. Antag setting is not checked if this is True.
     /// </summary>
@@ -43,6 +48,7 @@ public sealed partial class MindRoleComponent : BaseMindRoleComponent
 }
 
 // Why does this base component actually exist? It does make auto-categorization easy, but before that it was useless?
+// I used it for easy organisation/bookkeeping of what components are for mindroles
 [EntityCategory("Roles")]
 public abstract partial class BaseMindRoleComponent : Component
 {
index 48bc3c7814007cb96dd2f99a64c9ea7a8283414d..feb4d1bf1f9cb7aa60aa476764658c8b3a1e9a78 100644 (file)
@@ -3,10 +3,10 @@
 namespace Content.Shared.Roles;
 
 /// <summary>
-///     Raised on player entities when a role is added to them.
-///     <see cref="RoleAddedEvent"/> for the one raised on mind entities.
+///     Raised on mind entities when a mind role is added to them.
 /// </summary>
 /// <param name="MindId">The mind id associated with the player.</param>
 /// <param name="Mind">The mind component associated with the mind id.</param>
-/// <param name="Antagonist">Whether or not the role makes the player an antagonist.</param>
-public sealed record RoleAddedEvent(EntityUid MindId, MindComponent Mind, bool Antagonist, bool Silent = false) : RoleEvent(MindId, Mind, Antagonist);
+/// <param name="RoleTypeUpdate">True if this update has changed the mind's role type</param>
+/// <param name="Silent">If true, Job greeting/intro will not be sent to the player's chat</param>
+public sealed record RoleAddedEvent(EntityUid MindId, MindComponent Mind, bool RoleTypeUpdate, bool Silent = false) : RoleEvent(MindId, Mind, RoleTypeUpdate);
index ae6c330423ec14ea010a073d8b1283e55480f0d9..80dd33e1c7d93681b3dbae3b869de972811dbda5 100644 (file)
@@ -3,9 +3,9 @@
 namespace Content.Shared.Roles;
 
 /// <summary>
-///     Base event raised on player entities to indicate that something changed about one of their roles.
+///     Base event raised on mind entities to indicate that a mind role was either added or removed.
 /// </summary>
 /// <param name="MindId">The mind id associated with the player.</param>
 /// <param name="Mind">The mind component associated with the mind id.</param>
-/// <param name="Antagonist">Whether or not the role makes the player an antagonist.</param>
-public abstract record RoleEvent(EntityUid MindId, MindComponent Mind, bool Antagonist);
+/// <param name="RoleTypeUpdate">True if this update has changed the mind's role type</param>
+public abstract record RoleEvent(EntityUid MindId, MindComponent Mind, bool RoleTypeUpdate);
index 3a0f4989d3610b6d2c29719ba9bd9daf94a67525..41a7f7bcc366e282b27cc1ac01ccaf4106061d2b 100644 (file)
@@ -3,12 +3,9 @@
 namespace Content.Shared.Roles;
 
 /// <summary>
-///     Event raised on player entities to indicate that a role was removed from their mind.
+///     Raised on mind entities when a mind role is removed from them.
 /// </summary>
 /// <param name="MindId">The mind id associated with the player.</param>
 /// <param name="Mind">The mind component associated with the mind id.</param>
-/// <param name="Antagonist">
-///     Whether or not the role made the player an antagonist.
-///     They may still be one due to one of their other roles.
-/// </param>
-public sealed record RoleRemovedEvent(EntityUid MindId, MindComponent Mind, bool Antagonist) : RoleEvent(MindId, Mind, Antagonist);
+/// <param name="RoleTypeUpdate">True if this update has changed the mind's role type</param>
+public sealed record RoleRemovedEvent(EntityUid MindId, MindComponent Mind, bool RoleTypeUpdate) : RoleEvent(MindId, Mind, RoleTypeUpdate);
index d5820ac0392cd0fccf92d67bbf6ccb6252fd1fda..89cd95c2ea3598eaab899eb5481857a8727e9fd0 100644 (file)
@@ -1,14 +1,18 @@
 using System.Diagnostics.CodeAnalysis;
+using System.Linq;
 using Content.Shared.Administration.Logs;
 using Content.Shared.CCVar;
 using Content.Shared.Database;
+using Content.Shared.GameTicking;
 using Content.Shared.Mind;
 using Content.Shared.Roles.Jobs;
+using Content.Shared.Silicons.Borgs.Components;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Configuration;
 using Robust.Shared.Map;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Serialization;
 using Robust.Shared.Utility;
 
 namespace Content.Shared.Roles;
@@ -19,6 +23,7 @@ public abstract class SharedRoleSystem : EntitySystem
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly IConfigurationManager _cfg = default!;
     [Dependency] private readonly IEntityManager _entityManager = default!;
+    [Dependency] private readonly SharedMindSystem _minds = default!;
     [Dependency] private readonly IPrototypeManager _prototypes = default!;
 
     private JobRequirementOverridePrototype? _requirementOverride;
@@ -28,6 +33,15 @@ public abstract class SharedRoleSystem : EntitySystem
         Subs.CVar(_cfg, CCVars.GameRoleTimerOverride, SetRequirementOverride, true);
 
         SubscribeLocalEvent<MindRoleComponent, ComponentShutdown>(OnComponentShutdown);
+        SubscribeLocalEvent<StartingMindRoleComponent, PlayerSpawnCompleteEvent>(OnSpawn);
+    }
+
+    private void OnSpawn(EntityUid uid, StartingMindRoleComponent component, PlayerSpawnCompleteEvent args)
+    {
+        if (!_minds.TryGetMind(uid, out var mindId, out var mindComp))
+            return;
+
+        MindAddRole(mindId, component.MindRole, mind: mindComp, silent: component.Silent);
     }
 
     private void SetRequirementOverride(string value)
@@ -50,7 +64,7 @@ public abstract class SharedRoleSystem : EntitySystem
     /// <param name="mind">If the mind component is provided, it will be checked if it belongs to the mind entity</param>
     /// <param name="silent">If true, no briefing will be generated upon receiving the mind role</param>
     public void MindAddRoles(EntityUid mindId,
-        List<ProtoId<EntityPrototype>>? roles,
+        List<EntProtoId>? roles,
         MindComponent? mind = null,
         bool silent = false)
     {
@@ -71,7 +85,7 @@ public abstract class SharedRoleSystem : EntitySystem
     /// <param name="mind">If the mind component is provided, it will be checked if it belongs to the mind entity</param>
     /// <param name="silent">If true, no briefing will be generated upon receiving the mind role</param>
     public void MindAddRole(EntityUid mindId,
-        ProtoId<EntityPrototype> protoId,
+        EntProtoId protoId,
         MindComponent? mind = null,
         bool silent = false)
     {
@@ -114,22 +128,20 @@ public abstract class SharedRoleSystem : EntitySystem
     ///     Creates a Mind Role
     /// </summary>
     private void MindAddRoleDo(EntityUid mindId,
-        ProtoId<EntityPrototype> protoId,
+        EntProtoId protoId,
         MindComponent? mind = null,
         bool silent = false,
         string? jobPrototype = null)
     {
         if (!Resolve(mindId, ref mind))
         {
-            Log.Error($"Failed to add role {protoId} to mind {mindId} : Mind does not match provided mind component");
+            Log.Error($"Failed to add role {protoId} to {ToPrettyString(mindId)} : Mind does not match provided mind component");
             return;
         }
 
-        var antagonist = false;
-
         if (!_prototypes.TryIndex(protoId, out var protoEnt))
         {
-            Log.Error($"Failed to add role {protoId} to mind {mindId} : Role prototype does not exist");
+            Log.Error($"Failed to add role {protoId} to {ToPrettyString(mindId)} : Role prototype does not exist");
             return;
         }
 
@@ -151,15 +163,14 @@ public abstract class SharedRoleSystem : EntitySystem
             DebugTools.Assert(!mindRoleComp.ExclusiveAntag);
         }
 
-        antagonist |= mindRoleComp.Antag;
         mind.MindRoles.Add(mindRoleId);
 
-        var mindEv = new MindRoleAddedEvent(silent);
-        RaiseLocalEvent(mindId, ref mindEv);
+        var update = MindRolesUpdate((mindId, mind));
 
-        var message = new RoleAddedEvent(mindId, mind, antagonist, silent);
+        // RoleType refresh, Role time tracking, Update Admin playerlist
         if (mind.OwnedEntity != null)
         {
+            var message = new RoleAddedEvent(mindId, mind, update, silent);
             RaiseLocalEvent(mind.OwnedEntity.Value, message, true);
         }
 
@@ -174,12 +185,91 @@ public abstract class SharedRoleSystem : EntitySystem
         {
             //TODO: This is not tied to the player on the Admin Log filters.
             //Probably only happens when Job Role is added on initial spawn, before the mind entity is put in a mob
+            Log.Error($"{ToPrettyString(mindId)} does not have an OwnedEntity!");
             _adminLogger.Add(LogType.Mind,
                 LogImpact.Low,
                 $"{name} added to {ToPrettyString(mindId)}");
         }
     }
 
+    /// <summary>
+    ///     Select the mind's currently "active" mind role entity, and update the mind's role type, if necessary
+    /// </summary>
+    /// <returns>
+    ///     True if this changed the mind's role type
+    /// </returns>>
+    private bool MindRolesUpdate(Entity<MindComponent?> ent)
+    {
+        if(!Resolve(ent.Owner, ref ent.Comp))
+            return false;
+
+        //get the most important/latest mind role
+        var roleType = GetRoleTypeByTime(ent.Comp);
+
+        if (ent.Comp.RoleType == roleType)
+            return false;
+
+        SetRoleType(ent.Owner, roleType);
+        return true;
+    }
+
+    private ProtoId<RoleTypePrototype> GetRoleTypeByTime(MindComponent mind)
+    {
+        // If any Mind Roles specify a Role Type, return the most recent. Otherwise return Neutral
+
+        var roles = new List<ProtoId<RoleTypePrototype>>();
+
+        foreach (var role in mind.MindRoles)
+        {
+            var comp = Comp<MindRoleComponent>(role);
+            if (comp.RoleType is not null)
+                roles.Add(comp.RoleType.Value);
+        }
+
+        ProtoId<RoleTypePrototype> result = (roles.Count > 0) ? roles.LastOrDefault() : "Neutral";
+        return (result);
+    }
+
+    private void SetRoleType(EntityUid mind, ProtoId<RoleTypePrototype> roleTypeId)
+    {
+        if (!TryComp<MindComponent>(mind, out var comp))
+        {
+            Log.Error($"Failed to update Role Type of mind entity {ToPrettyString(mind)} to {roleTypeId}. MindComponent not found.");
+            return;
+        }
+
+        if (!_prototypes.HasIndex(roleTypeId))
+        {
+            Log.Error($"Failed to change Role Type of {_minds.MindOwnerLoggingString(comp)} to {roleTypeId}. Invalid role");
+            return;
+        }
+
+        comp.RoleType = roleTypeId;
+        Dirty(mind, comp);
+
+        // Update player character window
+        if (_minds.TryGetSession(mind, out var session))
+            RaiseNetworkEvent(new MindRoleTypeChangedEvent(), session.Channel);
+        else
+        {
+            var error = $"The Character Window of {_minds.MindOwnerLoggingString(comp)} potentially did not update immediately : session error";
+            _adminLogger.Add(LogType.Mind, LogImpact.High, $"{error}");
+        }
+
+        if (comp.OwnedEntity is null)
+        {
+            Log.Error($"{ToPrettyString(mind)} does not have an OwnedEntity!");
+            _adminLogger.Add(LogType.Mind,
+                LogImpact.High,
+                $"Role Type of {ToPrettyString(mind)} changed to {roleTypeId}");
+            return;
+        }
+
+        _adminLogger.Add(LogType.Mind,
+            LogImpact.High,
+            $"Role Type of {ToPrettyString(comp.OwnedEntity)} changed to {roleTypeId}");
+    }
+
     /// <summary>
     ///     Removes all instances of a specific role from this mind.
     /// </summary>
@@ -195,20 +285,18 @@ public abstract class SharedRoleSystem : EntitySystem
             return false;
 
         var found = false;
-        var antagonist = false;
         var delete = new List<EntityUid>();
         foreach (var role in mind.Comp.MindRoles)
         {
             if (!HasComp<T>(role))
                 continue;
 
-            if (!TryComp(role, out MindRoleComponent? roleComp))
+            if (!HasComp<MindRoleComponent>(role))
             {
                 Log.Error($"Encountered mind role entity {ToPrettyString(role)} without a {nameof(MindRoleComponent)}");
                 continue;
             }
 
-            antagonist |= roleComp.Antag | roleComp.ExclusiveAntag;
             delete.Add(role);
             found = true;
         }
@@ -221,9 +309,11 @@ public abstract class SharedRoleSystem : EntitySystem
             _entityManager.DeleteEntity(role);
         }
 
+        var update = MindRolesUpdate(mind);
+
         if (mind.Comp.OwnedEntity != null)
         {
-            var message = new RoleRemovedEvent(mind.Owner, mind.Comp, antagonist);
+            var message = new RoleRemovedEvent(mind.Owner, mind.Comp, update);
             RaiseLocalEvent(mind.Comp.OwnedEntity.Value, message, true);
         }
 
@@ -267,10 +357,9 @@ public abstract class SharedRoleSystem : EntitySystem
     /// Finds the first mind role of a specific T type on a mind entity.
     /// Outputs entity components for the mind role's MindRoleComponent and for T
     /// </summary>
-    /// <param name="mindId">The mind entity</param>
+    /// <param name="mind">The mind entity</param>
     /// <typeparam name="T">The type of the role to find.</typeparam>
     /// <param name="role">The Mind Role entity component</param>
-    /// <param name="roleT">The Mind Role's entity component for T</param>
     /// <returns>True if the role is found</returns>
     public bool MindHasRole<T>(Entity<MindComponent?> mind,
         [NotNullWhen(true)] out Entity<MindRoleComponent, T>? role) where T : IComponent
@@ -467,7 +556,7 @@ public abstract class SharedRoleSystem : EntitySystem
         return CheckAntagonistStatus(mindId.Value).ExclusiveAntag;
     }
 
-   public (bool Antag, bool ExclusiveAntag) CheckAntagonistStatus(Entity<MindComponent?> mind)
+   private (bool Antag, bool ExclusiveAntag) CheckAntagonistStatus(Entity<MindComponent?> mind)
    {
        if (!Resolve(mind.Owner, ref mind.Comp))
            return (false, false);
@@ -537,3 +626,12 @@ public abstract class SharedRoleSystem : EntitySystem
         return antag.Requirements;
     }
 }
+
+/// <summary>
+/// Raised on the client to update Role Type on the character window, in case it happened to be open.
+/// </summary>
+[Serializable, NetSerializable]
+public sealed class MindRoleTypeChangedEvent : EntityEventArgs
+{
+
+}
diff --git a/Content.Shared/Roles/SiliconBrainRoleComponent.cs b/Content.Shared/Roles/SiliconBrainRoleComponent.cs
new file mode 100644 (file)
index 0000000..72ad0a8
--- /dev/null
@@ -0,0 +1,9 @@
+namespace Content.Shared.Roles;
+
+/// <summary>
+///     Used on Silicon's minds to get the appropriate mind role
+/// </summary>
+[RegisterComponent]
+public sealed partial class SiliconBrainRoleComponent : BaseMindRoleComponent
+{
+}
diff --git a/Content.Shared/Roles/StartingMindRoleComponent.cs b/Content.Shared/Roles/StartingMindRoleComponent.cs
new file mode 100644 (file)
index 0000000..768307d
--- /dev/null
@@ -0,0 +1,27 @@
+using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Roles;
+
+/// <summary>
+/// This is most likely not the component you are looking for, almost nothing should be using this.
+/// Consider using GhostRoleComponent or AntagSelectionComponent instead.
+///
+/// The specified mind role will be added to the mob on spawn.
+///
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class StartingMindRoleComponent : Component
+{
+    /// <summary>
+    ///     The ID of the mind role to add
+    /// </summary>
+    [DataField(required: true)]
+    public EntProtoId MindRole;
+
+    /// <summary>
+    ///     Add the mind role silently
+    /// </summary>
+    [DataField]
+    public bool Silent = true;
+}
index 587c038557c920736b5ca75ef80c32d2da7934ea..ef4ad98c7c3314bdb9aab309bbec7791e446347b 100644 (file)
@@ -14,3 +14,5 @@ admin-verb-text-make-nuclear-operative = Make Nuclear Operative
 admin-verb-text-make-pirate = Make Pirate
 admin-verb-text-make-head-rev = Make Head Rev
 admin-verb-text-make-thief = Make Thief
+
+admin-overlay-antag-classic = ANTAG
index 1cca5c7a934c9dc92b16cd525fbaa1b73330d157..29bfb978e2140470b5105bbd4ff52327680412d6 100644 (file)
@@ -3,6 +3,7 @@ player-tab-username = Username
 player-tab-character = Character
 player-tab-job = Job
 player-tab-antagonist = Antagonist
+player-tab-roletype = Role Type
 player-tab-playtime = Playtime
 player-tab-show-disconnected = Show Disconnected
 player-tab-overlay = Overlay
diff --git a/Resources/Locale/en-US/mind/role-types.ftl b/Resources/Locale/en-US/mind/role-types.ftl
new file mode 100644 (file)
index 0000000..9b4ce92
--- /dev/null
@@ -0,0 +1,9 @@
+role-type-crew-aligned-name = Crew Aligned
+role-type-solo-antagonist-name = Solo Antagonist
+role-type-team-antagonist-name = Team Antagonist
+role-type-free-agent-name = Free Agent
+role-type-familiar-name = Familiar
+role-type-silicon-name = Silicon
+role-type-silicon-antagonist-name = Altered Silicon
+
+role-type-update-message = Your role is [color = {$color}]{$role}[/color]
index eda6816aa5525c011b67c8b80bcbf0581dad849c..0e38cd266d30244922740cbff46a60097bc65a21 100644 (file)
@@ -19,6 +19,8 @@
     name: ghost-role-information-rat-king-name
     description: ghost-role-information-rat-king-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
@@ -40,6 +42,8 @@
     name: ghost-role-information-remilia-name
     description: ghost-role-information-remilia-description
     rules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
     raffle:
       settings: short
   - type: GhostRoleMobSpawner
@@ -61,6 +65,8 @@
     name: ghost-role-information-cerberus-name
     description: ghost-role-information-cerberus-description
     rules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
@@ -81,6 +87,8 @@
   components:
   - type: GhostRole
     rules: ghost-role-information-rules-default-team-antagonist
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
     name: ghost-role-information-loneop-name
     description: ghost-role-information-loneop-description
     rules: ghost-role-information-loneop-rules
+    mindRoles:
+    - MindRoleGhostRoleSoloAntagonist
   - type: Sprite
     sprite: Markers/jobs.rsi
     layers:
     name: roles-antag-nuclear-operative-commander-name
     description: roles-antag-nuclear-operative-commander-objective
     rules: ghost-role-information-rules-default-team-antagonist
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
 
 - type: entity
   categories: [ HideSpawnMenu, Spawner ]
     name: roles-antag-nuclear-operative-agent-name
     description: roles-antag-nuclear-operative-agent-objective
     rules: ghost-role-information-rules-default-team-antagonist
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
 
 - type: entity
   categories: [ HideSpawnMenu, Spawner ]
     name: roles-antag-nuclear-operative-name
     description: roles-antag-nuclear-operative-objective
     rules: ghost-role-information-rules-default-team-antagonist
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
 
 - type: entity
   categories: [ HideSpawnMenu, Spawner ]
     name: ghost-role-information-space-dragon-name
     description: ghost-role-information-space-dragon-description
     rules: ghost-role-information-space-dragon-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
   - type: Sprite
     layers:
     - state: green
     name: ghost-role-information-space-ninja-name
     description: ghost-role-information-space-ninja-description
     rules: ghost-role-information-antagonist-rules
+    mindRoles:
+    - MindRoleGhostRoleSoloAntagonist
     raffle:
       settings: default
   - type: Sprite
index 7c088eb08c1e99ce974287bcac2220fb80c9efc4..28e4042afb4f22f8a6458a3c1982423ac2f17f3e 100644 (file)
     access: [["SyndicateAgent"], ["NuclearOperative"]]
   - type: SiliconLawProvider
     laws: SyndicateStatic
+    subverted: true
   - type: IntrinsicRadioTransmitter
     channels:
     - Binary
index e88100d22c9959892e2bffca9b64154bdf6b3385..b9374d15ea342890fc1152f99189dcdb1a6d9052 100644 (file)
     name: ghost-role-information-mothroach-name
     description: ghost-role-information-mothroach-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
   - type: Fixtures
     fixtures:
       fix1:
     name: ghost-role-information-monkey-name
     description: ghost-role-information-monkey-description
     rules: ghost-role-information-syndicate-reinforcement-rules
+    mindRoles:
+    # This is for syndicate monkeys that randomly gain sentience, thus have no summoner to team with
+    - MindRoleGhostRoleSoloAntagonist
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
     name: ghost-role-information-mouse-name
     description: ghost-role-information-mouse-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
   - type: GhostTakeoverAvailable
   - type: Speech
     speechSounds: Squeak
     name: ghost-role-information-giant-spider-name
     description: ghost-role-information-giant-spider-description
     rules: ghost-role-information-giant-spider-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: short
   - type: GhostTakeoverAvailable
     allowMovement: true
     description: ghost-role-information-SyndiCat-description
     rules: ghost-role-information-SyndiCat-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index 1db787a66d8407d93637f230581381bbaac5acab..6a20a503153b72cfec9b29043c80f03421561830 100644 (file)
@@ -11,6 +11,8 @@
       name: ghost-role-information-behonker-name
       description: ghost-role-information-behonker-description
       rules: ghost-role-information-antagonist-rules
+      mindRoles:
+      - MindRoleGhostRoleSoloAntagonist
       raffle:
         settings: default
     - type: GhostTakeoverAvailable
index 233b2f903081022478eefb28a2670f6c8890bfe0..45a45e89957fb4288df5fc6318e22bf545fb0a9a 100644 (file)
       name: ghost-role-information-sentient-carp-name
       description: ghost-role-information-sentient-carp-description
       rules: ghost-role-information-space-dragon-summoned-carp-rules
+      mindRoles:
+      - MindRoleGhostRoleTeamAntagonist
       raffle:
         settings: short
     - type: GhostTakeoverAvailable
index b67e3b520ebd8afbc50d31162404e79a07ebdeaf..a26b1511dd6eefdc4df24279475236f0be63adfb 100644 (file)
     prob: 0
     description: ghost-role-information-angry-slimes-description
     rules: ghost-role-information-angry-slimes-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: short
   - type: NpcFactionMember
index c0f7a58f48f18e196b7fd10b33c0e89c902d59ae..bcf10eb8f61f28b3c3c33ba6c098172a3294c99d 100644 (file)
@@ -13,6 +13,8 @@
     name: ghost-role-information-hellspawn-name
     description: ghost-role-information-hellspawn-description
     rules: ghost-role-information-antagonist-rules
+    mindRoles:
+    - MindRoleGhostRoleSoloAntagonist
     raffle:
       settings: default
   - type: RotationVisuals
index 19bf16a94c5e9bf61a26e179ec671a994663d6e6..b6321f40799e63de51f1b5295755712e7ac18c28 100644 (file)
@@ -91,6 +91,8 @@
     name: ghost-role-information-rat-king-name
     description: ghost-role-information-rat-king-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index a313a83fdb01f11c55fe45e2c7d598a77ffa756b..222a4381d84ca71d94b04a48f1ab73cb99c75be5 100644 (file)
@@ -38,6 +38,8 @@
     name: ghost-role-information-revenant-name
     description: ghost-role-information-revenant-description
     rules: ghost-role-information-antagonist-rules
+    mindRoles:
+    - MindRoleGhostRoleSoloAntagonist
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index 5883790b6658a03c2cc9e3274cc84cb963b4539d..682b220ca2f6ff7b2a5dcd6cb87ee6e4fccce0d2 100644 (file)
     name: ghost-role-information-honkbot-name
     description: ghost-role-information-honkbot-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
     name: ghost-role-information-jonkbot-name
     description: ghost-role-information-jonkbot-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: InteractionPopup
     name: ghost-role-information-mimebot-name
     description: ghost-role-information-mimebot-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index 0a866b5b9463262113464e4a776abf14696cd15a..92a75b80ee39f6c0c4bbf186baff577625017fe5 100644 (file)
     - type: GhostRole
       description: ghost-role-information-angry-slimes-description
       rules: ghost-role-information-angry-slimes-rules
+      mindRoles:
+      - MindRoleGhostRoleTeamAntagonist
       raffle:
         settings: short
 
     - type: GhostRole
       description: ghost-role-information-angry-slimes-description
       rules: ghost-role-information-angry-slimes-rules
+      mindRoles:
+      - MindRoleGhostRoleTeamAntagonist
       raffle:
         settings: short
 
     - type: GhostRole
       description: ghost-role-information-angry-slimes-description
       rules: ghost-role-information-angry-slimes-rules
+      mindRoles:
+      - MindRoleGhostRoleTeamAntagonist
       raffle:
         settings: short
index 0dc96ba6f31cbbc8d6f203e5c4a673ad8c277a47..6cc13a00f223883db0553983fd58effa71525362 100644 (file)
     name: ghost-role-information-snail-name
     description: ghost-role-information-snail-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
   - type: GhostTakeoverAvailable
   - type: Emoting
   - type: Sprite
index c750b568b40f645faa8df079c37e1656bb15c932..65137825fc2230706e6a5e13146b258b06be84ba 100644 (file)
@@ -15,6 +15,8 @@
     name: ghost-role-information-space-dragon-name
     description: ghost-role-information-space-dragon-description
     rules: ghost-role-information-space-dragon-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
     - DoorBumpOpener
   - type: Puller
     needsHands: false
-    
+
 - type: entity
   parent: BaseMobDragon
   id: MobDragon
index 272436236c5959d03e18a6eb16447c619bdfc8aa..320a2b9bffe8d7303ad8df06fa0dd076f67fe1be 100644 (file)
@@ -11,6 +11,8 @@
     name: ghost-role-information-remilia-name
     description: ghost-role-information-remilia-description
     rules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
   - type: GhostTakeoverAvailable
   - type: Grammar
     attributes:
@@ -44,6 +46,8 @@
     name: ghost-role-information-cerberus-name
     description: ghost-role-information-cerberus-description
     rules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index dca47e1c83708dd2adeb2841345ea68910a32ad6..e553ed97f30fa18ed2414b66a042e4484b55858c 100644 (file)
@@ -14,6 +14,8 @@
       name: ghost-role-information-guardian-name
       description: ghost-role-information-guardian-description
       rules: ghost-role-information-familiar-rules
+      mindRoles:
+      - MindRoleGhostRoleFamiliar
       raffle:
         settings: default
     - type: GhostTakeoverAvailable
index 215225c93691a50390c34a9dcd144b92fed73a3d..695d84dc9204328004390e458a0e6854f0121249 100644 (file)
@@ -42,6 +42,8 @@
       rules: ghost-role-information-Death-Squad-rules
       raffle:
         settings: short
+      mindRoles:
+      - MindRoleGhostRoleFamiliar
     - type: Loadout
       prototypes: [ DeathSquadGear ]
       roleLoadout: [ RoleSurvivalEVA ]
index 1877b3fbcf898e13ec98323ab53f4341369821ef..0c6f481263239f7397d73ced4f0a0d236b08e86a 100644 (file)
     unlistedNumber: true
     requiresPower: false
   - type: Holopad
-  - type: StationAiWhitelist  
+  - type: StationAiWhitelist
   - type: UserInterface
     interfaces:
         enum.HolopadUiKey.AiRequestWindow:
     - HideContextMenu
     - StationAi
     - NoConsoleSound
+  - type: StartingMindRole
+    mindRole: "MindRoleSiliconBrain"
+    silent: true
 
 # Hologram projection that the AI's eye tracks.
 - type: entity
       cell_slot:
         name: power-cell-slot-component-slot-name-default
         startingItem: PowerCellMedium
+  - type: StartingMindRole
+    mindRole: "MindRoleSiliconBrain"
+    silent: true
 
 - type: entity
   id: PlayerBorgSyndicateAssaultBattery
index e10e2928ab2e9078977cf4d137ec65652515e0a3..f5b5f6ac197e8151e954726e3dc993715de4213f 100644 (file)
@@ -18,6 +18,8 @@
     name: ghost-role-information-skeleton-pirate-name
     description: ghost-role-information-skeleton-pirate-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
@@ -35,6 +37,8 @@
     name: ghost-role-information-skeleton-biker-name
     description: ghost-role-information-skeleton-biker-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
@@ -51,6 +55,8 @@
     name: ghost-role-information-closet-skeleton-name
     description: ghost-role-information-closet-skeleton-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable
index 42d5588202c3675f14340260d2250148eb055316..79a10b628715d4ee8ea5eedde80301f73056f0ac 100644 (file)
@@ -26,6 +26,8 @@
     name: ghost-role-information-syndicate-reinforcement-spy-name
     description: ghost-role-information-syndicate-reinforcement-spy-description
     rules: ghost-role-information-syndicate-reinforcement-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
@@ -43,6 +45,8 @@
     name: ghost-role-information-nukeop-reinforcement-name
     description: ghost-role-information-nukeop-reinforcement-description
     rules: ghost-role-information-nukeop-reinforcement-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
@@ -58,6 +62,8 @@
     name: ghost-role-information-syndicate-monkey-reinforcement-name
     description: ghost-role-information-syndicate-monkey-reinforcement-description
     rules: ghost-role-information-syndicate-reinforcement-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
@@ -85,6 +91,8 @@
     name: ghost-role-information-SyndiCat-name
     description: ghost-role-information-SyndiCat-description
     rules: ghost-role-information-syndicate-reinforcement-rules
+    mindRoles:
+    - MindRoleGhostRoleTeamAntagonist
     raffle:
       settings: default
   - type: GhostRoleMobSpawner
       name: ghost-role-information-syndicate-cyborg-assault-name
       description: ghost-role-information-syndicate-cyborg-description
       rules: ghost-role-information-silicon-rules
+      mindRoles:
+      - MindRoleGhostRoleSilicon
       raffle:
         settings: default
     - type: GhostRoleMobSpawner
index b4af7f010e0d24790be3ccede5c10fcf7ee1413a..19aec6e0e28abe4dcfe4062172200d064d072aec 100644 (file)
@@ -38,6 +38,8 @@
     roleName: pai-system-role-name
     roleDescription: pai-system-role-description
     roleRules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
     wipeVerbText: pai-system-wipe-device-verb-text
     wipeVerbPopup: pai-system-wiped-device
     stopSearchVerbText: pai-system-stop-searching-verb-text
@@ -91,6 +93,8 @@
     roleName: pai-system-role-name-syndicate
     roleDescription: pai-system-role-description-syndicate
     roleRules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
   - type: IntrinsicRadioTransmitter
     channels:
     - Syndicate
     roleName: pai-system-role-name-potato
     roleDescription: pai-system-role-description-potato
     roleRules: ghost-role-information-familiar-rules
+    mindRoles:
+    - MindRoleGhostRoleFamiliar
   - type: Appearance
   - type: GenericVisualizer
     visuals:
index 33eabbb60b52d553577f64813dd00bb80e65b05e..8f181900b70595211edbbd4fea297206b46c06c1 100644 (file)
@@ -89,6 +89,8 @@
       roleName: positronic-brain-role-name
       roleDescription: positronic-brain-role-description
       roleRules: ghost-role-information-silicon-rules
+      mindRoles:
+      - MindRoleGhostRoleSilicon
       wipeVerbText: positronic-brain-wipe-device-verb-text
       wipeVerbPopup: positronic-brain-wiped-device
       stopSearchVerbText: positronic-brain-stop-searching-verb-text
index 6ca322d0d5f731fc0c7d767e1ecd30207fc82f51..611b3b6abde06882aa728c51ea76f0b5d034424e 100644 (file)
     definitions:
     - prefRoles: [ Traitor ]
       mindRoles:
-      - MindRoleTraitor
+      - MindRoleTraitorReinforcement
 
 - type: entity
   id: Revolutionary
index 926ce512b4141bed350030422ba28865b31c3554..e32c173870e72875e74821b79b09867fc09e7fae 100644 (file)
   components:
   - type: ObserverRole
 
-#Ghostrole Marker
+#Ghost Roles
 - type: entity
   parent: BaseMindRole
-  id: MindRoleGhostMarker
+  id: MindRoleGhostRoleNeutral
   name: Ghost Role
   components:
   - type: GhostRoleMarkerRole
 
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleFamiliar
+  name: Ghost Role (Familiar)
+  components:
+  - type: MindRole
+    roleType: Familiar
+  - type: GhostRoleMarkerRole
+
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleFreeAgent
+  name: Ghost Role (Free Agent)
+  components:
+  - type: MindRole
+    roleType: FreeAgent
+  - type: GhostRoleMarkerRole
+
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleSilicon
+  name: Ghost Role (Silicon)
+  components:
+  - type: MindRole
+    roleType: Silicon
+  - type: GhostRoleMarkerRole
+
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleSiliconAntagonist
+  name: Ghost Role (Silicon Antagonist)
+  components:
+  - type: MindRole
+    roleType: SiliconAntagonist
+  - type: GhostRoleMarkerRole
+
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleSoloAntagonist
+  name: Ghost Role (Solo Antagonist)
+  components:
+  - type: MindRole
+    roleType: SoloAntagonist
+  - type: GhostRoleMarkerRole
+
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleGhostRoleTeamAntagonist
+  name: Ghost Role (Team Antagonist)
+  components:
+  - type: MindRole
+    roleType: TeamAntagonist
+  - type: GhostRoleMarkerRole
+
+
+
 # The Job MindRole holds the mob's Job prototype
 - type: entity
   parent: BaseMindRole
 #  description:
   # MindRoleComponent.JobPrototype is filled by SharedJobSystem
 
-# Subverted Silicon
+# Silicon
+- type: entity
+  parent: BaseMindRole
+  id: MindRoleSiliconBrain
+  name: Borg Brain Role
+  components:
+  - type: MindRole
+    roleType: Silicon
+  - type: SiliconBrainRole
+
 - type: entity
   parent: BaseMindRoleAntag
   id: MindRoleSubvertedSilicon
   name: Subverted Silicon Role
   description:
   components:
-  - type: SubvertedSiliconRole
   - type: MindRole
     antagPrototype: SubvertedSilicon
+    roleType: SiliconAntagonist
+  - type: SubvertedSiliconRole
 
 # Dragon
 - type: entity
   components:
   - type: MindRole
     antagPrototype: Dragon
+    roleType: TeamAntagonist
     exclusiveAntag: true
   - type: DragonRole
   - type: RoleBriefing
   components:
   - type: MindRole
     antagPrototype: SpaceNinja
+    roleType: SoloAntagonist
     exclusiveAntag: true
   - type: NinjaRole
 
 #  description: mind-role-nukeops-description
   components:
   - type: MindRole
+    roleType: TeamAntagonist
     exclusiveAntag: true
     antagPrototype: Nukeops
   - type: NukeopsRole
   - type: MindRole
     antagPrototype: HeadRev
     exclusiveAntag: true
+    roleType: TeamAntagonist
   - type: RevolutionaryRole
 
 - type: entity
   components:
   - type: MindRole
     antagPrototype: Thief
+    roleType: SoloAntagonist
   - type: ThiefRole
 
 # Traitors
   - type: MindRole
     antagPrototype: Traitor
     exclusiveAntag: true
+    roleType: SoloAntagonist
   - type: TraitorRole
 
 - type: entity
   - type: MindRole
     antagPrototype: TraitorSleeper
 
+- type: entity
+  parent: MindRoleTraitor
+  id: MindRoleTraitorReinforcement
+  name: Syndicate Reinforcement Role
+  #  description: mind-role-syndicate-reinforcement-description
+  components:
+    - type: MindRole
+      roleType: TeamAntagonist
+
 # Zombie Squad
 - type: entity
   parent: BaseMindRoleAntag
   - type: MindRole
     antagPrototype: InitialInfected
     exclusiveAntag: true
+    roleType: TeamAntagonist
   - type: InitialInfectedRole
 
 - type: entity
   - type: MindRole
     antagPrototype: Zombie
     exclusiveAntag: true
+    roleType: TeamAntagonist
   - type: ZombieRole
diff --git a/Resources/Prototypes/Roles/role_types.yml b/Resources/Prototypes/Roles/role_types.yml
new file mode 100644 (file)
index 0000000..326abe4
--- /dev/null
@@ -0,0 +1,37 @@
+# For use by Role Types
+# Do not touch these
+
+- type: roleType
+  id: Neutral
+  name: role-type-crew-aligned-name
+  color: '#eeeeee'
+
+- type: roleType
+  id: SoloAntagonist
+  name: role-type-solo-antagonist-name
+  color: '#d82000'
+
+- type: roleType
+  id: TeamAntagonist
+  name: role-type-team-antagonist-name
+  color: '#d82000'
+
+- type: roleType
+  id: FreeAgent
+  name: role-type-free-agent-name
+  color: '#ffff00'
+
+- type: roleType
+  id: Familiar
+  name: role-type-familiar-name
+  color: '#6495ed'
+
+- type: roleType
+  id: Silicon
+  name: role-type-silicon-name
+  color: '#6495ed'
+
+- type: roleType
+  id: SiliconAntagonist
+  name: role-type-silicon-antagonist-name
+  color: '#c832e6'
index 92341a9409645c0a0d61aeea81f00fb61512a877..22581068d2b99afb04bcaf79e1e78872f66ba8b5 100644 (file)
     name: ghost-role-information-artifact-name
     description: ghost-role-information-artifact-description
     rules: ghost-role-information-freeagent-rules
+    mindRoles:
+    - MindRoleGhostRoleFreeAgent
     raffle:
       settings: default
   - type: GhostTakeoverAvailable