ensure the new research server is always valid (#13101)

This commit is contained in:
Nemanja 2022-12-20 00:22:14 -05:00 committed by GitHub
parent bf2f81b878
commit 0b32ca16b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,9 @@ namespace Content.Server.Research.Systems
private void OnStartup(EntityUid uid, ResearchServerComponent component, ComponentStartup args)
{
component.Id = EntityQuery<ResearchServerComponent>(true).Count();
var unusedId = EntityQuery<ResearchServerComponent>(true)
.Max(s => s.Id) + 1;
component.Id = unusedId;
}
public ResearchServerComponent? GetServerById(int id)