From 325f7d7d5651532962f8a91b8ec76ebfcf15eb1c Mon Sep 17 00:00:00 2001 From: AJCM-git <60196617+AJCM-git@users.noreply.github.com> Date: Sat, 6 May 2023 10:50:45 -0400 Subject: [PATCH] Revert "Fix UninitializedSaveTest prototypes" --- .../Tests/PrototypeSaveTest.cs | 80 +++++++++++++++++++ .../Entities/Structures/Furniture/chairs.yml | 12 +++ .../Entities/Structures/Wallmounts/bell.yml | 47 +++++++++++ 3 files changed, 139 insertions(+) create mode 100644 Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml diff --git a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs index 527bb62b15c7..2152e88733ed 100644 --- a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs +++ b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs @@ -36,6 +36,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] @@ -108,7 +166,10 @@ await server.WaitAssertion(() => foreach (var prototype in prototypes) { uid = entityMan.SpawnEntity(prototype.ID, testLocation); +<<<<<<< HEAD server.RunTicks(1); +======= +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) // get default prototype data Dictionary protoData = new(); @@ -116,8 +177,15 @@ await server.WaitAssertion(() => { foreach (var (compType, comp) in prototype.Components) { +<<<<<<< HEAD protoData.Add(compType, seriMan.WriteValueAs(comp.Component.GetType(), comp.Component, context: context)); } +======= + protoData.Add(compType, seriMan.WriteValueAs(comp.Component.GetType(), comp.Component, alwaysWrite: true, context: context)); + } + + context.WritingReadingPrototypes = false; +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) } catch (Exception e) { @@ -139,7 +207,11 @@ await server.WaitAssertion(() => MappingDataNode compMapping; try { +<<<<<<< HEAD compMapping = seriMan.WriteValueAs(compType, component, context: context); +======= + compMapping = seriMan.WriteValueAs(compType, component, alwaysWrite: true, context: context); +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) } catch (Exception e) { @@ -181,6 +253,10 @@ private sealed class TestEntityUidContext : ISerializationContext, ITypeSerializer { public SerializationManager.SerializerProvider SerializerProvider { get; } +<<<<<<< HEAD +======= + public bool WritingReadingPrototypes { get; set; } +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) public TestEntityUidContext() { @@ -198,8 +274,12 @@ public DataNode Write(ISerializationManager serializationManager, EntityUid valu IDependencyCollection dependencies, bool alwaysWrite = false, ISerializationContext? context = null) { +<<<<<<< HEAD // EntityUids should be nullable and have no initial value. throw new InvalidOperationException("Serializing prototypes should not attempt to write entity Uids"); +======= + return new ValueDataNode(value.ToString()); +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) } EntityUid ITypeReader.Read(ISerializationManager serializationManager, diff --git a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml index b911e72702fe..b42a0fb2ea20 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml @@ -56,6 +56,10 @@ components: - type: Transform anchored: true +<<<<<<< HEAD +======= + - type: Anchorable +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) - type: Rotatable - type: Sprite state: chair @@ -122,6 +126,10 @@ components: - type: Transform anchored: true +<<<<<<< HEAD +======= + - type: Anchorable +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) - type: Rotatable - type: Sprite state: comfy @@ -137,6 +145,10 @@ components: - type: Transform anchored: true +<<<<<<< HEAD +======= + - type: Anchorable +>>>>>>> de1613f7ef (Revert "Fix UninitializedSaveTest prototypes" (#16169)) - type: Rotatable - type: Sprite state: shuttle diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml new file mode 100644 index 000000000000..e10baa2a1d9b --- /dev/null +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml @@ -0,0 +1,47 @@ +- type: entity + id: BoxingBell + name: boxing bell + description: Ding ding! + placement: + mode: SnapgridCenter + snap: + - Wallmount + components: + - type: Transform + anchored: true + - type: WallMount + - type: Sprite + sprite: Structures/Wallmounts/bell.rsi + layers: + - state: bell + - type: InteractionPopup + successChance: 1 + interactSuccessSound: + path: /Audio/Weapons/boxingbell.ogg + - type: Clickable + - type: MeleeSound + soundGroups: + Brute: + path: + "/Audio/Weapons/boxingbell.ogg" + - type: Appearance + - type: Rotatable + - type: CollisionWake + enabled: false + - type: Physics + canCollide: false + bodyType: Dynamic + - type: Fixtures + - type: Damageable + damageContainer: Inorganic + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 150 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] + - !type:PlaySoundBehavior + sound: + path: /Audio/Effects/metalbreak.ogg