From: AJCM-git <60196617+AJCM-git@users.noreply.github.com> Date: Sat, 6 May 2023 14:50:45 +0000 (-0400) Subject: Revert "Fix UninitializedSaveTest prototypes" (#16169) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=de1613f7ef6c5f3ba556ce9754149cbe5e72b050;p=space-station-14.git Revert "Fix UninitializedSaveTest prototypes" (#16169) This reverts commit 909472784224b277b7232b65d88fb46effcb914f. --- diff --git a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs index eda8e10ae2..15c3416ae1 100644 --- a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs +++ b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs @@ -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 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(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(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()); } diff --git a/Content.Server/Dragon/Components/DragonRiftComponent.cs b/Content.Server/Dragon/Components/DragonRiftComponent.cs index b5c7c79a9d..c1abb67bbe 100644 --- a/Content.Server/Dragon/Components/DragonRiftComponent.cs +++ b/Content.Server/Dragon/Components/DragonRiftComponent.cs @@ -10,7 +10,7 @@ public sealed class DragonRiftComponent : SharedDragonRiftComponent /// /// Dragon that spawned this rift. /// - [DataField("dragon")] public EntityUid? Dragon; + [DataField("dragon")] public EntityUid Dragon; /// /// How long the rift has been active. diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index 329a4379f6..6bd1f08bdb 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -210,8 +210,8 @@ namespace Content.Server.Dragon // We can't predict the rift being destroyed anyway so no point adding weakened to shared. dragon.WeakenedAccumulator = dragon.WeakenedDuration; - _movement.RefreshMovementSpeedModifiers(component.Dragon.Value); - _popupSystem.PopupEntity(Loc.GetString("carp-rift-destroyed"), component.Dragon.Value, component.Dragon.Value); + _movement.RefreshMovementSpeedModifiers(component.Dragon); + _popupSystem.PopupEntity(Loc.GetString("carp-rift-destroyed"), component.Dragon, component.Dragon); } } diff --git a/Content.Server/Lightning/LightningSystem.cs b/Content.Server/Lightning/LightningSystem.cs index 691fe35c72..523cf734ab 100644 --- a/Content.Server/Lightning/LightningSystem.cs +++ b/Content.Server/Lightning/LightningSystem.cs @@ -37,28 +37,28 @@ public sealed class LightningSystem : SharedLightningSystem private void OnCollide(EntityUid uid, LightningComponent component, ref StartCollideEvent args) { - if (!TryComp(uid, out var lightningBeam) - || !TryComp(lightningBeam.VirtualBeamController, out var beamController)) + if (!TryComp(uid, out var lightningBeam) || !TryComp(lightningBeam.VirtualBeamController, out var beamController)) + { return; + } - if (!component.CanArc && beamController.CreatedBeams.Count < component.MaxTotalArcs) - return; + if (component.CanArc) + { + while (beamController.CreatedBeams.Count < component.MaxTotalArcs) + { + Arc(component, args.OtherFixture.Body.Owner, lightningBeam.VirtualBeamController.Value); - Arc(component, args.OtherEntity, lightningBeam.VirtualBeamController.Value); + var spriteState = LightningRandomizer(); - if (component.ArcTarget == null) - return; + component.ArcTargets.Add(args.OtherFixture.Body.Owner); + component.ArcTargets.Add(component.ArcTarget); - var spriteState = LightningRandomizer(); - component.ArcTargets.Add(args.OtherEntity); - component.ArcTargets.Add(component.ArcTarget.Value); - - _beam.TryCreateBeam( - args.OtherEntity, - component.ArcTarget.Value, - component.LightningPrototype, - spriteState, - controller: lightningBeam.VirtualBeamController.Value); + _beam.TryCreateBeam(args.OtherFixture.Body.Owner, component.ArcTarget, component.LightningPrototype, spriteState, controller: lightningBeam.VirtualBeamController.Value); + + //Break from this loop so other created bolts can collide and arc + break; + } + } } /// diff --git a/Content.Shared/Lightning/Components/SharedLightningComponent.cs b/Content.Shared/Lightning/Components/SharedLightningComponent.cs index 7fc2dcacba..24e5650984 100644 --- a/Content.Shared/Lightning/Components/SharedLightningComponent.cs +++ b/Content.Shared/Lightning/Components/SharedLightningComponent.cs @@ -34,7 +34,7 @@ public abstract class SharedLightningComponent : Component /// The target that the lightning will Arc to. /// [DataField("arcTarget")] - public EntityUid? ArcTarget; + public EntityUid ArcTarget; /// /// How far should this lightning go? diff --git a/Resources/Prototypes/Entities/Clothing/Back/specific.yml b/Resources/Prototypes/Entities/Clothing/Back/specific.yml index df7c978a2e..a5ffeb9383 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/specific.yml @@ -9,6 +9,9 @@ tags: [] # ignore "WhitelistChameleon" tag - type: Sprite sprite: Clothing/Back/Backpacks/backpack.rsi + netsync: false + - type: Clothing + sprite: Clothing/Back/Backpacks/backpack.rsi - type: ChameleonClothing slot: [back] default: ClothingBackpack diff --git a/Resources/Prototypes/Entities/Effects/lightning.yml b/Resources/Prototypes/Entities/Effects/lightning.yml index e7d0cf5df3..0f5ee91264 100644 --- a/Resources/Prototypes/Entities/Effects/lightning.yml +++ b/Resources/Prototypes/Entities/Effects/lightning.yml @@ -34,7 +34,6 @@ name: lightning id: Lightning parent: BaseLightning - noSpawn: true components: - type: Lightning canArc: true @@ -43,7 +42,6 @@ name: spooky lightning id: LightningRevenant parent: BaseLightning - noSpawn: true components: - type: Sprite sprite: /Textures/Effects/lightning.rsi @@ -67,7 +65,6 @@ name: charged lightning id: ChargedLightning parent: BaseLightning - noSpawn: true components: - type: Sprite sprite: /Textures/Effects/lightning.rsi @@ -86,7 +83,6 @@ name: supercharged lightning id: SuperchargedLightning parent: ChargedLightning - noSpawn: true components: - type: Sprite sprite: /Textures/Effects/lightning.rsi @@ -112,7 +108,6 @@ name: hypercharged lightning id: HyperchargedLightning parent: ChargedLightning - noSpawn: true components: - type: Sprite sprite: /Textures/Effects/lightning.rsi diff --git a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml index 47d1f45875..22857113aa 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml @@ -12,7 +12,7 @@ noRot: true state: nuclearbomb_base - type: Physics - bodyType: Static + bodyType: Dynamic - type: Fixtures fixtures: fix1: diff --git a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml index bf9cc0b018..da233122ba 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml @@ -57,8 +57,6 @@ components: - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Anchorable - type: Rotatable - type: Sprite @@ -130,8 +128,6 @@ components: - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Anchorable - type: Rotatable - type: Sprite @@ -148,8 +144,6 @@ components: - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Anchorable - type: Rotatable - type: Sprite diff --git a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml index 95251a7b0f..598b1a99d8 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml @@ -27,8 +27,6 @@ maxVol: 250 - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Construction graph: Toilet node: toilet diff --git a/Resources/Prototypes/Entities/Structures/Machines/frame.yml b/Resources/Prototypes/Entities/Structures/Machines/frame.yml index b26882c306..69c9008516 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/frame.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/frame.yml @@ -124,8 +124,6 @@ - type: Transform anchored: true noRot: true - - type: Physics - bodyType: Static - type: Construction graph: Machine node: destroyedMachineFrame diff --git a/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml b/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml index d69eb96f62..e825b68512 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml @@ -49,8 +49,6 @@ - type: Anchorable - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Sprite noRot: true sprite: Structures/monitors.rsi diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index 1ca4fce811..c699577834 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -175,7 +175,7 @@ graph: GasBinary node: valve - type: AmbientSound - enabled: true + enabled: false volume: -9 range: 5 sound: @@ -229,7 +229,7 @@ graph: GasBinary node: signalvalve - type: AmbientSound - enabled: true + enabled: false volume: -9 range: 5 sound: @@ -313,8 +313,6 @@ !type:PipeNode nodeGroupID: Pipe pipeDirection: South - - type: AmbientSound - enabled: true - type: entity parent: [ BaseMachine, ConstructibleMachine ] @@ -357,7 +355,7 @@ - type: AtmosDevice - type: AtmosPipeColor - type: AmbientSound - enabled: true + enabled: false volume: -9 range: 5 sound: diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml index 23f2f7b8cd..ee049039bc 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml @@ -42,7 +42,6 @@ - Pipe - type: Physics canCollide: false - bodyType: static - type: AmbientSound enabled: false volume: -15 diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index f35425c048..6c3bf09eec 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -79,7 +79,7 @@ node: ventpump - type: VentCritterSpawnLocation - type: AmbientSound - enabled: true + enabled: false volume: -12 range: 5 sound: @@ -171,7 +171,7 @@ graph: GasUnary node: ventscrubber - type: AmbientSound - enabled: true + enabled: false volume: -12 range: 5 sound: diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml index e1f62631f0..3aa3393390 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml @@ -45,6 +45,8 @@ suffix: Unfinished description: This controls the density of the particles. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/control_box.rsi - type: Construction diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/emitter.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/emitter.yml index f89d38e6b0..331341adfe 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/emitter.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/emitter.yml @@ -46,6 +46,8 @@ suffix: Unfinished, Left description: This launchs the Alpha particles, might not want to stand near this end. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/emitter_left.rsi - type: Construction @@ -58,6 +60,8 @@ suffix: Unfinished description: This launchs the Alpha particles, might not want to stand near this end. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/emitter_center.rsi - type: Construction @@ -70,6 +74,8 @@ suffix: Unfinished description: This launchs the Alpha particles, might not want to stand near this end. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/emitter_right.rsi - type: Construction diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/end_cap.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/end_cap.yml index cd43d3bd36..676b95b2cc 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/end_cap.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/end_cap.yml @@ -22,6 +22,8 @@ suffix: Unfinished description: Formally known as the Alpha Particle Generation Array. This is where Alpha particles are generated from [REDACTED]. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/end_cap.rsi - type: Construction diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/fuel_chamber.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/fuel_chamber.yml index d835895b01..63661830c4 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/fuel_chamber.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/fuel_chamber.yml @@ -19,6 +19,8 @@ suffix: Unfinished description: Formally known as the EM Acceleration Chamber. This is where the Alpha particles are accelerated to radical speeds. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/fuel_chamber.rsi - type: Construction diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/power_box.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/power_box.yml index 93a4b4b029..cf98367287 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/power_box.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/power_box.yml @@ -25,6 +25,8 @@ suffix: Unfinished description: Formally known as the Particle Focusing EM Lens. This uses electromagnetic waves to focus the Alpha-Particles. It looks unfinished. components: + - type: Physics + bodyType: Dynamic - type: Sprite sprite: Structures/Power/Generation/PA/power_box.rsi - type: Construction diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml index 44c175de70..07515857ad 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml @@ -83,8 +83,6 @@ id: AMEControllerUnanchored suffix: Unanchored components: - - type: Transform - anchored: false - type: Physics bodyType: Dynamic diff --git a/Resources/Prototypes/Entities/Structures/Power/cables.yml b/Resources/Prototypes/Entities/Structures/Power/cables.yml index 77abc3f109..d8e51d8aea 100644 --- a/Resources/Prototypes/Entities/Structures/Power/cables.yml +++ b/Resources/Prototypes/Entities/Structures/Power/cables.yml @@ -11,9 +11,6 @@ - type: Transform anchored: true noRot: true - - type: Physics - bodyType: Static - canCollide: false - type: Sprite netsync: false drawdepth: ThinWire diff --git a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml index f423f2b8e0..58376b9399 100644 --- a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml +++ b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml @@ -11,8 +11,6 @@ path: /Audio/Effects/shuttle_thruster.ogg - type: Transform anchored: true - - type: Physics - bodyType: Static - type: Rotatable rotateWhileAnchored: true - type: Thruster diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml index a4ea19d15e..e10baa2a1d 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/bell.yml @@ -30,7 +30,7 @@ enabled: false - type: Physics canCollide: false - bodyType: Static + bodyType: Dynamic - type: Fixtures - type: Damageable damageContainer: Inorganic diff --git a/Resources/Prototypes/Entities/Structures/plastic_flaps.yml b/Resources/Prototypes/Entities/Structures/plastic_flaps.yml index d5d016264d..1caf882093 100644 --- a/Resources/Prototypes/Entities/Structures/plastic_flaps.yml +++ b/Resources/Prototypes/Entities/Structures/plastic_flaps.yml @@ -13,7 +13,6 @@ state: plasticflaps drawdepth: Mobs - type: Physics - bodyType: Static - type: Transform anchored: true - type: Fixtures