Add SearchByEntityId (#1935)

This commit is contained in:
MidoriKami 2024-07-16 14:31:03 -04:00 committed by GitHub
parent f5ab8d5e98
commit d966e5338a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -98,6 +98,23 @@ internal sealed partial class ObjectTable : IServiceType, IObjectTable
return null;
}
/// <inheritdoc/>
public IGameObject? SearchByEntityId(uint entityId)
{
_ = this.WarnMultithreadedUsage();
if (entityId is 0 or 0xE0000000)
return null;
foreach (var e in this.cachedObjectTable)
{
if (e.Update() is { } o && o.EntityId == entityId)
return o;
}
return null;
}
/// <inheritdoc/>
public unsafe nint GetObjectAddress(int index)
{