diff --git a/Content.Client/Explosion/ExplosionSystem.cs b/Content.Client/Explosion/ExplosionSystem.cs new file mode 100644 index 0000000000..a2ed2d50e0 --- /dev/null +++ b/Content.Client/Explosion/ExplosionSystem.cs @@ -0,0 +1,8 @@ +using Content.Shared.Explosion.EntitySystems; + +namespace Content.Client.Explosion.EntitySystems; + +public sealed class ExplosionSystem : SharedExplosionSystem +{ + +} diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs index 55e8de2632..4b59c8f1c4 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs @@ -3,12 +3,12 @@ using Content.Server.Destructible; using Content.Shared.Atmos; using Content.Shared.Damage; using Content.Shared.Explosion; +using Content.Shared.Explosion.EntitySystems; using Content.Shared.FixedPoint; using Robust.Shared.Map.Components; - namespace Content.Server.Explosion.EntitySystems; -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { [Dependency] private readonly DestructibleSystem _destructibleSystem = default!; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs index 3332d3a4f5..ce98f89de7 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs @@ -1,8 +1,8 @@ using Content.Shared.CCVar; - +using Content.Shared.Explosion.EntitySystems; namespace Content.Server.Explosion.EntitySystems; -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { public int MaxIterations { get; private set; } public int MaxArea { get; private set; } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs index 556fe7c141..d88945bc19 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs @@ -2,6 +2,7 @@ using System.Numerics; using Content.Shared.Atmos; using Content.Shared.Explosion; using Content.Shared.Explosion.Components; +using Content.Shared.Explosion.EntitySystems; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -11,7 +12,7 @@ namespace Content.Server.Explosion.EntitySystems; // A good portion of it is focused around keeping track of what tile-indices on a grid correspond to tiles that border // space. AFAIK no other system currently needs to track these "edge-tiles". If they do, this should probably be a // property of the grid itself? -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { /// /// Set of tiles of each grid that are directly adjacent to space, along with the directions that face space. diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index c30a9ce300..3cab1213b6 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -4,6 +4,7 @@ using Content.Shared.CCVar; using Content.Shared.Damage; using Content.Shared.Explosion; using Content.Shared.Explosion.Components; +using Content.Shared.Explosion.EntitySystems; using Content.Shared.Maps; using Content.Shared.Physics; using Content.Shared.Projectiles; @@ -17,10 +18,9 @@ using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent; - namespace Content.Server.Explosion.EntitySystems; -public sealed partial class ExplosionSystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { [Dependency] private readonly FlammableSystem _flammableSystem = default!; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs index 8b4c0e14c5..8c3229e06e 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs @@ -7,13 +7,13 @@ using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; using Robust.Shared.Timing; - +using Content.Shared.Explosion.EntitySystems; namespace Content.Server.Explosion.EntitySystems; // This partial part of the explosion system has all of the functions used to create the actual explosion map. // I.e, to get the sets of tiles & intensity values that describe an explosion. -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { /// /// This is the main explosion generating function. diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs index 5db8b55bf9..219dba4bde 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs @@ -1,14 +1,14 @@ using System.Numerics; using Content.Shared.Explosion; using Content.Shared.Explosion.Components; +using Content.Shared.Explosion.EntitySystems; using Robust.Server.GameObjects; using Robust.Shared.GameStates; using Robust.Shared.Map; - namespace Content.Server.Explosion.EntitySystems; // This part of the system handled send visual / overlay data to clients. -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { public void InitVisuals() { diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index b9f0f6fdb7..1eeed949cc 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.GameTicking; using Content.Shared.Inventory; using Content.Shared.Projectiles; using Content.Shared.Throwing; +using Content.Shared.Explosion.Components; +using Content.Shared.Explosion.EntitySystems; using Robust.Server.GameStates; using Robust.Server.Player; using Robust.Shared.Audio.Systems; @@ -29,7 +31,7 @@ using Robust.Shared.Utility; namespace Content.Server.Explosion.EntitySystems; -public sealed partial class ExplosionSystem : EntitySystem +public sealed partial class ExplosionSystem : SharedExplosionSystem { [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; @@ -92,8 +94,6 @@ public sealed partial class ExplosionSystem : EntitySystem SubscribeLocalEvent(OnReset); - SubscribeLocalEvent(OnArmorExamine); - // Handled by ExplosionSystem.Processing.cs SubscribeLocalEvent(OnMapChanged); @@ -418,15 +418,4 @@ public sealed partial class ExplosionSystem : EntitySystem _recoilSystem.KickCamera(uid, -delta.Normalized() * effect); } } - - private void OnArmorExamine(EntityUid uid, ExplosionResistanceComponent component, ref ArmorExamineEvent args) - { - var value = MathF.Round((1f - component.DamageCoefficient) * 100, 1); - - if (value == 0) - return; - - args.Msg.PushNewline(); - args.Msg.AddMarkupOrThrow(Loc.GetString(component.Examine, ("value", value))); - } } diff --git a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs b/Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs similarity index 89% rename from Content.Server/Explosion/Components/ExplosionResistanceComponent.cs rename to Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs index d4a93c2b56..3b5c64c3ec 100644 --- a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs +++ b/Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs @@ -1,8 +1,8 @@ -using Content.Server.Explosion.EntitySystems; -using Content.Shared.Explosion; +using Content.Shared.Explosion.EntitySystems; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; +using Robust.Shared.GameStates; -namespace Content.Server.Explosion.Components; +namespace Content.Shared.Explosion.Components; /// /// Component that provides entities with explosion resistance. @@ -13,8 +13,8 @@ namespace Content.Server.Explosion.Components; /// This is desirable over just using damage modifier sets, given that equipment like bomb-suits need to /// significantly reduce the damage, but shouldn't be silly overpowered in regular combat. /// -[RegisterComponent] -[Access(typeof(ExplosionSystem))] +[NetworkedComponent, RegisterComponent] +[Access(typeof(SharedExplosionSystem))] public sealed partial class ExplosionResistanceComponent : Component { /// diff --git a/Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs b/Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs new file mode 100644 index 0000000000..1d926dd0b6 --- /dev/null +++ b/Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs @@ -0,0 +1,25 @@ +using Content.Shared.Explosion.Components; +using Content.Shared.Armor; + +namespace Content.Shared.Explosion.EntitySystems; + +public abstract class SharedExplosionSystem : EntitySystem +{ + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnArmorExamine); + } + + private void OnArmorExamine(EntityUid uid, ExplosionResistanceComponent component, ref ArmorExamineEvent args) + { + var value = MathF.Round((1f - component.DamageCoefficient) * 100, 1); + + if (value == 0) + return; + + args.Msg.PushNewline(); + args.Msg.AddMarkupOrThrow(Loc.GetString(component.Examine, ("value", value))); + } +}