From 17f3fc1287c33be50b0d9bf8b0ea7f9b22b74e98 Mon Sep 17 00:00:00 2001
From: keronshb <54602815+keronshb@users.noreply.github.com>
Date: Sat, 28 Oct 2023 09:47:42 -0400
Subject: [PATCH] Moves cloning comp & cloning event to shared (#21253)
---
Content.Server/Cloning/CloningSystem.cs | 18 ---
.../Cloning/Components/CloningPodComponent.cs | 107 -------------
Content.Server/Zombies/ZombieSystem.cs | 1 +
Content.Shared/Cloning/CloningPodComponent.cs | 142 ++++++++++++++++++
.../Cloning/SharedCloningPodComponent.cs | 18 ---
5 files changed, 143 insertions(+), 143 deletions(-)
delete mode 100644 Content.Server/Cloning/Components/CloningPodComponent.cs
create mode 100644 Content.Shared/Cloning/CloningPodComponent.cs
delete mode 100644 Content.Shared/Cloning/SharedCloningPodComponent.cs
diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs
index c81651c512..6d34e0e6f7 100644
--- a/Content.Server/Cloning/CloningSystem.cs
+++ b/Content.Server/Cloning/CloningSystem.cs
@@ -373,22 +373,4 @@ namespace Content.Server.Cloning
ClonesWaitingForMind.Clear();
}
}
-
- ///
- /// Raised after a new mob got spawned when cloning a humanoid
- ///
- [ByRefEvent]
- public struct CloningEvent
- {
- public bool NameHandled = false;
-
- public readonly EntityUid Source;
- public readonly EntityUid Target;
-
- public CloningEvent(EntityUid source, EntityUid target)
- {
- Source = source;
- Target = target;
- }
- }
}
diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs
deleted file mode 100644
index e2c3f46978..0000000000
--- a/Content.Server/Cloning/Components/CloningPodComponent.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using Content.Shared.Cloning;
-using Content.Shared.Construction.Prototypes;
-using Content.Shared.Materials;
-using Robust.Shared.Audio;
-using Robust.Shared.Containers;
-using Robust.Shared.Prototypes;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
-
-namespace Content.Server.Cloning.Components
-{
- [RegisterComponent]
- public sealed partial class CloningPodComponent : Component
- {
- public const string PodPort = "CloningPodReceiver";
-
- [ViewVariables]
- public ContainerSlot BodyContainer = default!;
-
- ///
- /// How long the cloning has been going on for.
- ///
- [ViewVariables]
- public float CloningProgress = 0;
-
- [ViewVariables]
- public int UsedBiomass = 70;
-
- [ViewVariables]
- public bool FailedClone = false;
-
- ///
- /// The material that is used to clone entities.
- ///
- [DataField("requiredMaterial", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)]
- public string RequiredMaterial = "Biomass";
-
- ///
- /// The base amount of time it takes to clone a body
- ///
- [DataField("baseCloningTime")]
- public float BaseCloningTime = 30f;
-
- ///
- /// The multiplier for cloning duration
- ///
- [DataField("partRatingSpeedMultiplier")]
- public float PartRatingSpeedMultiplier = 0.75f;
-
- ///
- /// The machine part that affects cloning speed
- ///
- [DataField("machinePartCloningSpeed", customTypeSerializer: typeof(PrototypeIdSerializer))]
- public string MachinePartCloningSpeed = "Manipulator";
-
- ///
- /// The current amount of time it takes to clone a body
- ///
- [ViewVariables(VVAccess.ReadWrite)]
- public float CloningTime = 30f;
-
- ///
- /// The mob to spawn on emag
- ///
- [ViewVariables(VVAccess.ReadWrite), DataField("mobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer))]
- public string MobSpawnId = "MobAbomination";
-
- ///
- /// Emag sound effects.
- ///
- [DataField("sparkSound")]
- public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks")
- {
- Params = AudioParams.Default.WithVolume(8),
- };
-
- [DataField("screamSound")]
- public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("ZombieScreams")
- {
- Params = AudioParams.Default.WithVolume(4),
- };
-
- ///
- /// The machine part that affects how much biomass is needed to clone a body.
- ///
- [DataField("partRatingMaterialMultiplier")]
- public float PartRatingMaterialMultiplier = 0.85f;
-
- ///
- /// The current multiplier on the body weight, which determines the
- /// amount of biomass needed to clone.
- ///
- [ViewVariables(VVAccess.ReadWrite)]
- public float BiomassRequirementMultiplier = 1;
-
- ///
- /// The machine part that decreases the amount of material needed for cloning
- ///
- [DataField("machinePartMaterialUse", customTypeSerializer: typeof(PrototypeIdSerializer))]
- public string MachinePartMaterialUse = "MatterBin";
-
- [ViewVariables(VVAccess.ReadWrite)]
- public CloningPodStatus Status;
-
- [ViewVariables]
- public EntityUid? ConnectedConsole;
- }
-}
diff --git a/Content.Server/Zombies/ZombieSystem.cs b/Content.Server/Zombies/ZombieSystem.cs
index 1f8f5fbd42..51cbf34d99 100644
--- a/Content.Server/Zombies/ZombieSystem.cs
+++ b/Content.Server/Zombies/ZombieSystem.cs
@@ -8,6 +8,7 @@ using Content.Server.Emoting.Systems;
using Content.Server.Inventory;
using Content.Server.Speech.EntitySystems;
using Content.Shared.Bed.Sleep;
+using Content.Shared.Cloning;
using Content.Shared.Damage;
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
diff --git a/Content.Shared/Cloning/CloningPodComponent.cs b/Content.Shared/Cloning/CloningPodComponent.cs
new file mode 100644
index 0000000000..60d4c1e64e
--- /dev/null
+++ b/Content.Shared/Cloning/CloningPodComponent.cs
@@ -0,0 +1,142 @@
+using Content.Shared.Construction.Prototypes;
+using Content.Shared.DeviceLinking;
+using Content.Shared.Materials;
+using Robust.Shared.Audio;
+using Robust.Shared.Containers;
+using Robust.Shared.Prototypes;
+using Robust.Shared.Serialization;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
+
+namespace Content.Shared.Cloning;
+
+[RegisterComponent]
+public sealed partial class CloningPodComponent : Component
+{
+ [ValidatePrototypeId]
+ public const string PodPort = "CloningPodReceiver";
+
+ [ViewVariables]
+ public ContainerSlot BodyContainer = default!;
+
+ ///
+ /// How long the cloning has been going on for.
+ ///
+ [ViewVariables]
+ public float CloningProgress = 0;
+
+ [ViewVariables]
+ public int UsedBiomass = 70;
+
+ [ViewVariables]
+ public bool FailedClone = false;
+
+ ///
+ /// The material that is used to clone entities.
+ ///
+ [DataField("requiredMaterial"), ViewVariables(VVAccess.ReadWrite)]
+ public ProtoId RequiredMaterial = "Biomass";
+
+ ///
+ /// The base amount of time it takes to clone a body
+ ///
+ [DataField("baseCloningTime")]
+ public float BaseCloningTime = 30f;
+
+ ///
+ /// The multiplier for cloning duration
+ ///
+ [DataField("partRatingSpeedMultiplier")]
+ public float PartRatingSpeedMultiplier = 0.75f;
+
+ ///
+ /// The machine part that affects cloning speed
+ ///
+ [DataField("machinePartCloningSpeed"), ViewVariables(VVAccess.ReadWrite)]
+ public ProtoId MachinePartCloningSpeed = "Manipulator";
+
+ ///
+ /// The current amount of time it takes to clone a body
+ ///
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float CloningTime = 30f;
+
+ ///
+ /// The mob to spawn on emag
+ ///
+ [DataField("mobSpawnId"), ViewVariables(VVAccess.ReadWrite)]
+ public EntProtoId MobSpawnId = "MobAbomination";
+
+ ///
+ /// Emag sound effects.
+ ///
+ [DataField("sparkSound")]
+ public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks")
+ {
+ Params = AudioParams.Default.WithVolume(8),
+ };
+
+ // TODO: Remove this from here when cloning and/or zombies are refactored
+ [DataField("screamSound")]
+ public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("ZombieScreams")
+ {
+ Params = AudioParams.Default.WithVolume(4),
+ };
+
+ ///
+ /// The machine part that affects how much biomass is needed to clone a body.
+ ///
+ [DataField("partRatingMaterialMultiplier")]
+ public float PartRatingMaterialMultiplier = 0.85f;
+
+ ///
+ /// The current multiplier on the body weight, which determines the
+ /// amount of biomass needed to clone.
+ ///
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float BiomassRequirementMultiplier = 1;
+
+ ///
+ /// The machine part that decreases the amount of material needed for cloning
+ ///
+ [DataField("machinePartMaterialUse"), ViewVariables(VVAccess.ReadWrite)]
+ public ProtoId MachinePartMaterialUse = "MatterBin";
+
+ [ViewVariables(VVAccess.ReadWrite)]
+ public CloningPodStatus Status;
+
+ [ViewVariables]
+ public EntityUid? ConnectedConsole;
+}
+
+[Serializable, NetSerializable]
+public enum CloningPodVisuals : byte
+{
+ Status
+}
+
+[Serializable, NetSerializable]
+public enum CloningPodStatus : byte
+{
+ Idle,
+ Cloning,
+ Gore,
+ NoMind
+}
+
+///
+/// Raised after a new mob got spawned when cloning a humanoid
+///
+[ByRefEvent]
+public struct CloningEvent
+{
+ public bool NameHandled = false;
+
+ public readonly EntityUid Source;
+ public readonly EntityUid Target;
+
+ public CloningEvent(EntityUid source, EntityUid target)
+ {
+ Source = source;
+ Target = target;
+ }
+}
diff --git a/Content.Shared/Cloning/SharedCloningPodComponent.cs b/Content.Shared/Cloning/SharedCloningPodComponent.cs
deleted file mode 100644
index aafbb597ed..0000000000
--- a/Content.Shared/Cloning/SharedCloningPodComponent.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Robust.Shared.Serialization;
-
-namespace Content.Shared.Cloning
-{
- [Serializable, NetSerializable]
- public enum CloningPodVisuals : byte
- {
- Status
- }
- [Serializable, NetSerializable]
- public enum CloningPodStatus : byte
- {
- Idle,
- Cloning,
- Gore,
- NoMind
- }
-}