Compare commits

...

3 Commits

Author SHA1 Message Date
metalgearsloth
139b6f796c Version: 248.0.2 2025-03-12 20:26:50 +11:00
metalgearsloth
2ee7c35fd3 Don't throw on invalid MapUids for overlays (#5740) 2025-03-12 20:16:13 +11:00
metalgearsloth
56eae5ad08 Reduce EntityManager.IsDefault allocations (#5741)
* Reduce EntityManager.IsDefault allocations

We don't actually need the MappingDataNode so we can avoid allocating the entire class per entity.

* Adjust this order
2025-03-12 19:42:08 +11:00
5 changed files with 48 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
<Project>
<!-- This file automatically reset by Tools/version.py -->
<!-- This file automatically reset by Tools/version.py -->

View File

@@ -54,8 +54,24 @@ END TEMPLATE-->
*None yet*
## 248.0.2
### Bugfixes
* Don't throw in overlay rendering if MapUid not found.
### Internal
* Reduce EntityManager.IsDefault allocations.
## 248.0.1
### Bugfixes
* Bump ImageSharp version.
* Fix instances of NaN gain for audio where a negative-infinity value is being used for volume.
## 248.0.0

View File

@@ -126,7 +126,7 @@ namespace Robust.Client.Graphics.Clyde
DebugTools.Assert(space != OverlaySpace.ScreenSpaceBelowWorld && space != OverlaySpace.ScreenSpace);
var mapId = vp.Eye!.Position.MapId;
var args = new OverlayDrawArgs(space, null, vp, _renderHandle, new UIBox2i((0, 0), vp.Size), _mapManager.GetMapEntityIdOrThrow(mapId), mapId, worldBox, worldBounds);
var args = new OverlayDrawArgs(space, null, vp, _renderHandle, new UIBox2i((0, 0), vp.Size), _mapSystem.GetMapOrInvalid(mapId), mapId, worldBox, worldBounds);
if (!overlay.BeforeDraw(args))
return;
@@ -178,7 +178,7 @@ namespace Robust.Client.Graphics.Clyde
var worldAABB = worldBounds.CalcBoundingBox();
var mapId = vp.Eye!.Position.MapId;
var args = new OverlayDrawArgs(space, vpControl, vp, handle, bounds, _mapManager.GetMapEntityIdOrThrow(mapId), mapId, worldAABB, worldBounds);
var args = new OverlayDrawArgs(space, vpControl, vp, handle, bounds, _mapSystem.GetMapOrInvalid(mapId), mapId, worldAABB, worldBounds);
foreach (var overlay in list)
{

View File

@@ -189,10 +189,12 @@ namespace Robust.Shared.GameObjects
return false;
var compType = component.GetType();
var compName = _componentFactory.GetComponentName(compType);
if (compName == _xformName || compName == _metaReg.Name)
if (compType == typeof(TransformComponent) || compType == typeof(MetaDataComponent))
continue;
var compName = _componentFactory.GetComponentName(compType);
// If the component isn't on the prototype then it's custom.
if (!protoData.TryGetValue(compName, out var protoMapping))
return false;
@@ -208,9 +210,7 @@ namespace Robust.Shared.GameObjects
return false;
}
var diff = compMapping.Except(protoMapping);
if (diff != null && diff.Children.Count != 0)
if (compMapping.AnyExcept(protoMapping))
return false;
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
@@ -352,6 +353,29 @@ namespace Robust.Shared.Serialization.Markdown.Mapping
return mappingNode._children.Count == 0 ? null : mappingNode;
}
/// <summary>
/// Returns true if there are any nodes on this node that aren't in the other node.
/// </summary>
[Pure]
public bool AnyExcept(MappingDataNode node)
{
foreach (var (key, val) in _list)
{
var other = node._list.FirstOrNull(p => p.Key.Equals(key));
if (other == null)
{
return true;
}
// We only keep the entry if the values are not equal
if (!val.Equals(other.Value.Value))
return true;
}
return false;
}
public override bool Equals(object? obj)
{
if (obj is not MappingDataNode other)