make legs affect movement speed with body (#12928)

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
Nemanja
2022-12-09 20:08:47 -05:00
committed by GitHub
parent 45b72d4852
commit 9db34a4e8a
20 changed files with 114 additions and 3 deletions

View File

@@ -164,6 +164,32 @@ public partial class SharedBodySystem
}
}
/// <summary>
/// Returns all body part slots in the graph, including ones connected by
/// body parts which are null.
/// </summary>
/// <param name="partId"></param>
/// <param name="part"></param>
/// <returns></returns>
public IEnumerable<BodyPartSlot> GetAllBodyPartSlots(EntityUid partId, BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, false))
yield break;
foreach (var slot in part.Children.Values)
{
if (!TryComp<BodyPartComponent>(slot.Child, out var childPart))
continue;
yield return slot;
foreach (var child in GetAllBodyPartSlots(slot.Child.Value, childPart))
{
yield return child;
}
}
}
public virtual HashSet<EntityUid> GibBody(EntityUid? partId, bool gibOrgans = false,
BodyComponent? body = null, bool deleteItems = false)
{