From a6ea8b210db079d30823e7b4d8faa32aefa17582 Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Thu, 1 Feb 2024 00:01:52 +1100
Subject: [PATCH] Firestarter fixes (#24647)
* Firestarter fixes
- Actually networks the action.
- Namespace fixes.
* No networky for you
---
.../Atmos/EntitySystems/FirestarterSystem.cs | 8 ++++++
.../EntitySystems}/FirestarterSystem.cs | 25 ++++++++++---------
.../Components}/FirestarterComponent.cs | 16 ++++++------
.../EntitySystems}/SharedFirestarterSystem.cs | 6 +++--
4 files changed, 33 insertions(+), 22 deletions(-)
create mode 100644 Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
rename Content.Server/{Abilities/Firestarter => Atmos/EntitySystems}/FirestarterSystem.cs (78%)
rename Content.Shared/{Abilities/Firestarter => Atmos/Components}/FirestarterComponent.cs (62%)
rename Content.Shared/{Abilities/Firestarter => Atmos/EntitySystems}/SharedFirestarterSystem.cs (76%)
diff --git a/Content.Client/Atmos/EntitySystems/FirestarterSystem.cs b/Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
new file mode 100644
index 000000000000..32949599158a
--- /dev/null
+++ b/Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
@@ -0,0 +1,8 @@
+using Content.Shared.Atmos.EntitySystems;
+
+namespace Content.Client.Atmos.EntitySystems;
+
+public sealed class FirestarterSystem : SharedFirestarterSystem
+{
+
+}
diff --git a/Content.Server/Abilities/Firestarter/FirestarterSystem.cs b/Content.Server/Atmos/EntitySystems/FirestarterSystem.cs
similarity index 78%
rename from Content.Server/Abilities/Firestarter/FirestarterSystem.cs
rename to Content.Server/Atmos/EntitySystems/FirestarterSystem.cs
index 9ad8bdac7c5e..801ad2023232 100644
--- a/Content.Server/Abilities/Firestarter/FirestarterSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/FirestarterSystem.cs
@@ -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;
///
/// Adds an action ability that will cause all flammable targets in a radius to ignite, also heals the owner
/// of the component when used.
///
-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> _flammables = new();
+
public override void Initialize()
{
base.Initialize();
@@ -26,11 +28,10 @@ public override void Initialize()
}
///
- /// Checks Radius for igniting nearby flammable objects .
+ /// Checks Radius for igniting nearby flammable objects
///
private void OnStartFire(EntityUid uid, FirestarterComponent component, FireStarterActionEvent args)
{
-
if (_container.IsEntityOrParentInContainer(uid))
return;
@@ -47,10 +48,10 @@ private void OnStartFire(EntityUid uid, FirestarterComponent component, FireStar
///
public void IgniteNearby(EntityUid uid, EntityCoordinates coordinates, float severity, float radius)
{
- var flammables = new HashSet>();
- _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);
diff --git a/Content.Shared/Abilities/Firestarter/FirestarterComponent.cs b/Content.Shared/Atmos/Components/FirestarterComponent.cs
similarity index 62%
rename from Content.Shared/Abilities/Firestarter/FirestarterComponent.cs
rename to Content.Shared/Atmos/Components/FirestarterComponent.cs
index d236b5cba6a5..f8d544e6b8d0 100644
--- a/Content.Shared/Abilities/Firestarter/FirestarterComponent.cs
+++ b/Content.Shared/Atmos/Components/FirestarterComponent.cs
@@ -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;
///
/// Lets its owner entity ignite flammables around it and also heal some damage.
@@ -14,21 +14,21 @@ public sealed partial class FirestarterComponent : Component
///
/// Radius of objects that will be ignited if flammable.
///
- [DataField("ignitionRadius")]
+ [DataField]
public float IgnitionRadius = 4f;
///
/// The action entity.
///
- [DataField("fireStarterAction", customTypeSerializer: typeof(PrototypeIdSerializer))]
- public string? FireStarterAction = "ActionFireStarter";
+ [DataField]
+ public EntProtoId? FireStarterAction = "ActionFireStarter";
- [DataField("fireStarterActionEntity")] public EntityUid? FireStarterActionEntity;
+ [DataField] public EntityUid? FireStarterActionEntity;
///
/// Radius of objects that will be ignited if flammable.
///
- [DataField("igniteSound")]
+ [DataField]
public SoundSpecifier IgniteSound = new SoundPathSpecifier("/Audio/Magic/rumble.ogg");
}
diff --git a/Content.Shared/Abilities/Firestarter/SharedFirestarterSystem.cs b/Content.Shared/Atmos/EntitySystems/SharedFirestarterSystem.cs
similarity index 76%
rename from Content.Shared/Abilities/Firestarter/SharedFirestarterSystem.cs
rename to Content.Shared/Atmos/EntitySystems/SharedFirestarterSystem.cs
index 5e4d4347d18d..584e502db161 100644
--- a/Content.Shared/Abilities/Firestarter/SharedFirestarterSystem.cs
+++ b/Content.Shared/Atmos/EntitySystems/SharedFirestarterSystem.cs
@@ -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 override void Initialize()
private void OnComponentInit(EntityUid uid, FirestarterComponent component, ComponentInit args)
{
_actionsSystem.AddAction(uid, ref component.FireStarterActionEntity, component.FireStarterAction, uid);
+ Dirty(uid, component);
}
}