diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 6da5f59c4a..93581796ac 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -476,9 +476,10 @@ namespace Content.Server.GameTicking { GridCoordinates coordinates = lateJoin ? GetLateJoinSpawnPoint() : GetJobSpawnPoint(job.Prototype.ID); var entity = _entityManager.SpawnEntity(PlayerPrototypeName, coordinates); + var startingGear = _prototypeManager.Index(job.StartingGear); if (entity.TryGetComponent(out InventoryComponent inventory)) { - var gear = _prototypeManager.Index(job.StartingGear).Equipment; + var gear = startingGear.Equipment; foreach (var (slot, equipmentStr) in gear) { @@ -487,6 +488,16 @@ namespace Content.Server.GameTicking } } + if (entity.TryGetComponent(out HandsComponent handsComponent)) + { + var inhand = startingGear.Inhand; + foreach (var (hand, prototype) in inhand) + { + var inhandEntity = _entityManager.SpawnEntity(prototype, entity.Transform.GridPosition); + handsComponent.PutInHand(inhandEntity.GetComponent(), hand); + } + } + return entity; } diff --git a/Content.Shared/Jobs/StartingGearPrototype.cs b/Content.Shared/Jobs/StartingGearPrototype.cs index 5fc9b9a877..154e0dbe3e 100644 --- a/Content.Shared/Jobs/StartingGearPrototype.cs +++ b/Content.Shared/Jobs/StartingGearPrototype.cs @@ -15,6 +15,12 @@ namespace Content.Shared.Jobs private string _id; private Dictionary _equipment; + public IReadOnlyDictionary Inhand => _inHand; + /// + /// hand index, item prototype + /// + private Dictionary _inHand; + [ViewVariables] public string ID => _id; [ViewVariables] public IReadOnlyDictionary Equipment => _equipment; @@ -24,6 +30,7 @@ namespace Content.Shared.Jobs var serializer = YamlObjectSerializer.NewReader(mapping); serializer.DataField(ref _id, "id", string.Empty); + serializer.DataField(ref _inHand, "inhand", new Dictionary(0)); var equipment = serializer.ReadDataField>("equipment");