Update vomit organ smite to not use Component.owner (#29926)
* Update vomit organ smite to not use Component.owner * is this what you want...? * am I winning, dad? * update the comment * we love entity<t> --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -183,6 +183,30 @@ public partial class SharedBodySystem
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of Entity<<see cref="T"/>, <see cref="OrganComponent"/>>
|
||||
/// for each organ of the body
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The component that we want to return</typeparam>
|
||||
/// <param name="entity">The body to check the organs of</param>
|
||||
public List<Entity<T, OrganComponent>> GetBodyOrganEntityComps<T>(
|
||||
Entity<BodyComponent?> entity)
|
||||
where T : IComponent
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return new List<Entity<T, OrganComponent>>();
|
||||
|
||||
var query = GetEntityQuery<T>();
|
||||
var list = new List<Entity<T, OrganComponent>>(3);
|
||||
foreach (var organ in GetBodyOrgans(entity.Owner, entity.Comp))
|
||||
{
|
||||
if (query.TryGetComponent(organ.Id, out var comp))
|
||||
list.Add((organ.Id, comp, organ.Component));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get a list of ValueTuples of <see cref="T"/> and OrganComponent on each organs
|
||||
/// in the given body.
|
||||
|
||||
Reference in New Issue
Block a user