Fix mapload positions (#3510)

This commit is contained in:
Leon Friedrich
2022-11-21 16:43:11 +13:00
committed by GitHub
parent 762cd786ea
commit 1c3905a8f4
2 changed files with 2 additions and 9 deletions

View File

@@ -647,7 +647,6 @@ public sealed class MapLoaderSystem : EntitySystem
private void StartupEntities(MapData data)
{
_stopwatch.Restart();
DebugTools.Assert(data.Entities.Count == data.Entities.Count);
var metaQuery = GetEntityQuery<MetaDataComponent>();
var rootEntity = data.Entities[0];
var mapQuery = GetEntityQuery<MapComponent>();
@@ -667,22 +666,16 @@ public sealed class MapLoaderSystem : EntitySystem
}
}
var isRoot = true;
for (var i = 1; i < data.Entities.Count; i++)
{
var entity = data.Entities[i];
if (isRoot && xformQuery.TryGetComponent(entity, out var xform) && IsRoot(xform, mapQuery))
if (xformQuery.TryGetComponent(entity, out var xform) && IsRoot(xform, mapQuery))
{
// Don't want to trigger events
xform._localPosition = data.Options.TransformMatrix.Transform(xform.LocalPosition);
xform._localRotation += data.Options.Rotation;
}
else
{
isRoot = false;
}
StartupEntity(entity, metaQuery.GetComponent(entity), data);
}

View File

@@ -40,7 +40,7 @@ namespace Robust.Shared.GameObjects
[ViewVariables]
internal BroadphaseData? Broadphase;
internal bool MatricesDirty = false;
internal bool MatricesDirty = true;
private Matrix3 _localMatrix = Matrix3.Identity;
private Matrix3 _invLocalMatrix = Matrix3.Identity;