]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Explosion resistance is now predicted! (#30654)
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Mon, 5 Aug 2024 03:15:07 +0000 (20:15 -0700)
committerGitHub <noreply@github.com>
Mon, 5 Aug 2024 03:15:07 +0000 (13:15 +1000)
* First commit

* Added Network and access

Content.Client/Explosion/ExplosionSystem.cs [new file with mode: 0644]
Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs [moved from Content.Server/Explosion/Components/ExplosionResistanceComponent.cs with 89% similarity]
Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs [new file with mode: 0644]

diff --git a/Content.Client/Explosion/ExplosionSystem.cs b/Content.Client/Explosion/ExplosionSystem.cs
new file mode 100644 (file)
index 0000000..a2ed2d5
--- /dev/null
@@ -0,0 +1,8 @@
+using Content.Shared.Explosion.EntitySystems;
+
+namespace Content.Client.Explosion.EntitySystems;
+
+public sealed class ExplosionSystem : SharedExplosionSystem
+{
+
+}
index 55e8de26321f03f89156028f87f704805b574dd5..4b59c8f1c48f8f7a6e4cbd9d21be5704f0e54bf2 100644 (file)
@@ -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!;
 
index 3332d3a4f59ca5c903af8132718cc6e9552329a2..ce98f89de7af4a5bd3c835dcb9cfc2d276e507fc 100644 (file)
@@ -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; }
index 556fe7c1415824390fe1817cfb337720b90d2c41..d88945bc19e26dbcdc9b6c06e3ee34afbbfc0b3e 100644 (file)
@@ -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
 {
     /// <summary>
     ///     Set of tiles of each grid that are directly adjacent to space, along with the directions that face space.
index c30a9ce30064c6df3ca0df1543520edc97ec7a9d..3cab1213b62405977374cb8e379baf6e84a75239 100644 (file)
@@ -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!;
 
index 8b4c0e14c5faa7637bab926e82bf9c58d80d9a4e..8c3229e06eef532c4e8bc3d5d6b5756feef58bbc 100644 (file)
@@ -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
 {
     /// <summary>
     ///     This is the main explosion generating function.
index 5db8b55bf96520b04501546a7a647fe0d9c7391e..219dba4bdeb8f8e11418b6661f6cdb8fb5aace4a 100644 (file)
@@ -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()
     {
index b9f0f6fdb7958ecbd738e762562c07c81c4b94ef..1eeed949cc0f3a39f5445725585e151beed4523b 100644 (file)
@@ -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<RoundRestartCleanupEvent>(OnReset);
 
-        SubscribeLocalEvent<ExplosionResistanceComponent, ArmorExamineEvent>(OnArmorExamine);
-
         // Handled by ExplosionSystem.Processing.cs
         SubscribeLocalEvent<MapChangedEvent>(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)));
-    }
 }
similarity index 89%
rename from Content.Server/Explosion/Components/ExplosionResistanceComponent.cs
rename to Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs
index d4a93c2b5699b535f106e96221846a9bd76364b5..3b5c64c3ec99c1e658254eba7b18388d20b84e2c 100644 (file)
@@ -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;
 
 /// <summary>
 /// 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.
 /// </remarks>
-[RegisterComponent]
-[Access(typeof(ExplosionSystem))]
+[NetworkedComponent, RegisterComponent]
+[Access(typeof(SharedExplosionSystem))]
 public sealed partial class ExplosionResistanceComponent : Component
 {
     /// <summary>
diff --git a/Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs b/Content.Shared/Explosion/EntitySystems/SharedExplosionSystem.cs
new file mode 100644 (file)
index 0000000..1d926dd
--- /dev/null
@@ -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<ExplosionResistanceComponent, ArmorExamineEvent>(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)));
+    }
+}