Network entity ids (#4252)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:55 +10:00
committed by GitHub
parent cb1d4ae843
commit 3fd731d917
131 changed files with 3266 additions and 1480 deletions

View File

@@ -42,8 +42,6 @@ namespace Robust.Server.GameObjects
private ISawmill _netEntSawmill = default!;
protected override int NextEntityUid { get; set; } = (int) EntityUid.FirstUid;
public override void Initialize()
{
_netEntSawmill = LogManager.GetSawmill("net.ent");
@@ -54,9 +52,9 @@ namespace Robust.Server.GameObjects
base.Initialize();
}
EntityUid IServerEntityManagerInternal.AllocEntity(EntityPrototype? prototype, EntityUid uid)
EntityUid IServerEntityManagerInternal.AllocEntity(EntityPrototype? prototype)
{
return AllocEntity(prototype, out _, uid);
return AllocEntity(prototype, out _);
}
void IServerEntityManagerInternal.FinishEntityLoad(EntityUid entity, IEntityLoadContext? context)
@@ -79,15 +77,15 @@ namespace Robust.Server.GameObjects
StartEntity(entity);
}
private protected override EntityUid CreateEntity(string? prototypeName, EntityUid uid = default, IEntityLoadContext? context = null)
private protected override EntityUid CreateEntity(string? prototypeName, IEntityLoadContext? context = null)
{
if (prototypeName == null)
return base.CreateEntity(prototypeName, uid, context);
return base.CreateEntity(prototypeName, context);
if (!PrototypeManager.TryIndex<EntityPrototype>(prototypeName, out var prototype))
throw new EntityCreationException($"Attempted to spawn an entity with an invalid prototype: {prototypeName}");
var entity = base.CreateEntity(prototype, uid, context);
var entity = base.CreateEntity(prototype, context);
// At this point in time, all data configure on the entity *should* be purely from the prototype.
// As such, we can reset the modified ticks to Zero,