mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
Flammable Performance Improvements (#2462)
# Description  I'm yeeting the server costs for the flammable system. This system will no longer querry every entity that might be on fire to check if they're on fire, and is instead querrying only entities that have a new OnFireComponent, which is used to tell them that they're on fire. 99% cost reductions are fun. I have verified in testing that this works. # Changelog 🆑 - fix: Dramatically improved performance of the flammable system.
This commit is contained in:
@@ -292,10 +292,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
public void Extinguish(EntityUid uid, FlammableComponent? flammable = null)
|
||||
{
|
||||
if (!Resolve(uid, ref flammable))
|
||||
if (!Resolve(uid, ref flammable) || !flammable.CanExtinguish)
|
||||
return;
|
||||
|
||||
if (!flammable.OnFire || !flammable.CanExtinguish)
|
||||
RemCompDeferred<OnFireComponent>(uid);
|
||||
if (!flammable.OnFire)
|
||||
return;
|
||||
|
||||
_adminLogger.Add(LogType.Flammable, $"{ToPrettyString(uid):entity} stopped being on fire damage");
|
||||
@@ -314,6 +315,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!Resolve(uid, ref flammable, false)) // Lavaland Change: SHUT THE FUCK UP FLAMMABLE
|
||||
return;
|
||||
|
||||
EnsureComp<OnFireComponent>(uid);
|
||||
if (flammable.AlwaysCombustible)
|
||||
{
|
||||
flammable.FireStacks = Math.Max(flammable.FirestacksOnIgnite, flammable.FireStacks);
|
||||
@@ -407,9 +409,15 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
_timer -= UpdateTime;
|
||||
|
||||
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
|
||||
var query = EntityQueryEnumerator<FlammableComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var uid, out var flammable, out _))
|
||||
var query = EntityQueryEnumerator<OnFireComponent>();
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
if (!TryComp(uid, out FlammableComponent? flammable))
|
||||
{
|
||||
RemCompDeferred<OnFireComponent>(uid);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Slowly dry ourselves off if wet.
|
||||
if (flammable.FireStacks < 0)
|
||||
{
|
||||
@@ -420,6 +428,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
_alertsSystem.ClearAlert(uid, flammable.FireAlert);
|
||||
RaiseLocalEvent(uid, new MoodRemoveEffectEvent("OnFire"));
|
||||
RemCompDeferred<OnFireComponent>(uid);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
6
Content.Shared/Atmos/Components/OnFireComponent.cs
Normal file
6
Content.Shared/Atmos/Components/OnFireComponent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Atmos.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class OnFireComponent : Component { }
|
||||
Reference in New Issue
Block a user