]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make the sentient plant mutation non-copyable to other plantholders (#29133)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Sun, 11 Aug 2024 09:23:14 +0000 (11:23 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Aug 2024 09:23:14 +0000 (19:23 +1000)
make the sentient plant mutation not propagate by clipping, using the seed extractor or cryoxadone

Content.Server/Botany/Systems/MutationSystem.cs
Content.Server/Botany/Systems/PlantHolderSystem.cs
Content.Server/Botany/Systems/SeedExtractorSystem.cs

index 474859823a3906ce16c0fdce2d29bd513a11c047..c9272375102691b47564e928568a9b3f1828add0 100644 (file)
@@ -38,7 +38,7 @@ public sealed class MutationSystem : EntitySystem
         }
 
         // Add up everything in the bits column and put the number here.
-        const int totalbits = 275;
+        const int totalbits = 262;
 
         #pragma warning disable IDE0055 // disable formatting warnings because this looks more readable
         // Tolerances (55)
@@ -65,10 +65,10 @@ public sealed class MutationSystem : EntitySystem
         // Kill the plant (30)
         MutateBool(ref seed.Viable        , false, 30, totalbits, severity);
 
-        // Fun (90)
+        // Fun (72)
         MutateBool(ref seed.Seedless      , true , 10, totalbits, severity);
         MutateBool(ref seed.Slip          , true , 10, totalbits, severity);
-        MutateBool(ref seed.Sentient      , true , 10, totalbits, severity);
+        MutateBool(ref seed.Sentient      , true , , totalbits, severity);
         MutateBool(ref seed.Ligneous      , true , 10, totalbits, severity);
         MutateBool(ref seed.Bioluminescent, true , 10, totalbits, severity);
         MutateBool(ref seed.TurnIntoKudzu , true , 10, totalbits, severity);
@@ -115,10 +115,10 @@ public sealed class MutationSystem : EntitySystem
         CrossFloat(ref result.Production, a.Production);
         CrossFloat(ref result.Potency, a.Potency);
 
+        // we do not transfer Sentient to another plant to avoid ghost role spam
         CrossBool(ref result.Seedless, a.Seedless);
         CrossBool(ref result.Viable, a.Viable);
         CrossBool(ref result.Slip, a.Slip);
-        CrossBool(ref result.Sentient, a.Sentient);
         CrossBool(ref result.Ligneous, a.Ligneous);
         CrossBool(ref result.Bioluminescent, a.Bioluminescent);
         CrossBool(ref result.TurnIntoKudzu, a.TurnIntoKudzu);
index c8842e149398524dee6c773bed9ce30b1f8df1ce..53cee92a2987c30f02f84f151b3149941c98fedf 100644 (file)
@@ -298,8 +298,17 @@ public sealed class PlantHolderSystem : EntitySystem
             {
                 healthOverride = component.Health;
             }
-            component.Seed.Unique = false;
-            var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, healthOverride);
+            var packetSeed = component.Seed;
+            if (packetSeed.Sentient)
+            {
+                packetSeed = packetSeed.Clone(); // clone before modifying the seed
+                packetSeed.Sentient = false;
+            }
+            else
+            {
+                packetSeed.Unique = false;
+            }
+            var seed = _botany.SpawnSeedPacket(packetSeed, Transform(args.User).Coordinates, args.User, healthOverride);
             _randomHelper.RandomOffset(seed, 0.25f);
             var displayName = Loc.GetString(component.Seed.DisplayName);
             _popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
@@ -626,8 +635,15 @@ public sealed class PlantHolderSystem : EntitySystem
         }
         else if (component.Age < 0) // Revert back to seed packet!
         {
+            var packetSeed = component.Seed;
+            if (packetSeed.Sentient)
+            {
+                if (!packetSeed.Unique) // clone if necessary before modifying the seed
+                    packetSeed = packetSeed.Clone();
+                packetSeed.Sentient = false; // remove Sentient to avoid ghost role spam
+            }
             // will put it in the trays hands if it has any, please do not try doing this
-            _botany.SpawnSeedPacket(component.Seed, Transform(uid).Coordinates, uid);
+            _botany.SpawnSeedPacket(packetSeed, Transform(uid).Coordinates, uid);
             RemovePlant(uid, component);
             component.ForceUpdate = true;
             Update(uid, component);
index 9a5e70762e78ece77e42752d57704773a348f50e..4a0d56bfe98133c30f862bbd8255c93a426c911f 100644 (file)
@@ -42,12 +42,19 @@ public sealed class SeedExtractorSystem : EntitySystem
         var amount = _random.Next(seedExtractor.BaseMinSeeds, seedExtractor.BaseMaxSeeds + 1);
         var coords = Transform(uid).Coordinates;
 
+        var packetSeed = seed;
+        if (packetSeed.Sentient)
+        {
+            if (!packetSeed.Unique) // clone if necessary before modifying the seed
+                packetSeed = packetSeed.Clone();
+            packetSeed.Sentient = false; // remove Sentient to avoid ghost role spam
+        }
         if (amount > 1)
-            seed.Unique = false;
+            packetSeed.Unique = false;
 
         for (var i = 0; i < amount; i++)
         {
-            _botanySystem.SpawnSeedPacket(seed, coords, args.User);
+            _botanySystem.SpawnSeedPacket(packetSeed, coords, args.User);
         }
     }
 }