diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index 6f720460fe..6a4ae96cbc 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -237,9 +237,8 @@ namespace Content.Server.Buckle.Components UpdateBuckleStatus(); -#pragma warning disable 618 - SendMessage(new BuckleMessage(Owner, to)); -#pragma warning restore 618 + var ev = new BuckleChangeEvent() { Buckling = true, Strap = BuckledTo.Owner }; + _entMan.EventBus.RaiseLocalEvent(Owner, ev, false); if (_entMan.TryGetComponent(Owner, out SharedPullableComponent? ownerPullable)) { @@ -330,9 +329,8 @@ namespace Content.Server.Buckle.Components oldBuckledTo.Remove(this); SoundSystem.Play(Filter.Pvs(Owner), oldBuckledTo.UnbuckleSound.GetSound(), Owner); -#pragma warning disable 618 - SendMessage(new UnbuckleMessage(Owner, oldBuckledTo.Owner)); -#pragma warning restore 618 + var ev = new BuckleChangeEvent() { Buckling = false, Strap = oldBuckledTo.Owner }; + _entMan.EventBus.RaiseLocalEvent(Owner, ev, false); return true; } diff --git a/Content.Server/Buckle/Components/StrapComponent.cs b/Content.Server/Buckle/Components/StrapComponent.cs index 205ec8f11c..c4336174d2 100644 --- a/Content.Server/Buckle/Components/StrapComponent.cs +++ b/Content.Server/Buckle/Components/StrapComponent.cs @@ -162,10 +162,6 @@ namespace Content.Server.Buckle.Components appearance.SetData("StrapState", true); } -#pragma warning disable 618 - SendMessage(new StrapMessage(buckle.Owner, Owner)); -#pragma warning restore 618 - return true; } @@ -184,9 +180,6 @@ namespace Content.Server.Buckle.Components } _occupiedSize -= buckle.Size; -#pragma warning disable 618 - SendMessage(new UnStrapMessage(buckle.Owner, Owner)); -#pragma warning restore 618 } } diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index ca97ce6213..f25fa1a373 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Climbing.Components; using Content.Server.Popups; using Content.Server.Stunnable; using Content.Shared.ActionBlocker; +using Content.Shared.Buckle.Components; using Content.Shared.Climbing; using Content.Shared.Damage; using Content.Shared.GameTicking; @@ -33,6 +34,7 @@ namespace Content.Server.Climbing SubscribeLocalEvent(Reset); SubscribeLocalEvent>(AddClimbVerb); + SubscribeLocalEvent(OnBuckleChange); SubscribeLocalEvent(OnGlassClimbed); } @@ -62,6 +64,12 @@ namespace Content.Server.Climbing args.Verbs.Add(verb); } + private void OnBuckleChange(EntityUid uid, ClimbingComponent component, BuckleChangeEvent args) + { + if (args.Buckling) + component.IsClimbing = false; + } + private void OnGlassClimbed(EntityUid uid, GlassTableComponent component, ClimbedOnEvent args) { _damageableSystem.TryChangeDamage(args.Climber, component.ClimberDamage); diff --git a/Content.Server/Climbing/Components/ClimbingComponent.cs b/Content.Server/Climbing/Components/ClimbingComponent.cs index 997c64abd7..11df5a8053 100644 --- a/Content.Server/Climbing/Components/ClimbingComponent.cs +++ b/Content.Server/Climbing/Components/ClimbingComponent.cs @@ -53,22 +53,6 @@ namespace Content.Server.Climbing.Components } } - [Obsolete("Component Messages are deprecated, use Entity Events instead.")] - public override void HandleMessage(ComponentMessage message, IComponent? component) - { -#pragma warning disable 618 - base.HandleMessage(message, component); -#pragma warning restore 618 - switch (message) - { - case BuckleMessage msg: - if (msg.Buckled) - IsClimbing = false; - - break; - } - } - /// /// Make the owner climb from one point to another /// diff --git a/Content.Server/Configurable/ConfigurationComponent.cs b/Content.Server/Configurable/ConfigurationComponent.cs index d3ef71b925..0071690a62 100644 --- a/Content.Server/Configurable/ConfigurationComponent.cs +++ b/Content.Server/Configurable/ConfigurationComponent.cs @@ -110,9 +110,7 @@ namespace Content.Server.Configurable _config[key] = value; } -#pragma warning disable 618 - SendMessage(new ConfigUpdatedComponentMessage(config)); -#pragma warning restore 618 + // TODO raise event. } } diff --git a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs index 68d30ab00e..ac6a605c89 100644 --- a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs +++ b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs @@ -59,69 +59,15 @@ namespace Content.Shared.Buckle.Components public int? DrawDepth; } + public sealed class BuckleChangeEvent : EntityEventArgs + { + public EntityUid Strap; + public bool Buckling; + } + [Serializable, NetSerializable] public enum BuckleVisuals { Buckled } - - [Serializable, NetSerializable] -#pragma warning disable 618 - public abstract class BuckleChangeMessage : ComponentMessage -#pragma warning restore 618 - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - /// True if the entity was buckled, false otherwise - protected BuckleChangeMessage(EntityUid entity, EntityUid strap, bool buckled) - { - Entity = entity; - Strap = strap; - Buckled = buckled; - } - - /// - /// The entity that had its buckling status changed - /// - public EntityUid Entity { get; } - - /// - /// The strap that the entity was buckled to or unbuckled from - /// - public EntityUid Strap { get; } - - /// - /// True if the entity was buckled, false otherwise. - /// - public bool Buckled { get; } - } - - [Serializable, NetSerializable] - public class BuckleMessage : BuckleChangeMessage - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - public BuckleMessage(EntityUid entity, EntityUid strap) : base(entity, strap, true) - { - } - } - - [Serializable, NetSerializable] - public class UnbuckleMessage : BuckleChangeMessage - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - public UnbuckleMessage(EntityUid entity, EntityUid strap) : base(entity, strap, false) - { - } - } } diff --git a/Content.Shared/Buckle/Components/SharedStrapComponent.cs b/Content.Shared/Buckle/Components/SharedStrapComponent.cs index c776f0d9ab..9f2433aaab 100644 --- a/Content.Shared/Buckle/Components/SharedStrapComponent.cs +++ b/Content.Shared/Buckle/Components/SharedStrapComponent.cs @@ -60,65 +60,4 @@ namespace Content.Shared.Buckle.Components RotationAngle, BuckledState } - - // TODO : Convert this to an Entity Message. Careful, it will Break ShuttleControllerComponent (only place where it's used) - [Serializable, NetSerializable] -#pragma warning disable 618 - public abstract class StrapChangeMessage : ComponentMessage -#pragma warning restore 618 - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - /// True if the entity was buckled, false otherwise - protected StrapChangeMessage(EntityUid entity, EntityUid strap, bool buckled) - { - Entity = entity; - Strap = strap; - Buckled = buckled; - } - - /// - /// The entity that had its buckling status changed - /// - public EntityUid Entity { get; } - - /// - /// The strap that the entity was buckled to or unbuckled from - /// - public EntityUid Strap { get; } - - /// - /// True if the entity was buckled, false otherwise. - /// - public bool Buckled { get; } - } - - [Serializable, NetSerializable] - public class StrapMessage : StrapChangeMessage - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - public StrapMessage(EntityUid entity, EntityUid strap) : base(entity, strap, true) - { - } - } - - [Serializable, NetSerializable] - public class UnStrapMessage : StrapChangeMessage - { - /// - /// Constructs a new instance of - /// - /// The entity that had its buckling status changed - /// The strap that the entity was buckled to or unbuckled from - public UnStrapMessage(EntityUid entity, EntityUid strap) : base(entity, strap, false) - { - } - } } diff --git a/Content.Shared/Configurable/SharedConfigurationComponent.cs b/Content.Shared/Configurable/SharedConfigurationComponent.cs index 3562d4dddb..ac5bf44b72 100644 --- a/Content.Shared/Configurable/SharedConfigurationComponent.cs +++ b/Content.Shared/Configurable/SharedConfigurationComponent.cs @@ -18,21 +18,6 @@ namespace Content.Shared.Configurable } } - /// - /// Message sent to other components on this entity when DeviceNetwork configuration updated. - /// -#pragma warning disable 618 - public class ConfigUpdatedComponentMessage : ComponentMessage -#pragma warning restore 618 - { - public Dictionary Config { get; } - - public ConfigUpdatedComponentMessage(Dictionary config) - { - Config = config; - } - } - /// /// Message data sent from client to server when the device configuration is updated. /// diff --git a/Content.Shared/Singularity/SingularitySoundMessage.cs b/Content.Shared/Singularity/SingularitySoundMessage.cs deleted file mode 100644 index 7a8d891cb5..0000000000 --- a/Content.Shared/Singularity/SingularitySoundMessage.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization; - -namespace Content.Shared.Singularity -{ - [Serializable, NetSerializable] -#pragma warning disable 618 - public class SingularitySoundMessage : ComponentMessage -#pragma warning restore 618 - { - public bool Start { get; } - - public SingularitySoundMessage(bool start) - { - Directed = true; - Start = start; - } - } - - -}