]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Firestarter fixes (#24647)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Wed, 31 Jan 2024 13:01:52 +0000 (00:01 +1100)
committerGitHub <noreply@github.com>
Wed, 31 Jan 2024 13:01:52 +0000 (00:01 +1100)
* Firestarter fixes

- Actually networks the action.
- Namespace fixes.

* No networky for you

Content.Client/Atmos/EntitySystems/FirestarterSystem.cs [new file with mode: 0644]
Content.Server/Atmos/EntitySystems/FirestarterSystem.cs [moved from Content.Server/Abilities/Firestarter/FirestarterSystem.cs with 78% similarity]
Content.Shared/Atmos/Components/FirestarterComponent.cs [moved from Content.Shared/Abilities/Firestarter/FirestarterComponent.cs with 62% similarity]
Content.Shared/Atmos/EntitySystems/SharedFirestarterSystem.cs [moved from Content.Shared/Abilities/Firestarter/SharedFirestarterSystem.cs with 76% similarity]

diff --git a/Content.Client/Atmos/EntitySystems/FirestarterSystem.cs b/Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
new file mode 100644 (file)
index 0000000..3294959
--- /dev/null
@@ -0,0 +1,8 @@
+using Content.Shared.Atmos.EntitySystems;
+
+namespace Content.Client.Atmos.EntitySystems;
+
+public sealed class FirestarterSystem : SharedFirestarterSystem
+{
+
+}
similarity index 78%
rename from Content.Server/Abilities/Firestarter/FirestarterSystem.cs
rename to Content.Server/Atmos/EntitySystems/FirestarterSystem.cs
index 9ad8bdac7c5e0a9a888fd0c7b64558bb1159515d..801ad2023232d325fef94edb679301287c2ffbc6 100644 (file)
@@ -1,24 +1,26 @@
+using Content.Server.Atmos.Components;
 using Content.Shared.Actions.Events;
+using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
+using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Map;
-using Content.Server.Atmos.Components;
-using Content.Server.Atmos.EntitySystems;
-using Robust.Shared.Audio.Systems;
-using Content.Shared.Abilities.Firestarter;
+
+namespace Content.Server.Atmos.EntitySystems;
 
 /// <summary>
 /// Adds an action ability that will cause all flammable targets in a radius to ignite, also heals the owner
 /// of the component when used.
 /// </summary>
-namespace Content.Server.Abilities.Firestarter;
-
-public sealed class FirestarterSystem : EntitySystem
+public sealed class FirestarterSystem : SharedFirestarterSystem
 {
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly FlammableSystem _flammable = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedContainerSystem _container = default!;
 
+    private readonly HashSet<Entity<FlammableComponent>> _flammables = new();
+
     public override void Initialize()
     {
         base.Initialize();
@@ -26,11 +28,10 @@ public sealed class FirestarterSystem : EntitySystem
     }
 
     /// <summary>
-    /// Checks Radius for igniting nearby flammable objects .
+    /// Checks Radius for igniting nearby flammable objects
     /// </summary>
     private void OnStartFire(EntityUid uid, FirestarterComponent component, FireStarterActionEvent args)
     {
-
         if (_container.IsEntityOrParentInContainer(uid))
             return;
 
@@ -47,10 +48,10 @@ public sealed class FirestarterSystem : EntitySystem
     /// </summary>
     public void IgniteNearby(EntityUid uid, EntityCoordinates coordinates, float severity, float radius)
     {
-        var flammables = new HashSet<Entity<FlammableComponent>>();
-        _lookup.GetEntitiesInRange(coordinates, radius, flammables);
+        _flammables.Clear();
+        _lookup.GetEntitiesInRange(coordinates, radius, _flammables);
 
-        foreach (var flammable in flammables)
+        foreach (var flammable in _flammables)
         {
             var ent = flammable.Owner;
             var stackAmount = 2 + (int) (severity / 0.15f);
similarity index 62%
rename from Content.Shared/Abilities/Firestarter/FirestarterComponent.cs
rename to Content.Shared/Atmos/Components/FirestarterComponent.cs
index d236b5cba6a5eb29a98ecb5a6fd884be4fba6c4a..f8d544e6b8d03b0f4a86bf4a8704c8db06f338d5 100644 (file)
@@ -1,9 +1,9 @@
-using Robust.Shared.Prototypes;
+using Content.Shared.Atmos.EntitySystems;
 using Robust.Shared.Audio;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
 
-namespace Content.Shared.Abilities.Firestarter;
+namespace Content.Shared.Atmos.Components;
 
 /// <summary>
 /// Lets its owner entity ignite flammables around it and also heal some damage.
@@ -14,21 +14,21 @@ public sealed partial class FirestarterComponent : Component
     /// <summary>
     /// Radius of objects that will be ignited if flammable.
     /// </summary>
-    [DataField("ignitionRadius")]
+    [DataField]
     public float IgnitionRadius = 4f;
 
     /// <summary>
     /// The action entity.
     /// </summary>
-    [DataField("fireStarterAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
-    public string? FireStarterAction = "ActionFireStarter";
+    [DataField]
+    public EntProtoId? FireStarterAction = "ActionFireStarter";
 
-    [DataField("fireStarterActionEntity")] public EntityUid? FireStarterActionEntity;
+    [DataField] public EntityUid? FireStarterActionEntity;
 
 
     /// <summary>
     /// Radius of objects that will be ignited if flammable.
     /// </summary>
-    [DataField("igniteSound")]
+    [DataField]
     public SoundSpecifier IgniteSound = new SoundPathSpecifier("/Audio/Magic/rumble.ogg");
 }
similarity index 76%
rename from Content.Shared/Abilities/Firestarter/SharedFirestarterSystem.cs
rename to Content.Shared/Atmos/EntitySystems/SharedFirestarterSystem.cs
index 5e4d4347d18df3900eb78c231821656e543460d6..584e502db1616092bad4e866bce36935def45c7a 100644 (file)
@@ -1,8 +1,9 @@
 using Content.Shared.Actions;
+using Content.Shared.Atmos.Components;
 
-namespace Content.Shared.Abilities.Firestarter;
+namespace Content.Shared.Atmos.EntitySystems;
 
-public sealed class SharedFirestarterSystem : EntitySystem
+public abstract class SharedFirestarterSystem : EntitySystem
 {
     [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
 
@@ -18,5 +19,6 @@ public sealed class SharedFirestarterSystem : EntitySystem
     private void OnComponentInit(EntityUid uid, FirestarterComponent component, ComponentInit args)
     {
         _actionsSystem.AddAction(uid, ref component.FireStarterActionEntity, component.FireStarterAction, uid);
+        Dirty(uid, component);
     }
 }