mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00:00
* Do the thing for everyone. Height is now +/- 20% for everyone. * Make the height slider show height. Solve for special cases. Solve world hunger. * Fixed some minor things. * Adjust some densities * Smaller character balance * Comment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Oops, that was from a failed thing. * Size calc correction * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * people are tall in the future * I need to refactor a bit still. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refactor into a system * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * smol * Fixed remaining scale visual components and species * Remove MockScale. Just add scale visuals for Allalulo to compensate. * PR feedback * Slight refactor. Moved profile/species scale out of the scale system and put it into the HumanoidProfileSystem. Removed some CD logic that is no longer needed. * how'd this get in there * Move the other motorkind.yml to AprilFools dir * NO NO_PENTALTY lol * Other PR stuff * Other PR stuff * Add a dirty * Add some networking to the comp * Add small character to cloning * One more fixX --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
namespace Content.Client._CD.Records.UI;
|
|
|
|
public static class UnitConversion
|
|
{
|
|
/// <summary>
|
|
/// DeltaV - The average height of a human in centimeters. According to the US CDC, its
|
|
/// 171 for men and 160 for women. So average of that is ~165cm.
|
|
///
|
|
/// Just kidding, we're going with EE's arbitrary standard of 175cm.
|
|
/// </summary>
|
|
private const int AVERAGE_HEIGHT_CM = 175;
|
|
|
|
/// <summary>
|
|
/// DeltaV - 1.0 scale is considered average for humans, so a scale of 1 will be 175cm.
|
|
/// Ensure that scale also includes the base species height AND the user-defined height.
|
|
/// </summary>
|
|
/// <param name="scale"></param>
|
|
/// <returns></returns>
|
|
private static int GetMetricHeightFromScale(float scale = 1)
|
|
{
|
|
// cast as int because we don't care about decimal
|
|
return (int)Math.Max(scale * AVERAGE_HEIGHT_CM, 1); // can't be shorter than 1cm I guess
|
|
}
|
|
|
|
/// <summary>
|
|
/// DeltaV - Gets nicely formatted string that contains both metric and imperial measurements.
|
|
/// With a scale of 1, it should look like... 175cm (5' 9")
|
|
/// </summary>
|
|
/// <param name="scale"></param>
|
|
/// <returns></returns>
|
|
public static string GetMetricAndImperialDisplayFromScale(float scale = 1)
|
|
{
|
|
var metricHeight = GetMetricHeightFromScale(scale);
|
|
return $"{metricHeight}cm ({GetImperialDisplayLength(metricHeight)})";
|
|
}
|
|
|
|
public static string GetImperialDisplayLength(int lengthCm)
|
|
{
|
|
var heightIn = (int)Math.Round(lengthCm * 0.3937007874 /* cm to in*/);
|
|
return $"{heightIn / 12}'{heightIn % 12}\"";
|
|
}
|
|
|
|
public static string GetImperialDisplayMass(int massKg)
|
|
{
|
|
var weightLbs = (int)Math.Round(massKg * 2.2046226218 /* kg to lbs */);
|
|
return $"{weightLbs} lbs";
|
|
}
|
|
}
|