Add briefcase in hand & update setoutfit (#11634)

This commit is contained in:
Morb
2022-10-16 00:22:27 +03:00
committed by GitHub
parent 58f88887d8
commit 5af82ebe9b
4 changed files with 26 additions and 20 deletions

View File

@@ -1,5 +1,7 @@
using Content.Server.Administration.UI; using Content.Server.Administration.UI;
using Content.Server.EUI; using Content.Server.EUI;
using Content.Server.Hands.Components;
using Content.Server.Hands.Systems;
using Content.Server.Preferences.Managers; using Content.Server.Preferences.Managers;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Inventory; using Content.Shared.Inventory;
@@ -17,6 +19,9 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Admin)] [AdminCommand(AdminFlags.Admin)]
sealed class SetOutfitCommand : IConsoleCommand sealed class SetOutfitCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IPrototypeManager _prototypes = default!;
public string Command => "setoutfit"; public string Command => "setoutfit";
public string Description => Loc.GetString("set-outfit-command-description", ("requiredComponent", nameof(InventoryComponent))); public string Description => Loc.GetString("set-outfit-command-description", ("requiredComponent", nameof(InventoryComponent)));
@@ -37,17 +42,15 @@ namespace Content.Server.Administration.Commands
return; return;
} }
var entityManager = IoCManager.Resolve<IEntityManager>();
var target = new EntityUid(entityUid); 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")); shell.WriteLine(Loc.GetString("shell-invalid-entity-id"));
return; return;
} }
if (!entityManager.HasComponent<InventoryComponent?>(target)) if (!_entities.HasComponent<InventoryComponent?>(target))
{ {
shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory"))); shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory")));
return; return;
@@ -67,7 +70,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
if (!SetOutfit(target, args[1], entityManager)) if (!SetOutfit(target, args[1], _entities))
shell.WriteLine(Loc.GetString("set-outfit-command-invalid-outfit-id-error")); 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; profile = prefs.SelectedCharacter as HumanoidCharacterProfile;
} }
var invSystem = EntitySystem.Get<InventorySystem>(); var invSystem = entityManager.System<InventorySystem>();
if (invSystem.TryGetSlots(target, out var slotDefinitions, inventoryComponent)) if (invSystem.TryGetSlots(target, out var slotDefinitions, inventoryComponent))
{ {
foreach (var slot in slotDefinitions) 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<HandsSystem>();
var coords = entityManager.GetComponent<TransformComponent>(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; return true;
} }
} }

View File

@@ -7,18 +7,6 @@
contents: contents:
- id: BoxSurvival - 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 - type: entity
noSpawn: true noSpawn: true
parent: ClothingBackpackClown parent: ClothingBackpackClown

View File

@@ -14,9 +14,11 @@
id: LawyerGear id: LawyerGear
equipment: equipment:
jumpsuit: ClothingUniformJumpsuitLawyerBlack # TODO change jumpsuit to randomiser of the 4 variants jumpsuit: ClothingUniformJumpsuitLawyerBlack # TODO change jumpsuit to randomiser of the 4 variants
back: ClothingBackpackBriefcaseFilled back: ClothingBackpackFilled
shoes: ClothingShoesBootsLaceup shoes: ClothingShoesBootsLaceup
id: LawyerPDA id: LawyerPDA
ears: ClothingHeadsetSecurity ears: ClothingHeadsetSecurity
# TODO add copy of space law # TODO add copy of space law
inhand:
right hand: BriefcaseBrownFilled
innerclothingskirt: ClothingUniformJumpskirtLawyerBlack innerclothingskirt: ClothingUniformJumpskirtLawyerBlack

View File

@@ -13,10 +13,12 @@
id: LibrarianGear id: LibrarianGear
equipment: equipment:
jumpsuit: ClothingUniformJumpsuitLibrarian jumpsuit: ClothingUniformJumpsuitLibrarian
back: ClothingBackpackBriefcaseFilled back: ClothingBackpackFilled
shoes: ClothingShoesBootsLaceup shoes: ClothingShoesBootsLaceup
id: LibrarianPDA id: LibrarianPDA
ears: ClothingHeadsetService ears: ClothingHeadsetService
pocket1: d10Dice pocket1: d10Dice
inhand:
right hand: BriefcaseBrownFilled
innerclothingskirt: ClothingUniformJumpskirtColorLightBrown innerclothingskirt: ClothingUniformJumpskirtColorLightBrown