diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index 58c133a42d..109c5149cb 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -34,6 +34,9 @@ using Content.Server.Traitor.Uplink; using Robust.Shared.Audio; using Robust.Shared.Configuration; using Robust.Shared.Player; +using Content.Server.Administration.Commands; +using Content.Shared.Preferences; +using Content.Server.Preferences.Managers; namespace Content.Server.GameTicking.Rules; @@ -42,6 +45,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; + [Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; @@ -541,7 +545,11 @@ public sealed class NukeopsRuleSystem : GameRuleSystem if (!TryComp(spawner, out var nukeOpSpawner)) return; - SetupOperativeEntity(uid, nukeOpSpawner.OperativeName, nukeOpSpawner.OperativeStartingGear); + HumanoidCharacterProfile? profile = null; + if (TryComp(args.Spawned, out ActorComponent? actor)) + profile = _prefs.GetPreferences(actor.PlayerSession.UserId).SelectedCharacter as HumanoidCharacterProfile; + + SetupOperativeEntity(uid, nukeOpSpawner.OperativeName, nukeOpSpawner.OperativeStartingGear, profile); _operativeMindPendingData.Add(uid, nukeOpSpawner.OperativeRolePrototype); } @@ -659,14 +667,14 @@ public sealed class NukeopsRuleSystem : GameRuleSystem /// /// Adds missing nuke operative components, equips starting gear and renames the entity. /// - private void SetupOperativeEntity(EntityUid mob, string name, string gear) + private void SetupOperativeEntity(EntityUid mob, string name, string gear, HumanoidCharacterProfile? profile) { MetaData(mob).EntityName = name; EntityManager.EnsureComponent(mob); EntityManager.EnsureComponent(mob); if(_startingGearPrototypes.TryGetValue(gear, out var gearPrototype)) - _stationSpawningSystem.EquipStartingGear(mob, gearPrototype, null); + _stationSpawningSystem.EquipStartingGear(mob, gearPrototype, profile); _faction.RemoveFaction(mob, "NanoTrasen", false); _faction.AddFaction(mob, "Syndicate", true); @@ -708,7 +716,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem if (sessions.TryGetValue(i, out var session)) { var mob = EntityManager.SpawnEntity(_nukeopsRuleConfig.SpawnEntityPrototype, _random.Pick(spawns)); - SetupOperativeEntity(mob, spawnDetails.Name, spawnDetails.Gear); + var profile = _prefs.GetPreferences(session.UserId).SelectedCharacter as HumanoidCharacterProfile; + SetupOperativeEntity(mob, spawnDetails.Name, spawnDetails.Gear, profile); var newMind = new Mind.Mind(session.UserId) { @@ -754,7 +763,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem return; mind.AddRole(new TraitorRole(mind, _prototypeManager.Index(_nukeopsRuleConfig.OperativeRoleProto))); - _stationSpawningSystem.EquipStartingGear(mind.OwnedEntity.Value, _prototypeManager.Index("SyndicateOperativeGearFull"), null); + SetOutfitCommand.SetOutfit(mind.OwnedEntity.Value, "SyndicateOperativeGearFull", EntityManager); } private void OnStartAttempt(RoundStartAttemptEvent ev) diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index 55df00c3fd..356465aa39 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -1,13 +1,16 @@ using System.Linq; +using Content.Server.Administration.Commands; using Content.Server.Cargo.Systems; using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Configurations; +using Content.Server.Preferences.Managers; using Content.Server.RoundEnd; using Content.Server.Spawners.Components; using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.CCVar; using Content.Shared.CharacterAppearance; +using Content.Shared.Preferences; using Content.Shared.Roles; using Robust.Server.Maps; using Robust.Server.Player; @@ -30,6 +33,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly PricingSystem _pricingSystem = default!; @@ -208,7 +212,8 @@ public sealed class PiratesRuleSystem : GameRuleSystem MetaData(mob).EntityName = name; newMind.TransferTo(mob); - _stationSpawningSystem.EquipStartingGear(mob, pirateGear, null); + var profile = _prefs.GetPreferences(session.UserId).SelectedCharacter as HumanoidCharacterProfile; + _stationSpawningSystem.EquipStartingGear(mob, pirateGear, profile); _pirates.Add(newMind); @@ -227,7 +232,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem { if (!mind.OwnedEntity.HasValue) return; - _stationSpawningSystem.EquipStartingGear(mind.OwnedEntity.Value, _prototypeManager.Index("PirateGear"), null); + SetOutfitCommand.SetOutfit(mind.OwnedEntity.Value, "PirateGear", EntityManager); } private void OnStartAttempt(RoundStartAttemptEvent ev)