Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TryFindComponentOnEntityContainerOrParent no fail please #5322

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Robust.Shared/Containers/SharedContainerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,12 @@ public bool IsEntityOrParentInContainer(
public bool TryFindComponentOnEntityContainerOrParent<T>(
EntityUid uid,
EntityQuery<T> entityQuery,
[NotNullWhen(true)] ref T? foundComponent,
[NotNullWhen(true)] out T? foundComponent,
MetaDataComponent? meta = null,
TransformComponent? xform = null) where T : IComponent
{
foundComponent = default;

if (!MetaQuery.Resolve(uid, ref meta))
return false;

Expand All @@ -377,10 +379,10 @@ public bool TryFindComponentOnEntityContainerOrParent<T>(
if (!xform.ParentUid.Valid)
return false;

if (entityQuery.Resolve(xform.ParentUid, ref foundComponent, false))
if (entityQuery.TryComp(xform.ParentUid, out foundComponent))
return true;

return TryFindComponentOnEntityContainerOrParent(xform.ParentUid, entityQuery, ref foundComponent);
return TryFindComponentOnEntityContainerOrParent(xform.ParentUid, entityQuery, out foundComponent);
}

/// <summary>
Expand Down
Loading