SKREEEEEE (#3706)
* Import bird sprites and define basic mob. * SKREEEEEEEEE * Move hair styles to new sprite accessory prototypes. Basic stuff, no multi-species stuff yet. * Vox hair styles and clothes * Make HumanoidCharacterProfile.Default() a static default to fix tests. Usages that wanted the previous random behavior now call Random(). * Remove names from hair style prototypes. (They're in localization files) * Update Content.Shared/Actions/ActionType.cs (sk)reeee github Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5ed935f30a
commit
0ac4c0e85c
@@ -197,9 +197,9 @@ namespace Content.Server.Database
|
||||
Age = humanoid.Age,
|
||||
Sex = humanoid.Sex.ToString(),
|
||||
Gender = humanoid.Gender.ToString(),
|
||||
HairName = appearance.HairStyleName,
|
||||
HairName = appearance.HairStyleId,
|
||||
HairColor = appearance.HairColor.ToHex(),
|
||||
FacialHairName = appearance.FacialHairStyleName,
|
||||
FacialHairName = appearance.FacialHairStyleId,
|
||||
FacialHairColor = appearance.FacialHairColor.ToHex(),
|
||||
EyeColor = appearance.EyeColor.ToHex(),
|
||||
SkinColor = appearance.SkinColor.ToHex(),
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -17,6 +18,8 @@ namespace Content.Server.GameObjects.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class MagicMirrorComponent : SharedMagicMirrorComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly SpriteAccessoryManager _spriteAccessoryManager = default!;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
|
||||
|
||||
public override void Initialize()
|
||||
@@ -39,7 +42,7 @@ namespace Content.Server.GameObjects.Components
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
private static void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
{
|
||||
if (obj.Session.AttachedEntity == null)
|
||||
{
|
||||
@@ -54,18 +57,23 @@ namespace Content.Server.GameObjects.Components
|
||||
switch (obj.Message)
|
||||
{
|
||||
case HairSelectedMessage msg:
|
||||
var map =
|
||||
msg.IsFacialHair ? HairStyles.FacialHairStylesMap : HairStyles.HairStylesMap;
|
||||
if (!map.ContainsKey(msg.HairName))
|
||||
var cat = msg.IsFacialHair
|
||||
? looks.CategoriesFacialHair
|
||||
: looks.CategoriesHair;
|
||||
|
||||
if (!_spriteAccessoryManager.IsValidAccessoryInCategory(msg.HairId, cat))
|
||||
return;
|
||||
|
||||
looks.Appearance = msg.IsFacialHair
|
||||
? looks.Appearance.WithFacialHairStyleName(msg.HairName)
|
||||
: looks.Appearance.WithHairStyleName(msg.HairName);
|
||||
? looks.Appearance.WithFacialHairStyleName(msg.HairId)
|
||||
: looks.Appearance.WithHairStyleName(msg.HairId);
|
||||
|
||||
break;
|
||||
|
||||
case HairColorSelectedMessage msg:
|
||||
if (msg.IsFacialHair ? !looks.CanColorFacialHair : !looks.CanColorHair)
|
||||
return;
|
||||
|
||||
var (r, g, b) = msg.HairColor;
|
||||
var color = new Color(r, g, b);
|
||||
|
||||
@@ -105,9 +113,13 @@ namespace Content.Server.GameObjects.Components
|
||||
var msg = new MagicMirrorInitialDataMessage(
|
||||
appearance.HairColor,
|
||||
appearance.FacialHairColor,
|
||||
appearance.HairStyleName,
|
||||
appearance.FacialHairStyleName,
|
||||
appearance.EyeColor);
|
||||
appearance.HairStyleId,
|
||||
appearance.FacialHairStyleId,
|
||||
appearance.EyeColor,
|
||||
looks.CategoriesHair,
|
||||
looks.CategoriesFacialHair,
|
||||
looks.CanColorHair,
|
||||
looks.CanColorFacialHair);
|
||||
|
||||
UserInterface?.SendMessage(msg, actor.playerSession);
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
if (!profiles.ContainsKey(readyPlayer.UserId))
|
||||
{
|
||||
profiles.Add(readyPlayer.UserId, HumanoidCharacterProfile.Default());
|
||||
profiles.Add(readyPlayer.UserId, HumanoidCharacterProfile.Random());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Content.Server.Preferences
|
||||
{
|
||||
PrefsLoaded = Task.CompletedTask,
|
||||
Prefs = new PlayerPreferences(
|
||||
new[] {new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Default())},
|
||||
new[] {new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Random())},
|
||||
0, Color.Transparent)
|
||||
};
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Content.Server.Preferences
|
||||
var prefs = await _db.GetPlayerPreferencesAsync(userId);
|
||||
if (prefs is null)
|
||||
{
|
||||
return await _db.InitPrefsAsync(userId, HumanoidCharacterProfile.Default());
|
||||
return await _db.InitPrefsAsync(userId, HumanoidCharacterProfile.Random());
|
||||
}
|
||||
|
||||
return SanitizePreferences(prefs);
|
||||
|
||||
Reference in New Issue
Block a user