diff --git a/Content.Server/Administration/Commands/SetOutfitCommand.cs b/Content.Server/Administration/Commands/SetOutfitCommand.cs index cd582ace23..31dc21878e 100644 --- a/Content.Server/Administration/Commands/SetOutfitCommand.cs +++ b/Content.Server/Administration/Commands/SetOutfitCommand.cs @@ -1,5 +1,7 @@ using Content.Server.Administration.UI; using Content.Server.EUI; +using Content.Server.Hands.Components; +using Content.Server.Hands.Systems; using Content.Server.Preferences.Managers; using Content.Shared.Administration; using Content.Shared.Inventory; @@ -17,6 +19,9 @@ namespace Content.Server.Administration.Commands [AdminCommand(AdminFlags.Admin)] sealed class SetOutfitCommand : IConsoleCommand { + [Dependency] private readonly IEntityManager _entities = default!; + [Dependency] private readonly IPrototypeManager _prototypes = default!; + public string Command => "setoutfit"; public string Description => Loc.GetString("set-outfit-command-description", ("requiredComponent", nameof(InventoryComponent))); @@ -37,17 +42,15 @@ namespace Content.Server.Administration.Commands return; } - var entityManager = IoCManager.Resolve(); - var target = new EntityUid(entityUid); - if (!target.IsValid() || !entityManager.EntityExists(target)) + if (!target.IsValid() || !_entities.EntityExists(target)) { shell.WriteLine(Loc.GetString("shell-invalid-entity-id")); return; } - if (!entityManager.HasComponent(target)) + if (!_entities.HasComponent(target)) { shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory"))); return; @@ -67,7 +70,7 @@ namespace Content.Server.Administration.Commands return; } - if (!SetOutfit(target, args[1], entityManager)) + if (!SetOutfit(target, args[1], _entities)) shell.WriteLine(Loc.GetString("set-outfit-command-invalid-outfit-id-error")); } @@ -90,7 +93,7 @@ namespace Content.Server.Administration.Commands profile = prefs.SelectedCharacter as HumanoidCharacterProfile; } - var invSystem = EntitySystem.Get(); + var invSystem = entityManager.System(); if (invSystem.TryGetSlots(target, out var slotDefinitions, inventoryComponent)) { foreach (var slot in slotDefinitions) @@ -115,6 +118,17 @@ namespace Content.Server.Administration.Commands } } + if (entityManager.TryGetComponent(target, out HandsComponent? handsComponent)) + { + var handsSystem = entityManager.System(); + var coords = entityManager.GetComponent(target).Coordinates; + foreach (var (hand, prototype) in startingGear.Inhand) + { + var inhandEntity = entityManager.SpawnEntity(prototype, coords); + handsSystem.TryPickup(target, inhandEntity, hand, checkActionBlocker: false, handsComp: handsComponent); + } + } + return true; } } diff --git a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml index acd250797c..d13f55cab8 100644 --- a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml +++ b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml @@ -7,18 +7,6 @@ contents: - id: BoxSurvival -#This should be temporary, at least until briefcases can spawn in hands. - -- type: entity - noSpawn: true - parent: ClothingBackpack - id: ClothingBackpackBriefcaseFilled - components: - - type: StorageFill - contents: - - id: BoxSurvival - - id: BriefcaseBrownFilled - - type: entity noSpawn: true parent: ClothingBackpackClown diff --git a/Resources/Prototypes/Roles/Jobs/Civilian/lawyer.yml b/Resources/Prototypes/Roles/Jobs/Civilian/lawyer.yml index c5c3719339..0494cb23d2 100644 --- a/Resources/Prototypes/Roles/Jobs/Civilian/lawyer.yml +++ b/Resources/Prototypes/Roles/Jobs/Civilian/lawyer.yml @@ -14,9 +14,11 @@ id: LawyerGear equipment: jumpsuit: ClothingUniformJumpsuitLawyerBlack # TODO change jumpsuit to randomiser of the 4 variants - back: ClothingBackpackBriefcaseFilled + back: ClothingBackpackFilled shoes: ClothingShoesBootsLaceup id: LawyerPDA ears: ClothingHeadsetSecurity # TODO add copy of space law + inhand: + right hand: BriefcaseBrownFilled innerclothingskirt: ClothingUniformJumpskirtLawyerBlack diff --git a/Resources/Prototypes/Roles/Jobs/Civilian/librarian.yml b/Resources/Prototypes/Roles/Jobs/Civilian/librarian.yml index 41e8eb6058..ceaf1ce5d6 100644 --- a/Resources/Prototypes/Roles/Jobs/Civilian/librarian.yml +++ b/Resources/Prototypes/Roles/Jobs/Civilian/librarian.yml @@ -13,10 +13,12 @@ id: LibrarianGear equipment: jumpsuit: ClothingUniformJumpsuitLibrarian - back: ClothingBackpackBriefcaseFilled + back: ClothingBackpackFilled shoes: ClothingShoesBootsLaceup id: LibrarianPDA ears: ClothingHeadsetService pocket1: d10Dice + inhand: + right hand: BriefcaseBrownFilled innerclothingskirt: ClothingUniformJumpskirtColorLightBrown