Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -70,7 +70,7 @@ public sealed class DecalPlacementSystem : EntitySystem
return false;
var decal = new Decal(coords.Position, _decalId, _decalColor, _decalAngle, _zIndex, _cleanable);
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, coords));
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(coords)));
return true;
},
@@ -90,7 +90,7 @@ public sealed class DecalPlacementSystem : EntitySystem
_erasing = true;
RaiseNetworkEvent(new RequestDecalRemovalEvent(coords));
RaiseNetworkEvent(new RequestDecalRemovalEvent(GetNetCoordinates(coords)));
return true;
}, (session, coords, uid) =>
@@ -128,7 +128,7 @@ public sealed class DecalPlacementSystem : EntitySystem
args.Target = args.Target.Offset(new Vector2(-0.5f, -0.5f));
var decal = new Decal(args.Target.Position, args.DecalId, args.Color, Angle.FromDegrees(args.Rotation), args.ZIndex, args.Cleanable);
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, args.Target));
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(args.Target)));
}
private void OnFillSlot(FillActionSlotEvent ev)

View File

@@ -92,13 +92,16 @@ namespace Content.Client.Decals
private void OnChunkUpdate(DecalChunkUpdateEvent ev)
{
foreach (var (gridId, updatedGridChunks) in ev.Data)
foreach (var (netGrid, updatedGridChunks) in ev.Data)
{
if (updatedGridChunks.Count == 0) continue;
if (updatedGridChunks.Count == 0)
continue;
var gridId = GetEntity(netGrid);
if (!TryComp(gridId, out DecalGridComponent? gridComp))
{
Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
continue;
}
@@ -106,13 +109,16 @@ namespace Content.Client.Decals
}
// Now we'll cull old chunks out of range as the server will send them to us anyway.
foreach (var (gridId, chunks) in ev.RemovedChunks)
foreach (var (netGrid, chunks) in ev.RemovedChunks)
{
if (chunks.Count == 0) continue;
if (chunks.Count == 0)
continue;
var gridId = GetEntity(netGrid);
if (!TryComp(gridId, out DecalGridComponent? gridComp))
{
Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
continue;
}