]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make Firespread logical (#41636)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Sun, 30 Nov 2025 13:58:39 +0000 (05:58 -0800)
committerGitHub <noreply@github.com>
Sun, 30 Nov 2025 13:58:39 +0000 (13:58 +0000)
* FIRE

* code comment fix

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Atmos/EntitySystems/FlammableSystem.cs

index 071c63c5000595c3d63667fc19727405a41cfacb..f630e4e61001b200e56b2c87e94a0776d72e0c34 100644 (file)
@@ -225,20 +225,14 @@ namespace Content.Server.Atmos.EntitySystems
                 mass2 = otherPhys.Mass;
             }
 
-            // when the thing on fire is more massive than the other, the following happens:
-            // - the thing on fire loses a small number of firestacks
-            // - the other thing gains a large number of firestacks
-            // so a person on fire engulfs a mouse, but an engulfed mouse barely does anything to a person
-            var total = mass1 + mass2;
-            var avg = (flammable.FireStacks + otherFlammable.FireStacks) / total;
-
-            // swap the entity losing stacks depending on whichever has the most firestack kilos
-            var (src, dest) = flammable.FireStacks * mass1 > otherFlammable.FireStacks * mass2
-                ? (-1f, 1f)
-                : (1f, -1f);
-            // bring each entity to the same firestack mass, firestacks being scaled by the other's mass
-            AdjustFireStacks(uid, src * avg * mass2, flammable, ignite: true);
-            AdjustFireStacks(otherUid, dest * avg * mass1, otherFlammable, ignite: true);
+            // Get the average of both entity's firestacks * mass
+            // Then for each entity, we divide the average by their mass and set their firestacks to that value
+            // An entity with a higher mass will lose some fire and transfer it to the one with lower mass.
+            var avg = (flammable.FireStacks * mass1  + otherFlammable.FireStacks * mass2) / 2f;
+
+            // bring each entity to the same firestack mass, firestack amount is scaled by the inverse of the entity's mass
+            SetFireStacks(uid, avg / mass1, flammable, ignite: true);
+            SetFireStacks(otherUid, avg / mass2, otherFlammable, ignite: true);
         }
 
         private void OnIsHot(EntityUid uid, FlammableComponent flammable, IsHotEvent args)