Revert "Fix UninitializedSaveTest prototypes" (#16169)
This reverts commit 9094727842.
This commit is contained in:
@@ -38,6 +38,64 @@ public sealed class PrototypeSaveTest
|
||||
{
|
||||
"Singularity", // physics collision uses "AllMask" (-1). The flag serializer currently fails to save this because this features un-named bits.
|
||||
"constructionghost",
|
||||
|
||||
// These ones are from the serialization change to alwayswrite.
|
||||
// These should NOT be added to.
|
||||
// 99% of these are going to be changing the physics bodytype (where the entity is anchored)
|
||||
// or some ambientsound change.
|
||||
"GasVentScrubber",
|
||||
"GasPassiveVent",
|
||||
"CableHV",
|
||||
"ParticleAcceleratorFuelChamberUnfinished",
|
||||
"ComfyChair",
|
||||
"PlasticFlapsOpaque",
|
||||
"ParticleAcceleratorEmitterRightUnfinished",
|
||||
"PlasticFlapsAirtightClear",
|
||||
"SignalControlledValve",
|
||||
"SignalControlledValve",
|
||||
"GasPipeTJunction",
|
||||
"GasFilter",
|
||||
"GasOutletInjector",
|
||||
"GasPressurePump",
|
||||
"SurveillanceWirelessCameraAnchoredEntertainment",
|
||||
"GasPort",
|
||||
"Chair",
|
||||
"GasMixer",
|
||||
"ParticleAcceleratorPowerBoxUnfinished",
|
||||
"GasValve",
|
||||
"Thruster",
|
||||
"BoxingBell",
|
||||
"CableApcExtension",
|
||||
"PlasticFlapsClear",
|
||||
"ClothingBackpackChameleon",
|
||||
"AMEControllerUnanchored",
|
||||
"GasPipeFourway",
|
||||
"NuclearBomb",
|
||||
"PlasticFlapsAirtightOpaque",
|
||||
"ParticleAcceleratorControlBoxUnfinished",
|
||||
"GasPipeHalf",
|
||||
"GasVolumePump",
|
||||
"ParticleAcceleratorEmitterLeftUnfinished",
|
||||
"GasMixerFlipped",
|
||||
"ToiletDirtyWater",
|
||||
"GasPipeBend",
|
||||
"ParticleAcceleratorEndCapUnfinished",
|
||||
"GasPipeStraight",
|
||||
"MachineFrameDestroyed",
|
||||
"ChairPilotSeat",
|
||||
"VehicleJanicartDestroyed",
|
||||
"Gyroscope",
|
||||
"ParticleAcceleratorEmitterCenterUnfinished",
|
||||
"ToiletEmpty",
|
||||
"GasPassiveGate",
|
||||
"CableMV",
|
||||
"ClothingBackpackChameleonFill",
|
||||
"GasDualPortVentPump",
|
||||
"GasVentPump",
|
||||
"PressureControlledValve",
|
||||
"GasFilterFlipped",
|
||||
"SurveillanceWirelessCameraAnchoredConstructed",
|
||||
|
||||
};
|
||||
|
||||
[Test]
|
||||
@@ -69,7 +127,7 @@ public sealed class PrototypeSaveTest
|
||||
|
||||
grid = mapManager.CreateGrid(mapId);
|
||||
|
||||
var tileDefinition = tileDefinitionManager["FloorSteel"]; // Wires n such disable ambiance while under the floor
|
||||
var tileDefinition = tileDefinitionManager["UnderPlating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
|
||||
@@ -110,7 +168,6 @@ public sealed class PrototypeSaveTest
|
||||
foreach (var prototype in prototypes)
|
||||
{
|
||||
uid = entityMan.SpawnEntity(prototype.ID, testLocation);
|
||||
context.Prototype = prototype;
|
||||
|
||||
// get default prototype data
|
||||
Dictionary<string, MappingDataNode> protoData = new();
|
||||
@@ -120,11 +177,9 @@ public sealed class PrototypeSaveTest
|
||||
|
||||
foreach (var (compType, comp) in prototype.Components)
|
||||
{
|
||||
context.WritingComponent = compType;
|
||||
protoData.Add(compType, seriMan.WriteValueAs<MappingDataNode>(comp.Component.GetType(), comp.Component, alwaysWrite: true, context: context));
|
||||
}
|
||||
|
||||
context.WritingComponent = string.Empty;
|
||||
context.WritingReadingPrototypes = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -147,7 +202,6 @@ public sealed class PrototypeSaveTest
|
||||
MappingDataNode compMapping;
|
||||
try
|
||||
{
|
||||
context.WritingComponent = compName;
|
||||
compMapping = seriMan.WriteValueAs<MappingDataNode>(compType, component, alwaysWrite: true, context: context);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -192,9 +246,6 @@ public sealed class PrototypeSaveTest
|
||||
public SerializationManager.SerializerProvider SerializerProvider { get; }
|
||||
public bool WritingReadingPrototypes { get; set; }
|
||||
|
||||
public string WritingComponent = string.Empty;
|
||||
public EntityPrototype Prototype = default!;
|
||||
|
||||
public TestEntityUidContext()
|
||||
{
|
||||
SerializerProvider = new();
|
||||
@@ -211,14 +262,6 @@ public sealed class PrototypeSaveTest
|
||||
IDependencyCollection dependencies, bool alwaysWrite = false,
|
||||
ISerializationContext? context = null)
|
||||
{
|
||||
if (WritingComponent != "Transform" && !Prototype.NoSpawn)
|
||||
{
|
||||
// Maybe this will be necessary in the future, but at the moment it just indicates that there is some
|
||||
// issue, like a non-nullable entityUid data-field. If a component MUST have an entity uid to work with,
|
||||
// then the prototype very likely has to be a no-spawn entity that is never meant to be directly spawned.
|
||||
Assert.Fail($"Uninitialized entities should not be saving entity Uids. Component: {WritingComponent}. Prototype: {Prototype.ID}");
|
||||
}
|
||||
|
||||
return new ValueDataNode(value.ToString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user