Make starting gear automatically find hands for inhand items (#20861)

This commit is contained in:
DrSmugleaf
2023-10-14 10:28:52 -07:00
committed by GitHub
parent 9e1ecdea76
commit ed15b93926
48 changed files with 105 additions and 107 deletions

View File

@@ -37,10 +37,14 @@ public abstract class SharedStationSpawningSystem : EntitySystem
var inhand = startingGear.Inhand;
var coords = EntityManager.GetComponent<TransformComponent>(entity).Coordinates;
foreach (var (hand, prototype) in inhand)
foreach (var prototype in inhand)
{
var inhandEntity = EntityManager.SpawnEntity(prototype, coords);
_handsSystem.TryPickup(entity, inhandEntity, hand, checkActionBlocker: false, handsComp: handsComponent);
if (_handsSystem.TryGetEmptyHand(entity, out var emptyHand, handsComponent))
{
_handsSystem.TryPickup(entity, inhandEntity, emptyHand, checkActionBlocker: false, handsComp: handsComponent);
}
}
}
}