Generalize component trees (#3598)

This commit is contained in:
Leon Friedrich
2022-12-27 15:33:46 +13:00
committed by GitHub
parent ace8500240
commit 054a908efd
35 changed files with 1123 additions and 1196 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Robust.Client.ComponentTrees;
using Robust.Client.GameObjects;
using Robust.Server.Containers;
using Robust.Server.Debugging;
@@ -120,6 +121,7 @@ namespace Robust.UnitTesting
var mapMan = deps.Resolve<IMapManager>();
// Required components for the engine to work
// Why are we still here? Just to suffer? Why can't we just use [RegisterComponent] magic?
var compFactory = deps.Resolve<IComponentFactory>();
if (!compFactory.AllRegisteredTypes.Contains(typeof(MapComponent)))
@@ -157,6 +159,26 @@ namespace Robust.UnitTesting
compFactory.RegisterClass<JointComponent>();
}
if (!compFactory.AllRegisteredTypes.Contains(typeof(OccluderComponent)))
{
compFactory.RegisterClass<OccluderComponent>();
}
if (!compFactory.AllRegisteredTypes.Contains(typeof(OccluderTreeComponent)))
{
compFactory.RegisterClass<OccluderTreeComponent>();
}
if (!compFactory.AllRegisteredTypes.Contains(typeof(SpriteTreeComponent)))
{
compFactory.RegisterClass<SpriteTreeComponent>();
}
if (!compFactory.AllRegisteredTypes.Contains(typeof(LightTreeComponent)))
{
compFactory.RegisterClass<LightTreeComponent>();
}
// So by default EntityManager does its own EntitySystemManager initialize during Startup.
// We want to bypass this and load our own systems hence we will manually initialize it here.
entMan.Initialize();

View File

@@ -257,6 +257,7 @@ namespace Robust.UnitTesting.Server
var compFactory = container.Resolve<IComponentFactory>();
// if only we had some sort of attribute for autmatically registering components.
compFactory.RegisterClass<MetaDataComponent>();
compFactory.RegisterClass<TransformComponent>();
compFactory.RegisterClass<MapGridComponent>();
@@ -269,6 +270,8 @@ namespace Robust.UnitTesting.Server
compFactory.RegisterClass<PhysicsMapComponent>();
compFactory.RegisterClass<FixturesComponent>();
compFactory.RegisterClass<CollisionWakeComponent>();
compFactory.RegisterClass<OccluderComponent>();
compFactory.RegisterClass<OccluderTreeComponent>();
_regDelegate?.Invoke(compFactory);