Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Nov 19, 2023
1 parent 412a626 commit cb8cb9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Robust.Server/GameStates/PvsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ internal GameTick CalculateEntityStates(ICommonSession session,
{
(uid, meta) = GetEntityData(netEntity);
changed = _compChangePool.Get();
entityStates.Add(GetFullEntityState(session, uid, meta, changed));
var netComps = _netCompPool.Get();
entityStates.Add(GetFullEntityState(session, uid, meta, netComps, changed));
continue;
}

Expand Down Expand Up @@ -1294,10 +1295,14 @@ private EntityState GetEntityState(ICommonSession? player, EntityUid entityUid,
/// <summary>
/// Variant of <see cref="GetEntityState"/> that includes all entity data, including data that can be inferred implicitly from the entity prototype.
/// </summary>
private EntityState GetFullEntityState(ICommonSession player, EntityUid entityUid, MetaDataComponent meta, List<ComponentChange> changed)
private EntityState GetFullEntityState(
ICommonSession player,
EntityUid entityUid,
MetaDataComponent meta,
HashSet<ushort> netComps,
List<ComponentChange> changed)
{
var bus = EntityManager.EventBus;
var netComps = _netCompPool.Get();

foreach (var (netId, component) in meta.NetComponents)
{
Expand Down
4 changes: 3 additions & 1 deletion Robust.Server/GameStates/ServerGameStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void PrintPvsAckInfo(IConsoleShell shell, string argstr, string[] args)
.Select(x => x.Key)
.Select(x => $"{x.Name} ({_entityManager.ToPrettyString(x.AttachedEntity)})");

var deletedNents = new List<NetEntity>();
var deletedNents = _nentListPool.Get();
_pvs.GetDeletedEntities(GameTick.First, deletedNents);

shell.WriteLine($@"Current tick: {_gameTiming.CurTick}
Expand All @@ -118,6 +118,8 @@ private void PrintPvsAckInfo(IConsoleShell shell, string argstr, string[] args)
Actual oldest: {ack}
Oldest acked clients: {string.Join(", ", players)}
");

_nentListPool.Return(deletedNents);
}

private void ResetParallelism()
Expand Down

0 comments on commit cb8cb9b

Please sign in to comment.