diff --git a/Content.Server/Atmos/Components/FlammableComponent.cs b/Content.Server/Atmos/Components/FlammableComponent.cs
index 7c1799cd71..e7a5fd18ff 100644
--- a/Content.Server/Atmos/Components/FlammableComponent.cs
+++ b/Content.Server/Atmos/Components/FlammableComponent.cs
@@ -1,4 +1,5 @@
using Content.Shared.Damage;
+using Robust.Shared.Physics.Collision.Shapes;
namespace Content.Server.Atmos.Components
{
@@ -28,5 +29,11 @@ namespace Content.Server.Atmos.Components
[DataField("damage", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = new(); // Empty by default, we don't want any funny NREs.
+
+ ///
+ /// Used for the fixture created to handle passing firestacks when two flammable objects collide.
+ ///
+ [DataField("flammableCollisionShape")]
+ public IPhysShape FlammableCollisionShape = new PhysShapeCircle() { Radius = 0.35f };
}
}
diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs
index c92d88ad86..8957481e12 100644
--- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs
@@ -12,6 +12,7 @@ using Content.Shared.Atmos;
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Interaction;
+using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Temperature;
using Robust.Server.GameObjects;
@@ -32,6 +33,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
+ [Dependency] private readonly FixtureSystem _fixture = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
private const float MinimumFireStacks = -10f;
@@ -39,16 +41,17 @@ namespace Content.Server.Atmos.EntitySystems
private const float UpdateTime = 1f;
private const float MinIgnitionTemperature = 373.15f;
+ public const string FlammableFixtureID = "flammable";
private float _timer = 0f;
private Dictionary _fireEvents = new();
- // TODO: Port the rest of Flammable.
public override void Initialize()
{
UpdatesAfter.Add(typeof(AtmosphereSystem));
+ SubscribeLocalEvent(OnMapInit);
SubscribeLocalEvent(OnInteractUsingEvent);
SubscribeLocalEvent(OnCollideEvent);
SubscribeLocalEvent(OnIsHotEvent);
@@ -67,7 +70,7 @@ namespace Content.Server.Atmos.EntitySystems
flammable.FireStacks += component.FireStacks;
Ignite(entity, flammable);
}
-
+
}
private void IgniteOnCollide(EntityUid uid, IgniteOnCollideComponent component, StartCollideEvent args)
@@ -81,13 +84,30 @@ namespace Content.Server.Atmos.EntitySystems
Ignite(otherFixture, flammable);
}
+ private void OnMapInit(EntityUid uid, FlammableComponent component, MapInitEvent args)
+ {
+ // Sets up a fixture for flammable collisions.
+ // TODO: Should this be generalized into a general non-hard 'effects' fixture or something? I can't think of other use cases for it.
+ // This doesn't seem great either (lots more collisions generated) but there isn't a better way to solve it either that I can think of.
+
+ if (!TryComp(uid, out var body))
+ return;
+
+ _fixture.TryCreateFixture(body, new Fixture(body, component.FlammableCollisionShape)
+ {
+ Hard = false,
+ ID = FlammableFixtureID,
+ CollisionMask = (int) CollisionGroup.FullTileLayer
+ });
+ }
+
private void OnInteractUsingEvent(EntityUid uid, FlammableComponent flammable, InteractUsingEvent args)
{
if (args.Handled)
return;
var isHotEvent = new IsHotEvent();
- RaiseLocalEvent(args.Used, isHotEvent, false);
+ RaiseLocalEvent(args.Used, isHotEvent);
if (!isHotEvent.IsHot)
return;
@@ -99,6 +119,12 @@ namespace Content.Server.Atmos.EntitySystems
private void OnCollideEvent(EntityUid uid, FlammableComponent flammable, StartCollideEvent args)
{
var otherUid = args.OtherFixture.Body.Owner;
+
+ // Normal hard collisions, though this isn't generally possible since most flammable things are mobs
+ // which don't collide with one another, shouldn't work here.
+ if (args.OtherFixture.ID != FlammableFixtureID && args.OurFixture.ID != FlammableFixtureID)
+ return;
+
if (!EntityManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable))
return;
@@ -119,7 +145,8 @@ namespace Content.Server.Atmos.EntitySystems
otherFlammable.FireStacks += flammable.FireStacks;
Ignite(otherUid, otherFlammable);
}
- } else if (otherFlammable.OnFire)
+ }
+ else if (otherFlammable.OnFire)
{
otherFlammable.FireStacks /= 2;
flammable.FireStacks += otherFlammable.FireStacks;