Skip to content

Commit

Permalink
Wall of CCVars.
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Aug 15, 2024
1 parent 463edb7 commit e669b0f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Content.Server/Cloning/CloningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
using Timer = Robust.Shared.Timing.Timer;
using Content.Server.Power.Components;
using Content.Shared.Damage.Prototypes;
using Content.Server.Database.Migrations.Postgres;

namespace Content.Server.Cloning
{
Expand Down Expand Up @@ -406,7 +407,7 @@ private void MakeAHugeMess(EntityUid uid, PhysicsComponent? physics = null, Bloo
}

/// <summary>
/// Start Nyano Code: Handles fetching the mob and any appearance stuff...
/// This function handles the Clone vs. Metem logic, as well as creation of the new body.
/// </summary>
private EntityUid FetchAndSpawnMob
(EntityUid clonePod,
Expand Down Expand Up @@ -456,13 +457,32 @@ private EntityUid FetchAndSpawnMob
{
if (switchingSpecies && !forceOldProfile)
{
var flavorText = _serialization.CreateCopy(pref.FlavorText, null, false, true);
var oldName = _serialization.CreateCopy(pref.Name, null, false, true);

pref = HumanoidCharacterProfile.RandomWithSpecies(newHumanoid.Species);
if (sexes.Contains(humanoid.Sex))

if (sexes.Contains(humanoid.Sex)
&& _config.GetCVar(CCVars.CloningPreserveSex))
pref = pref.WithSex(humanoid.Sex);

pref = pref.WithGender(humanoid.Gender);
pref = pref.WithAge(humanoid.Age);
if (_config.GetCVar(CCVars.CloningPreserveGender))
pref = pref.WithGender(humanoid.Gender);

if (_config.GetCVar(CCVars.CloningPreserveAge))
pref = pref.WithAge(humanoid.Age);

if (_config.GetCVar(CCVars.CloningPreserveHeight))
pref = pref.WithHeight(humanoid.Height);

if (_config.GetCVar(CCVars.CloningPreserveWidth))
pref = pref.WithWidth(humanoid.Width);

if (_config.GetCVar(CCVars.CloningPreserveName))
pref = pref.WithName(oldName);

if (_config.GetCVar(CCVars.CloningPreserveFlavorText))
pref = pref.WithFlavorText(flavorText);
}
_humanoidSystem.LoadProfile(mob, pref);
}
Expand Down
42 changes: 42 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,48 @@ public static readonly CVarDef<int>
public static readonly CVarDef<bool> CloningReclaimSouledBodies =
CVarDef.Create("cloning.reclaim_souled_bodies", false, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis will potentially give people a sex change.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveSex =
CVarDef.Create("cloning.preserve_sex", false, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves Pronouns when reincarnating people.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveGender =
CVarDef.Create("cloning.preserve_gender", true, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves Age.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveAge =
CVarDef.Create("cloning.preserve_age", true, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves height.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveHeight =
CVarDef.Create("cloning.preserve_height", false, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves width.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveWidth =
CVarDef.Create("cloning.preserve_width", false, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves Names. EG: Are you actually a new person?
/// </summary>
public static readonly CVarDef<bool> CloningPreserveName =
CVarDef.Create("cloning.preserve_name", true, CVar.SERVERONLY);

/// <summary>
/// Controls whether or not Metempsychosis preserves Flavor Text.
/// </summary>
public static readonly CVarDef<bool> CloningPreserveFlavorText =
CVarDef.Create("cloning.preserve_flavor_text", true, CVar.SERVERONLY);

#endregion
/*
* Anomaly
Expand Down

0 comments on commit e669b0f

Please sign in to comment.