diff --git a/Content.Shared/Roles/SharedRoleSystem.cs b/Content.Shared/Roles/SharedRoleSystem.cs index f758a7c8f82adc..f90f01a830c01c 100644 --- a/Content.Shared/Roles/SharedRoleSystem.cs +++ b/Content.Shared/Roles/SharedRoleSystem.cs @@ -3,8 +3,10 @@ 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; @@ -31,6 +33,15 @@ public override void Initialize() Subs.CVar(_cfg, CCVars.GameRoleTimerOverride, SetRequirementOverride, true); SubscribeLocalEvent(OnComponentShutdown); + SubscribeLocalEvent(OnSpawn); + } + + private void OnSpawn(EntityUid uid, StartingMindRoleComponent component, PlayerSpawnCompleteEvent args) + { + if (!_minds.TryGetMind(uid, out var mindId, out _)) + return; + + MindAddRole(mindId, component.MindRole , silent:component.Silent); } private void SetRequirementOverride(string value) diff --git a/Content.Shared/Roles/StartingMindRoleComponent.cs b/Content.Shared/Roles/StartingMindRoleComponent.cs new file mode 100644 index 00000000000000..768307d391c1ab --- /dev/null +++ b/Content.Shared/Roles/StartingMindRoleComponent.cs @@ -0,0 +1,27 @@ +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Roles; + +/// +/// 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. +/// +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class StartingMindRoleComponent : Component +{ + /// + /// The ID of the mind role to add + /// + [DataField(required: true)] + public EntProtoId MindRole; + + /// + /// Add the mind role silently + /// + [DataField] + public bool Silent = true; +} diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs index ca7d7d9a090a54..827bb351b0784c 100644 --- a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs +++ b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs @@ -1,13 +1,10 @@ using Content.Shared.Containers.ItemSlots; -using Content.Shared.GameTicking; using Content.Shared.IdentityManagement; using Content.Shared.Item.ItemToggle; -using Content.Shared.Mind; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; using Content.Shared.Popups; using Content.Shared.PowerCell.Components; -using Content.Shared.Roles; using Content.Shared.Silicons.Borgs.Components; using Content.Shared.UserInterface; using Content.Shared.Wires; @@ -21,8 +18,6 @@ namespace Content.Shared.Silicons.Borgs; public abstract partial class SharedBorgSystem : EntitySystem { [Dependency] protected readonly SharedContainerSystem Container = default!; - [Dependency] private readonly SharedMindSystem _mind = default!; - [Dependency] private readonly SharedRoleSystem _roles = default!; [Dependency] protected readonly ItemSlotsSystem ItemSlots = default!; [Dependency] protected readonly ItemToggleSystem Toggle = default!; [Dependency] protected readonly SharedPopupSystem Popup = default!; @@ -37,32 +32,13 @@ public override void Initialize() SubscribeLocalEvent(OnItemSlotEjectAttempt); SubscribeLocalEvent(OnInserted); SubscribeLocalEvent(OnRemoved); - SubscribeLocalEvent(OnSpawn); SubscribeLocalEvent(OnRefreshMovementSpeedModifiers); SubscribeLocalEvent(OnUIOpenAttempt); - SubscribeLocalEvent(OnTryGetIdentityShortInfo); InitializeRelay(); } - private void OnSpawn(EntityUid uid, BorgChassisComponent component, PlayerSpawnCompleteEvent args) - { - RoundStartSilicon(args.Mob); - } - - /// - /// Borgs and AI that enter the game through the normal StationSpawningSystem get their Silicon mindrole here - /// - public void RoundStartSilicon(EntityUid uid) - { - if (!_mind.TryGetMind(uid, out var mindId, out _)) - return; - - if (!_roles.MindHasRole(mindId)) - _roles.MindAddRole(mindId, "MindRoleSiliconBrain", silent: true); - } - private void OnTryGetIdentityShortInfo(TryGetIdentityShortInfoEvent args) { if (args.Handled) diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs index e11b9a4b9ae158..4937e6e84c2707 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs @@ -6,7 +6,6 @@ using Content.Shared.Doors.Systems; using Content.Shared.DoAfter; using Content.Shared.Electrocution; -using Content.Shared.GameTicking; using Content.Shared.Intellicard; using Content.Shared.Interaction; using Content.Shared.Item.ItemToggle; @@ -16,7 +15,6 @@ using Content.Shared.Popups; using Content.Shared.Power; using Content.Shared.Power.EntitySystems; -using Content.Shared.Silicons.Borgs; using Content.Shared.StationAi; using Content.Shared.Verbs; using Robust.Shared.Audio; @@ -46,7 +44,6 @@ public abstract partial class SharedStationAiSystem : EntitySystem [Dependency] private readonly SharedAirlockSystem _airlocks = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; - [Dependency] private readonly SharedBorgSystem _borg = default!; [Dependency] private readonly SharedContainerSystem _containers = default!; [Dependency] private readonly SharedDoorSystem _doors = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; @@ -92,7 +89,6 @@ public override void Initialize() SubscribeLocalEvent(OnAiAccessible); SubscribeLocalEvent(OnAiInRange); SubscribeLocalEvent(OnAiMenu); - SubscribeLocalEvent(OnSpawn); SubscribeLocalEvent(OnHolderInit); SubscribeLocalEvent(OnHolderRemove); @@ -110,11 +106,6 @@ public override void Initialize() SubscribeLocalEvent>(OnCoreVerbs); } - private void OnSpawn(EntityUid uid, StationAiOverlayComponent component, PlayerSpawnCompleteEvent args) - { - _borg.RoundStartSilicon(args.Mob); - } - private void OnCoreVerbs(Entity ent, ref GetVerbsEvent args) { if (!_admin.IsAdmin(args.User) || diff --git a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml index 272e28e91c4c8d..ff5d02be0e2d54 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml @@ -378,7 +378,7 @@ unlistedNumber: true requiresPower: false - type: Holopad - - type: StationAiWhitelist + - type: StationAiWhitelist - type: UserInterface interfaces: enum.HolopadUiKey.AiRequestWindow: @@ -441,6 +441,9 @@ - HideContextMenu - StationAi - NoConsoleSound + - type: StartingMindRole + mindRole: "MindRoleSiliconBrain" + silent: true # Hologram projection that the AI's eye tracks. - type: entity @@ -504,6 +507,9 @@ cell_slot: name: power-cell-slot-component-slot-name-default startingItem: PowerCellMedium + - type: StartingMindRole + mindRole: "MindRoleSiliconBrain" + silent: true - type: entity id: PlayerBorgSyndicateAssaultBattery