2023-05-07 20:24:36 +03:00
|
|
|
|
using Content.Shared.Humanoid;
|
|
|
|
|
|
|
2024-01-28 18:37:24 +07:00
|
|
|
|
namespace Content.Shared._White.TTS;
|
2023-05-07 20:24:36 +03:00
|
|
|
|
|
2024-04-17 11:36:02 +07:00
|
|
|
|
// ReSharper disable once InconsistentNaming
|
2023-05-07 20:24:36 +03:00
|
|
|
|
public sealed class TTSPitchRateSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public bool TryGetPitchRate(EntityUid uid, out List<string> pitchRate)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
|
|
|
|
|
|
{
|
|
|
|
|
|
pitchRate = new List<string>();
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pitchRate = new List<string> {"medium", "medium"};
|
|
|
|
|
|
|
|
|
|
|
|
GetPitchRateForSpecies(uid, humanoid, ref pitchRate);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void GetPitchRateForSpecies(EntityUid uid, HumanoidAppearanceComponent humanoid, ref List<string> pitchRate)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (humanoid.Species)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "SlimePerson":
|
|
|
|
|
|
pitchRate[0] = "high";
|
|
|
|
|
|
pitchRate[1] = "medium";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Arachnid":
|
|
|
|
|
|
pitchRate[0] = "x-high";
|
|
|
|
|
|
pitchRate[1] = "x-fast";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Human":
|
|
|
|
|
|
var meta = MetaData(uid);
|
|
|
|
|
|
if (meta.EntityPrototype != null && meta.EntityPrototype.ToString() == "MobDwarf") //Dwarfs
|
|
|
|
|
|
{
|
|
|
|
|
|
pitchRate[0] = "high";
|
|
|
|
|
|
pitchRate[1] = "slow";
|
|
|
|
|
|
}
|
2023-05-08 14:55:45 +03:00
|
|
|
|
else if (humanoid.SkinColor.R >= 0.6)
|
2023-05-07 20:24:36 +03:00
|
|
|
|
{
|
|
|
|
|
|
pitchRate[0] = "x-low";
|
|
|
|
|
|
pitchRate[1] = "medium";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pitchRate[0] = "medium";
|
|
|
|
|
|
pitchRate[1] = "medium";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Diona":
|
|
|
|
|
|
pitchRate[0] = "x-low";
|
|
|
|
|
|
pitchRate[1] = "x-slow";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Reptilian":
|
|
|
|
|
|
pitchRate[0] = "low";
|
|
|
|
|
|
pitchRate[1] = "slow";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Skrell":
|
|
|
|
|
|
pitchRate[0] = "medium";
|
|
|
|
|
|
pitchRate[1] = "medium";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Skeleton":
|
|
|
|
|
|
pitchRate[0] = "medium";
|
|
|
|
|
|
pitchRate[1] = "medium";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|