Holy crap auth works (#2099)
* Holy crap auth works * Fix some usages of UserID instead of UserName * Refactor preferences. They be non-async now. Also faster. * Rename DbContext. * Guest username assignment. * Fix saving of profiles. * Don't store data for guests. * Fix generating invalid random colors. * Don't allow dumb garbage for char preferences. * Bans. * Lol forgot to fill out the command description. * Connection log. * Rename all the tables and columns to be snake_case. * Re-do migrations. * Fixing tests and warnings. * Update submodule
This commit is contained in:
committed by
GitHub
parent
8a33e0a9bd
commit
66c8a68891
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -72,6 +73,47 @@ namespace Content.Shared.Preferences
|
||||
);
|
||||
}
|
||||
|
||||
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance)
|
||||
{
|
||||
string hairStyleName;
|
||||
if (!HairStyles.HairStylesMap.ContainsKey(appearance.HairStyleName))
|
||||
{
|
||||
hairStyleName = HairStyles.DefaultHairStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
hairStyleName = appearance.HairStyleName;
|
||||
}
|
||||
|
||||
string facialHairStyleName;
|
||||
if (!HairStyles.FacialHairStylesMap.ContainsKey(appearance.FacialHairStyleName))
|
||||
{
|
||||
facialHairStyleName = HairStyles.DefaultFacialHairStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
facialHairStyleName = appearance.FacialHairStyleName;
|
||||
}
|
||||
|
||||
var hairColor = ClampColor(appearance.HairColor);
|
||||
var facialHairColor = ClampColor(appearance.FacialHairColor);
|
||||
var eyeColor = ClampColor(appearance.EyeColor);
|
||||
var skinColor = ClampColor(appearance.SkinColor);
|
||||
|
||||
return new HumanoidCharacterAppearance(
|
||||
hairStyleName,
|
||||
hairColor,
|
||||
facialHairStyleName,
|
||||
facialHairColor,
|
||||
eyeColor,
|
||||
skinColor);
|
||||
|
||||
static Color ClampColor(Color color)
|
||||
{
|
||||
return new Color(color.RByte, color.GByte, color.BByte);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MemberwiseEquals(ICharacterAppearance maybeOther)
|
||||
{
|
||||
if (!(maybeOther is HumanoidCharacterAppearance other)) return false;
|
||||
|
||||
Reference in New Issue
Block a user