Fix component removal / PVS bugs (#3275)

This commit is contained in:
Leon Friedrich
2022-10-08 15:22:32 +13:00
committed by GitHub
parent 2898e1413b
commit 7b0c4dd7fb
16 changed files with 138 additions and 175 deletions

View File

@@ -37,6 +37,9 @@ internal sealed class ClientDirtySystem : EntitySystem
private void OnCompRemoved(RemovedComponentEventArgs args)
{
if (args.Terminating)
return;
var comp = args.BaseArgs.Component;
if (!_timing.InPrediction || comp.Owner.IsClientSide() || !comp.NetSyncEnabled)
return;
@@ -45,12 +48,6 @@ internal sealed class ClientDirtySystem : EntitySystem
if (comp.CreationTick > _timing.LastRealTick)
return;
// TODO if entity deletion ever gets predicted, then to speed this function up the component removal event
// should probably get an arg that specifies whether removal is occurring because of entity deletion. AKA: I
// don't want to have to fetch the meta-data component 10+ times for each entity that gets deleted. Currently
// server-induced deletions should get ignored, as _timing.InPrediction will be false while applying game
// states.
var netId = _compFact.GetRegistration(comp).NetID;
if (netId != null)
RemovedComponents.GetOrNew(comp.Owner).Add(netId.Value);