From 9a7cb00d4e1ab3aaeedb02175d7ef4378a5e300f Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Tue, 22 Jul 2025 12:25:28 +0200 Subject: [PATCH 1/3] Content fixes for engine PR (#39086) * content changes for engine PR * rerun tests --- .../Components/BaseEmitSoundComponent.cs | 18 +------- .../EmitSoundOnActivateComponent.cs | 2 +- .../Components/EmitSoundOnCollideComponent.cs | 2 +- .../Components/EmitSoundOnDropComponent.cs | 2 +- .../EmitSoundOnInteractUsingComponent.cs | 2 +- .../Components/EmitSoundOnLandComponent.cs | 2 +- .../Components/EmitSoundOnPickupComponent.cs | 2 +- .../Components/EmitSoundOnSpawnComponent.cs | 2 +- .../Components/EmitSoundOnThrowComponent.cs | 2 +- .../Components/EmitSoundOnUIOpenComponent.cs | 2 +- .../Components/EmitSoundOnUseComponent.cs | 2 +- Content.Shared/Sound/SharedEmitSoundSystem.cs | 41 ------------------- .../Weapons/Misc/ForceGunComponent.cs | 12 ++---- .../Weapons/Misc/TetherGunComponent.cs | 14 +------ 14 files changed, 16 insertions(+), 89 deletions(-) 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; } } From af4ff4e9de6d85abb3bf0928492e49cf153b0bd0 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 22 Jul 2025 12:29:17 +0200 Subject: [PATCH 2/3] Update content to remove redundant Robust math types (#38930) Vector3, Vector4, Matrix4, and Quaternion are now gone. This switches us over to System.Numerics where applicable. --- Content.Client/Cooldown/CooldownGraphic.cs | 5 +++-- Content.Client/Disposal/PressureBar.cs | 3 ++- Content.Client/Holopad/HolopadSystem.cs | 1 + Content.Client/Light/RgbLightControllerSystem.cs | 1 + Content.Client/Power/APC/UI/ApcMenu.xaml.cs | 1 + Content.Client/Power/PowerMonitoringWindow.xaml.Widgets.cs | 1 - Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs | 1 - .../Systems/DamageOverlays/Overlays/DamageOverlay.cs | 1 + Content.Client/UserInterface/Systems/ProgressColorSystem.cs | 3 ++- .../UserInterface/Systems/Storage/Controls/StorageWindow.cs | 2 +- Content.Shared/Humanoid/SkinColor.cs | 1 + 11 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Content.Client/Cooldown/CooldownGraphic.cs b/Content.Client/Cooldown/CooldownGraphic.cs index 6779e4027a..c973b9572b 100644 --- a/Content.Client/Cooldown/CooldownGraphic.cs +++ b/Content.Client/Cooldown/CooldownGraphic.cs @@ -1,4 +1,5 @@ -using Robust.Client.Graphics; +using System.Numerics; +using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Shared.Prototypes; using Robust.Shared.Timing; @@ -36,7 +37,7 @@ namespace Content.Client.Cooldown if (Progress >= 0f) { var hue = (5f / 18f) * lerp; - color = Color.FromHsv((hue, 0.75f, 0.75f, 0.50f)); + color = Color.FromHsv(new Vector4(hue, 0.75f, 0.75f, 0.50f)); } else { diff --git a/Content.Client/Disposal/PressureBar.cs b/Content.Client/Disposal/PressureBar.cs index 7b2ebacaf7..de785de8c6 100644 --- a/Content.Client/Disposal/PressureBar.cs +++ b/Content.Client/Disposal/PressureBar.cs @@ -1,4 +1,5 @@ -using Content.Shared.Disposal; +using System.Numerics; +using Content.Shared.Disposal; using Content.Shared.Disposal.Unit; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/Holopad/HolopadSystem.cs b/Content.Client/Holopad/HolopadSystem.cs index 9fc0815516..51491de98f 100644 --- a/Content.Client/Holopad/HolopadSystem.cs +++ b/Content.Client/Holopad/HolopadSystem.cs @@ -5,6 +5,7 @@ using Robust.Client.Graphics; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using System.Linq; +using System.Numerics; using DrawDepth = Content.Shared.DrawDepth.DrawDepth; namespace Content.Client.Holopad; diff --git a/Content.Client/Light/RgbLightControllerSystem.cs b/Content.Client/Light/RgbLightControllerSystem.cs index 9977a35118..292820ec27 100644 --- a/Content.Client/Light/RgbLightControllerSystem.cs +++ b/Content.Client/Light/RgbLightControllerSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Items.Systems; using Content.Shared.Clothing; using Content.Shared.Hands; diff --git a/Content.Client/Power/APC/UI/ApcMenu.xaml.cs b/Content.Client/Power/APC/UI/ApcMenu.xaml.cs index 25e885b3c7..65464abd54 100644 --- a/Content.Client/Power/APC/UI/ApcMenu.xaml.cs +++ b/Content.Client/Power/APC/UI/ApcMenu.xaml.cs @@ -3,6 +3,7 @@ using Robust.Client.UserInterface.XAML; using Robust.Client.GameObjects; using Robust.Shared.IoC; using System; +using System.Numerics; using Content.Client.Stylesheets; using Content.Shared.APC; using Robust.Client.Graphics; diff --git a/Content.Client/Power/PowerMonitoringWindow.xaml.Widgets.cs b/Content.Client/Power/PowerMonitoringWindow.xaml.Widgets.cs index d3671e265a..e2b27c1b62 100644 --- a/Content.Client/Power/PowerMonitoringWindow.xaml.Widgets.cs +++ b/Content.Client/Power/PowerMonitoringWindow.xaml.Widgets.cs @@ -6,7 +6,6 @@ using Robust.Shared.Utility; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Numerics; -using Vector4 = Robust.Shared.Maths.Vector4; namespace Content.Client.Power; diff --git a/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs b/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs index 8bb49bdb2b..c2d978e609 100644 --- a/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs +++ b/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs @@ -10,7 +10,6 @@ using Robust.Shared.Physics; using Robust.Shared.Threading; using Robust.Shared.Timing; using Robust.Shared.Utility; -using Vector2 = System.Numerics.Vector2; namespace Content.Client.Shuttles.UI; diff --git a/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs b/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs index 3eef88f19b..1b9e4e2c4a 100644 --- a/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs +++ b/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Mobs; using Robust.Client.Graphics; using Robust.Client.Player; diff --git a/Content.Client/UserInterface/Systems/ProgressColorSystem.cs b/Content.Client/UserInterface/Systems/ProgressColorSystem.cs index e5579801ec..3d5f8d9561 100644 --- a/Content.Client/UserInterface/Systems/ProgressColorSystem.cs +++ b/Content.Client/UserInterface/Systems/ProgressColorSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CCVar; using Robust.Shared.Configuration; @@ -43,7 +44,7 @@ public sealed class ProgressColorSystem : EntitySystem // lerp var hue = 5f / 18f * progress; - return Color.FromHsv((hue, 1f, 0.75f, 1f)); + return Color.FromHsv(new Vector4(hue, 1f, 0.75f, 1f)); } return InterpolateColorGaussian(Plasma, progress); diff --git a/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs b/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs index 8b66ed8892..392532c7b7 100644 --- a/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs +++ b/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs @@ -621,7 +621,7 @@ public sealed class StorageWindow : BaseWindow { marked.Add(cell); cell.ModulateSelfOverride = spotFree - ? Color.FromHsv((0.18f, 1 / spot, 0.5f / spot + 0.5f, 1f)) + ? Color.FromHsv(new Vector4(0.18f, 1 / spot, 0.5f / spot + 0.5f, 1f)) : Color.FromHex("#2222CC"); } } diff --git a/Content.Shared/Humanoid/SkinColor.cs b/Content.Shared/Humanoid/SkinColor.cs index 2dc95fcf07..d4d52682f3 100644 --- a/Content.Shared/Humanoid/SkinColor.cs +++ b/Content.Shared/Humanoid/SkinColor.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Security.Cryptography; using Microsoft.VisualBasic.CompilerServices; From 229d0a9747fefc0321ca0ae464a5557238c6a2a6 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Wed, 23 Jul 2025 01:48:03 +0200 Subject: [PATCH 3/3] Update submodule to v265.0.0 --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 56eda3ea92..51c929c8ec 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 56eda3ea92913e60c27aa029ba7877c8559dfe9d +Subproject commit 51c929c8ecb08e84aa695012dabc0b25bd71b8ca