Make the sentient plant mutation non-copyable to other plantholders (#29133)

make the sentient plant mutation not propagate by clipping, using the seed extractor or cryoxadone
This commit is contained in:
slarticodefast
2024-08-11 11:23:14 +02:00
committed by GitHub
parent 456410239e
commit bd5d415575
3 changed files with 32 additions and 9 deletions

View 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);