From: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Date: Tue, 22 Jul 2025 10:25:28 +0000 (+0200)
Subject: Content fixes for engine PR (#39086)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=9a7cb00d4e1ab3aaeedb02175d7ef4378a5e300f;p=space-station-14.git
Content fixes for engine PR (#39086)
* content changes for engine PR
* rerun tests
---
diff --git a/Content.Shared/Sound/Components/BaseEmitSoundComponent.cs b/Content.Shared/Sound/Components/BaseEmitSoundComponent.cs
index 7011f72ef0..576374c586 100644
--- a/Content.Shared/Sound/Components/BaseEmitSoundComponent.cs
+++ b/Content.Shared/Sound/Components/BaseEmitSoundComponent.cs
@@ -1,6 +1,4 @@
using Robust.Shared.Audio;
-using Robust.Shared.GameStates;
-using Robust.Shared.Serialization;
namespace Content.Shared.Sound.Components;
@@ -13,25 +11,13 @@ public abstract partial class BaseEmitSoundComponent : Component
///
/// The to play.
///
- [DataField(required: true)]
+ [DataField(required: true), AutoNetworkedField]
public SoundSpecifier? Sound;
///
/// Play the sound at the position instead of parented to the source entity.
/// Useful if the entity is deleted after.
///
- [DataField]
+ [DataField, AutoNetworkedField]
public bool Positional;
}
-
-///
-/// Represents the state of .
-///
-/// This is obviously very cursed, but since the BaseEmitSoundComponent is abstract, we cannot network it.
-/// AutoGenerateComponentState attribute won't work here, and since everything revolves around inheritance for some fucking reason,
-/// there's no better way of doing this.
-[Serializable, NetSerializable]
-public struct EmitSoundComponentState(SoundSpecifier? sound) : IComponentState
-{
- public SoundSpecifier? Sound { get; } = sound;
-}
diff --git a/Content.Shared/Sound/Components/EmitSoundOnActivateComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnActivateComponent.cs
index d6aa42177e..0cf51a4ee3 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnActivateComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnActivateComponent.cs
@@ -5,7 +5,7 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on ActivateInWorld
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnActivateComponent : BaseEmitSoundComponent
{
///
diff --git a/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs
index 4cdea05220..ce01ecb87c 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs
@@ -3,7 +3,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Sound.Components;
-[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause, AutoGenerateComponentState]
public sealed partial class EmitSoundOnCollideComponent : BaseEmitSoundComponent
{
public static readonly TimeSpan CollideCooldown = TimeSpan.FromSeconds(0.2);
diff --git a/Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs
index 64ed5e60dc..52a352a816 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs
@@ -5,5 +5,5 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on entity drop
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnDropComponent : BaseEmitSoundComponent;
diff --git a/Content.Shared/Sound/Components/EmitSoundOnInteractUsingComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnInteractUsingComponent.cs
index d0b16fcec8..f196d1ca18 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnInteractUsingComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnInteractUsingComponent.cs
@@ -6,7 +6,7 @@ namespace Content.Shared.Sound.Components;
///
/// Whenever this item is used upon by an entity, with a tag or component within a whitelist, in the hand of a user, play a sound
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnInteractUsingComponent : BaseEmitSoundComponent
{
///
diff --git a/Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs
index d3fceb85dd..2154ec89fc 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs
@@ -5,5 +5,5 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on LandEvent
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnLandComponent : BaseEmitSoundComponent;
diff --git a/Content.Shared/Sound/Components/EmitSoundOnPickupComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnPickupComponent.cs
index dcf73b7ac2..b9f8708c6f 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnPickupComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnPickupComponent.cs
@@ -5,5 +5,5 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on entity pickup
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnPickupComponent : BaseEmitSoundComponent;
diff --git a/Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs
index 20d39b3460..b9d66ba269 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs
@@ -5,5 +5,5 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on entity spawn.
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnSpawnComponent : BaseEmitSoundComponent;
diff --git a/Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs
index f8c0d1181b..76e9f08076 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs
@@ -5,5 +5,5 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on ThrowEvent
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnThrowComponent : BaseEmitSoundComponent;
diff --git a/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
index 65848cb5e5..69f3757b22 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
@@ -6,7 +6,7 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on AfterActivatableUIOpenEvent
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
{
///
diff --git a/Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs
index ec7a277e92..a0a51f3234 100644
--- a/Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs
+++ b/Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs
@@ -5,7 +5,7 @@ namespace Content.Shared.Sound.Components;
///
/// Simple sound emitter that emits sound on UseInHand
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnUseComponent : BaseEmitSoundComponent
{
///
diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs
index 38af0677fa..0e758ba0f1 100644
--- a/Content.Shared/Sound/SharedEmitSoundSystem.cs
+++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs
@@ -55,47 +55,6 @@ public abstract class SharedEmitSoundSystem : EntitySystem
SubscribeLocalEvent(OnEmitSoundOnCollide);
SubscribeLocalEvent(OnMobState);
-
- // We need to handle state manually here
- // BaseEmitSoundComponent isn't registered so we have to subscribe to each one
- // TODO: Make it use autonetworking instead of relying on inheritance
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
- SubscribeEmitComponent();
-
- // Helper method so it's a little less ugly
- void SubscribeEmitComponent() where T : BaseEmitSoundComponent
- {
- SubscribeLocalEvent(GetBaseEmitState);
- SubscribeLocalEvent(HandleBaseEmitState);
- }
- }
-
- private static void GetBaseEmitState(Entity ent, ref ComponentGetState args) where T : BaseEmitSoundComponent
- {
- args.State = new EmitSoundComponentState(ent.Comp.Sound);
- }
-
- private static void HandleBaseEmitState(Entity ent, ref ComponentHandleState args) where T : BaseEmitSoundComponent
- {
- if (args.Current is not EmitSoundComponentState state)
- return;
-
- ent.Comp.Sound = state.Sound switch
- {
- SoundPathSpecifier pathSpec => new SoundPathSpecifier(pathSpec.Path, pathSpec.Params),
- SoundCollectionSpecifier collectionSpec => collectionSpec.Collection != null
- ? new SoundCollectionSpecifier(collectionSpec.Collection, collectionSpec.Params)
- : null,
- _ => null,
- };
}
private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
diff --git a/Content.Shared/Weapons/Misc/ForceGunComponent.cs b/Content.Shared/Weapons/Misc/ForceGunComponent.cs
index f3aca0d4d0..dc2481cb62 100644
--- a/Content.Shared/Weapons/Misc/ForceGunComponent.cs
+++ b/Content.Shared/Weapons/Misc/ForceGunComponent.cs
@@ -9,19 +9,13 @@ public sealed partial class ForceGunComponent : BaseForceGunComponent
///
/// Maximum distance to throw entities.
///
- [ViewVariables(VVAccess.ReadWrite), DataField("throwDistance"), AutoNetworkedField]
+ [DataField, AutoNetworkedField]
public float ThrowDistance = 15f;
- [ViewVariables(VVAccess.ReadWrite), DataField("throwForce"), AutoNetworkedField]
+ [DataField, AutoNetworkedField]
public float ThrowForce = 30f;
- ///
- /// The entity currently tethered.
- ///
- [ViewVariables(VVAccess.ReadWrite), DataField("tethered"), AutoNetworkedField]
- public override EntityUid? Tethered { get; set; }
-
- [ViewVariables(VVAccess.ReadWrite), DataField("soundLaunch")]
+ [DataField("soundLaunch")]
public SoundSpecifier? LaunchSound = new SoundPathSpecifier("/Audio/Weapons/soup.ogg")
{
Params = AudioParams.Default.WithVolume(5f),
diff --git a/Content.Shared/Weapons/Misc/TetherGunComponent.cs b/Content.Shared/Weapons/Misc/TetherGunComponent.cs
index fcc5494154..bb9ebd4e43 100644
--- a/Content.Shared/Weapons/Misc/TetherGunComponent.cs
+++ b/Content.Shared/Weapons/Misc/TetherGunComponent.cs
@@ -5,18 +5,6 @@ namespace Content.Shared.Weapons.Misc;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class TetherGunComponent : BaseForceGunComponent
{
- [ViewVariables(VVAccess.ReadWrite), DataField("maxDistance"), AutoNetworkedField]
+ [DataField, AutoNetworkedField]
public float MaxDistance = 10f;
-
- ///
- /// The entity the tethered target has a joint to.
- ///
- [DataField("tetherEntity"), AutoNetworkedField]
- public override EntityUid? TetherEntity { get; set; }
-
- ///
- /// The entity currently tethered.
- ///
- [ViewVariables(VVAccess.ReadWrite), DataField("tethered"), AutoNetworkedField]
- public override EntityUid? Tethered { get; set; }
}