[Feat] Тонкие спрайты снова в строю (#102)
* Revert "Hair Overhaul (#19298)"
This reverts commit 9491f322de.
# Conflicts:
# Resources/Textures/Mobs/Customization/human_hair.rsi/a.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/afro.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/afro2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/bigafro.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/cornrows2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/emofringe.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/keanu.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long3.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json
# Resources/Textures/Mobs/Customization/human_hair.rsi/modern.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/quiff.png
* add: возврат системы тонкоспрайтов
* fix: небольшие фиксы после реверта причесок
* add: старые текстуры для slim бодитайпа
* fix: фикс причесок после апстрима
This commit is contained in:
@@ -180,6 +180,7 @@ namespace Content.Server.Database
|
||||
if (Enum.TryParse<Sex>(profile.Sex, true, out var sexVal))
|
||||
sex = sexVal;
|
||||
|
||||
var bodyType = profile.BodyType;
|
||||
var clothing = ClothingPreference.Jumpsuit;
|
||||
if (Enum.TryParse<ClothingPreference>(profile.Clothing, true, out var clothingVal))
|
||||
clothing = clothingVal;
|
||||
@@ -225,6 +226,7 @@ namespace Content.Server.Database
|
||||
profile.Age,
|
||||
sex,
|
||||
gender,
|
||||
bodyType,
|
||||
new HumanoidCharacterAppearance
|
||||
(
|
||||
profile.HairName,
|
||||
@@ -265,6 +267,7 @@ namespace Content.Server.Database
|
||||
profile.Age = humanoid.Age;
|
||||
profile.Sex = humanoid.Sex.ToString();
|
||||
profile.Gender = humanoid.Gender.ToString();
|
||||
profile.BodyType = humanoid.BodyType;
|
||||
profile.HairName = appearance.HairStyleId;
|
||||
profile.HairColor = appearance.HairColor.ToHex();
|
||||
profile.FacialHairName = appearance.FacialHairStyleId;
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
{
|
||||
Text = "Modify markings",
|
||||
Category = VerbCategory.Tricks,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"),
|
||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"),
|
||||
Act = () =>
|
||||
{
|
||||
_uiSystem.TryOpen(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession);
|
||||
@@ -37,6 +37,7 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
uid,
|
||||
HumanoidMarkingModifierKey.Key,
|
||||
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
|
||||
component.BodyType,
|
||||
component.Sex,
|
||||
component.SkinColor,
|
||||
component.CustomBaseLayers
|
||||
@@ -45,7 +46,9 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
});
|
||||
}
|
||||
|
||||
private void OnBaseLayersSet(EntityUid uid, HumanoidAppearanceComponent component,
|
||||
private void OnBaseLayersSet(
|
||||
EntityUid uid,
|
||||
HumanoidAppearanceComponent component,
|
||||
HumanoidMarkingModifierBaseLayersSetMessage message)
|
||||
{
|
||||
if (message.Session is not { } player
|
||||
@@ -63,7 +66,7 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
component.CustomBaseLayers[message.Layer] = message.Info.Value;
|
||||
}
|
||||
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
|
||||
if (message.ResendState)
|
||||
{
|
||||
@@ -71,14 +74,17 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
uid,
|
||||
HumanoidMarkingModifierKey.Key,
|
||||
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
|
||||
component.Sex,
|
||||
component.SkinColor,
|
||||
component.CustomBaseLayers
|
||||
));
|
||||
component.BodyType,
|
||||
component.Sex,
|
||||
component.SkinColor,
|
||||
component.CustomBaseLayers
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMarkingsSet(EntityUid uid, HumanoidAppearanceComponent component,
|
||||
private void OnMarkingsSet(
|
||||
EntityUid uid,
|
||||
HumanoidAppearanceComponent component,
|
||||
HumanoidMarkingModifierMarkingSetMessage message)
|
||||
{
|
||||
if (message.Session is not { } player
|
||||
@@ -88,7 +94,7 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
}
|
||||
|
||||
component.MarkingSet = message.MarkingSet;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
|
||||
if (message.ResendState)
|
||||
{
|
||||
@@ -96,11 +102,11 @@ public sealed partial class HumanoidAppearanceSystem
|
||||
uid,
|
||||
HumanoidMarkingModifierKey.Key,
|
||||
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
|
||||
component.Sex,
|
||||
component.SkinColor,
|
||||
component.CustomBaseLayers
|
||||
));
|
||||
component.BodyType,
|
||||
component.Sex,
|
||||
component.SkinColor,
|
||||
component.CustomBaseLayers
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
@@ -27,11 +26,12 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
|
||||
private void OnExamined(EntityUid uid, HumanoidAppearanceComponent component, ExaminedEvent args)
|
||||
{
|
||||
var identity = Identity.Entity(component.Owner, EntityManager);
|
||||
var identity = Identity.Entity(uid, EntityManager);
|
||||
var species = GetSpeciesRepresentation(component.Species).ToLower();
|
||||
var age = GetAgeRepresentation(component.Species, component.Age);
|
||||
|
||||
args.PushText(Loc.GetString("humanoid-appearance-component-examine", ("user", identity), ("age", age), ("species", species)));
|
||||
args.PushText(Loc.GetString("humanoid-appearance-component-examine", ("user", identity), ("age", age),
|
||||
("species", species)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,7 +40,10 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="uid">The mob's entity UID.</param>
|
||||
/// <param name="profile">The character profile to load.</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void LoadProfile(EntityUid uid, HumanoidCharacterProfile profile, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void LoadProfile(
|
||||
EntityUid uid,
|
||||
HumanoidCharacterProfile profile,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid))
|
||||
{
|
||||
@@ -51,6 +54,8 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
SetSex(uid, profile.Sex, false, humanoid);
|
||||
humanoid.EyeColor = profile.Appearance.EyeColor;
|
||||
|
||||
SetBodyType(uid, profile.BodyType, false, humanoid);
|
||||
|
||||
SetSkinColor(uid, profile.Appearance.SkinColor, false);
|
||||
|
||||
humanoid.MarkingSet.Clear();
|
||||
@@ -74,10 +79,15 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
|
||||
// Hair/facial hair - this may eventually be deprecated.
|
||||
// We need to ensure hair before applying it or coloring can try depend on markings that can be invalid
|
||||
var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor;
|
||||
var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor;
|
||||
var hairColor = _markingManager.MustMatchSkin(profile.BodyType, HumanoidVisualLayers.Hair, out var hairAlpha,
|
||||
_prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(hairAlpha)
|
||||
: profile.Appearance.HairColor;
|
||||
|
||||
var facialHairColor = _markingManager.MustMatchSkin(profile.BodyType, HumanoidVisualLayers.FacialHair,
|
||||
out var facialHairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha)
|
||||
: profile.Appearance.FacialHairColor;
|
||||
|
||||
if (_markingManager.Markings.TryGetValue(profile.Appearance.HairStyleId, out var hairPrototype) &&
|
||||
_markingManager.CanBeApplied(profile.Species, profile.Sex, hairPrototype, _prototypeManager))
|
||||
@@ -86,12 +96,14 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
}
|
||||
|
||||
if (_markingManager.Markings.TryGetValue(profile.Appearance.FacialHairStyleId, out var facialHairPrototype) &&
|
||||
_markingManager.CanBeApplied(profile.Species,profile.Sex, facialHairPrototype, _prototypeManager))
|
||||
_markingManager.CanBeApplied(profile.Species, profile.Sex, facialHairPrototype, _prototypeManager))
|
||||
{
|
||||
AddMarking(uid, profile.Appearance.FacialHairStyleId, facialHairColor, false);
|
||||
}
|
||||
|
||||
humanoid.MarkingSet.EnsureSpecies(profile.Species, profile.Appearance.SkinColor, _markingManager, _prototypeManager);
|
||||
humanoid.MarkingSet.EnsureSpecies(profile.Species, profile.BodyType, profile.Appearance.SkinColor,
|
||||
_markingManager,
|
||||
_prototypeManager);
|
||||
|
||||
// Finally adding marking with forced colors
|
||||
foreach (var (marking, prototype) in markingFColored)
|
||||
@@ -102,6 +114,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
profile.Appearance.EyeColor,
|
||||
humanoid.MarkingSet
|
||||
);
|
||||
|
||||
AddMarking(uid, marking.MarkingId, markingColors, false);
|
||||
}
|
||||
|
||||
@@ -128,7 +141,10 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="target">Target entity to apply the source entity's appearance to.</param>
|
||||
/// <param name="sourceHumanoid">Source entity's humanoid component.</param>
|
||||
/// <param name="targetHumanoid">Target entity's humanoid component.</param>
|
||||
public void CloneAppearance(EntityUid source, EntityUid target, HumanoidAppearanceComponent? sourceHumanoid = null,
|
||||
public void CloneAppearance(
|
||||
EntityUid source,
|
||||
EntityUid target,
|
||||
HumanoidAppearanceComponent? sourceHumanoid = null,
|
||||
HumanoidAppearanceComponent? targetHumanoid = null)
|
||||
{
|
||||
if (!Resolve(source, ref sourceHumanoid) || !Resolve(target, ref targetHumanoid))
|
||||
@@ -143,6 +159,8 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
SetSex(target, sourceHumanoid.Sex, false, targetHumanoid);
|
||||
targetHumanoid.CustomBaseLayers = new(sourceHumanoid.CustomBaseLayers);
|
||||
targetHumanoid.MarkingSet = new(sourceHumanoid.MarkingSet);
|
||||
targetHumanoid.BodyType = sourceHumanoid.BodyType;
|
||||
SetTTSVoice(target, sourceHumanoid.Voice, targetHumanoid);
|
||||
|
||||
targetHumanoid.Gender = sourceHumanoid.Gender;
|
||||
if (TryComp<GrammarComponent>(target, out var grammar))
|
||||
@@ -153,6 +171,32 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
Dirty(targetHumanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a humanoid mob's body yupe. This will change their base sprites.
|
||||
/// </summary>
|
||||
/// <param name="uid">The humanoid mob's UID.</param>
|
||||
/// <param name="bodyType">The body type to set the mob to. Will return if the body type prototype was invalid.</param>
|
||||
/// <param name="sync">Whether to immediately synchronize this to the humanoid mob, or not.</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void SetBodyType(
|
||||
EntityUid uid,
|
||||
string bodyType,
|
||||
bool sync = true,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid) || !_prototypeManager.TryIndex<BodyTypePrototype>(bodyType, out _))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
humanoid.BodyType = bodyType;
|
||||
|
||||
if (sync)
|
||||
{
|
||||
Dirty(uid, humanoid);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a marking to this humanoid.
|
||||
/// </summary>
|
||||
@@ -162,7 +206,13 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="sync">Whether to immediately sync this marking or not</param>
|
||||
/// <param name="forced">If this marking was forced (ignores marking points)</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void AddMarking(EntityUid uid, string marking, Color? color = null, bool sync = true, bool forced = false, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void AddMarking(
|
||||
EntityUid uid,
|
||||
string marking,
|
||||
Color? color = null,
|
||||
bool sync = true,
|
||||
bool forced = false,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid)
|
||||
|| !_markingManager.Markings.TryGetValue(marking, out var prototype))
|
||||
@@ -195,7 +245,13 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="sync">Whether to immediately sync this marking or not</param>
|
||||
/// <param name="forced">If this marking was forced (ignores marking points)</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void AddMarking(EntityUid uid, string marking, IReadOnlyList<Color> colors, bool sync = true, bool forced = false, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void AddMarking(
|
||||
EntityUid uid,
|
||||
string marking,
|
||||
IReadOnlyList<Color> colors,
|
||||
bool sync = true,
|
||||
bool forced = false,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid)
|
||||
|| !_markingManager.Markings.TryGetValue(marking, out var prototype))
|
||||
@@ -218,7 +274,11 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="marking">The marking to try and remove.</param>
|
||||
/// <param name="sync">Whether to immediately sync this to the humanoid</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void RemoveMarking(EntityUid uid, string marking, bool sync = true, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void RemoveMarking(
|
||||
EntityUid uid,
|
||||
string marking,
|
||||
bool sync = true,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid)
|
||||
|| !_markingManager.Markings.TryGetValue(marking, out var prototype))
|
||||
@@ -239,7 +299,11 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="category">Category of the marking</param>
|
||||
/// <param name="index">Index of the marking</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void RemoveMarking(EntityUid uid, MarkingCategories category, int index, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void RemoveMarking(
|
||||
EntityUid uid,
|
||||
MarkingCategories category,
|
||||
int index,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (index < 0
|
||||
|| !Resolve(uid, ref humanoid)
|
||||
@@ -261,7 +325,12 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="index">Index of the marking</param>
|
||||
/// <param name="markingId">The marking ID to use</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void SetMarkingId(EntityUid uid, MarkingCategories category, int index, string markingId, HumanoidAppearanceComponent? humanoid = null)
|
||||
public void SetMarkingId(
|
||||
EntityUid uid,
|
||||
MarkingCategories category,
|
||||
int index,
|
||||
string markingId,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (index < 0
|
||||
|| !_markingManager.MarkingsByCategory(category).TryGetValue(markingId, out var markingPrototype)
|
||||
@@ -290,7 +359,11 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// <param name="index">Index of the marking</param>
|
||||
/// <param name="colors">The marking colors to use</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void SetMarkingColor(EntityUid uid, MarkingCategories category, int index, List<Color> colors,
|
||||
public void SetMarkingColor(
|
||||
EntityUid uid,
|
||||
MarkingCategories category,
|
||||
int index,
|
||||
List<Color> colors,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (index < 0
|
||||
@@ -314,37 +387,24 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
/// </summary>
|
||||
public string GetSpeciesRepresentation(string speciesId)
|
||||
{
|
||||
if (_prototypeManager.TryIndex<SpeciesPrototype>(speciesId, out var species))
|
||||
{
|
||||
return Loc.GetString(species.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Loc.GetString("humanoid-appearance-component-unknown-species");
|
||||
}
|
||||
return Loc.GetString(_prototypeManager.TryIndex<SpeciesPrototype>(speciesId, out var species)
|
||||
? species.Name
|
||||
: "humanoid-appearance-component-unknown-species");
|
||||
}
|
||||
|
||||
public string GetAgeRepresentation(string species, int age)
|
||||
{
|
||||
_prototypeManager.TryIndex<SpeciesPrototype>(species, out var speciesPrototype);
|
||||
|
||||
if (speciesPrototype == null)
|
||||
if (speciesPrototype != null)
|
||||
{
|
||||
Logger.Error("Tried to get age representation of species that couldn't be indexed: " + species);
|
||||
return Loc.GetString("identity-age-young");
|
||||
return age < speciesPrototype.YoungAge
|
||||
? Loc.GetString("identity-age-young")
|
||||
: Loc.GetString(age < speciesPrototype.OldAge ? "identity-age-middle-aged" : "identity-age-old");
|
||||
}
|
||||
|
||||
if (age < speciesPrototype.YoungAge)
|
||||
{
|
||||
return Loc.GetString("identity-age-young");
|
||||
}
|
||||
|
||||
if (age < speciesPrototype.OldAge)
|
||||
{
|
||||
return Loc.GetString("identity-age-middle-aged");
|
||||
}
|
||||
|
||||
return Loc.GetString("identity-age-old");
|
||||
Logger.Error("Tried to get age representation of species that couldn't be indexed: " + species);
|
||||
return Loc.GetString("identity-age-young");
|
||||
}
|
||||
|
||||
private void EnsureDefaultMarkings(EntityUid uid, HumanoidAppearanceComponent? humanoid)
|
||||
@@ -353,6 +413,7 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
humanoid.MarkingSet.EnsureDefault(humanoid.SkinColor, humanoid.EyeColor, _markingManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Database;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server._White.Sponsors;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
@@ -16,7 +17,6 @@ using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
||||
namespace Content.Server.Preferences.Managers
|
||||
{
|
||||
/// <summary>
|
||||
@@ -90,6 +90,7 @@ namespace Content.Server.Preferences.Managers
|
||||
{
|
||||
Logger.WarningS("prefs",
|
||||
$"User {userId} sent a {nameof(MsgUpdateCharacter)} with a null profile in slot {slot}.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,7 +108,9 @@ namespace Content.Server.Preferences.Managers
|
||||
var curPrefs = prefsData.Prefs!;
|
||||
|
||||
// WD-EDIT
|
||||
var allowedMarkings = _sponsors.TryGetInfo(message.MsgChannel.UserId, out var sponsor) ? sponsor.AllowedMarkings : new string[]{};
|
||||
var allowedMarkings = _sponsors.TryGetInfo(message.MsgChannel.UserId, out var sponsor)
|
||||
? sponsor.AllowedMarkings
|
||||
: new string[] { };
|
||||
|
||||
bool isAdminSpecie = false;
|
||||
if (_playerManager.TryGetSessionById(message.MsgChannel.UserId, out var session))
|
||||
@@ -168,7 +171,8 @@ namespace Content.Server.Preferences.Managers
|
||||
var arr = new Dictionary<int, ICharacterProfile>(curPrefs.Characters);
|
||||
arr.Remove(slot);
|
||||
|
||||
prefsData.Prefs = new PlayerPreferences(arr, nextSlot ?? curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor);
|
||||
prefsData.Prefs =
|
||||
new PlayerPreferences(arr, nextSlot ?? curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor);
|
||||
|
||||
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
||||
{
|
||||
@@ -193,7 +197,7 @@ namespace Content.Server.Preferences.Managers
|
||||
{
|
||||
PrefsLoaded = true,
|
||||
Prefs = new PlayerPreferences(
|
||||
new[] {new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Random())},
|
||||
new[] { new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Random()) },
|
||||
0, Color.Transparent)
|
||||
};
|
||||
|
||||
@@ -214,8 +218,13 @@ namespace Content.Server.Preferences.Managers
|
||||
// WD-EDIT
|
||||
foreach (var (_, profile) in prefs.Characters)
|
||||
{
|
||||
var allowedMarkings = _sponsors.TryGetInfo(session.UserId, out var sponsor) ? sponsor.AllowedMarkings : new string[]{};
|
||||
bool isAdminSpecie = _adminManager.HasAdminFlag(session, Shared.Administration.AdminFlags.AdminSpecies);
|
||||
var allowedMarkings = _sponsors.TryGetInfo(session.UserId, out var sponsor)
|
||||
? sponsor.AllowedMarkings
|
||||
: new string[] { };
|
||||
|
||||
bool isAdminSpecie =
|
||||
_adminManager.HasAdminFlag(session, Shared.Administration.AdminFlags.AdminSpecies);
|
||||
|
||||
profile.EnsureValid(allowedMarkings, isAdminSpecie);
|
||||
}
|
||||
// WD-EDIT
|
||||
@@ -229,6 +238,7 @@ namespace Content.Server.Preferences.Managers
|
||||
{
|
||||
MaxCharacterSlots = GetMaxUserCharacterSlots(session.UserId)
|
||||
};
|
||||
|
||||
_netManager.ServerSendMessage(msg, session.Channel);
|
||||
}
|
||||
}
|
||||
@@ -257,7 +267,8 @@ namespace Content.Server.Preferences.Managers
|
||||
/// <param name="userId">User Id to get preferences for</param>
|
||||
/// <param name="playerPreferences">The user preferences if true, otherwise null</param>
|
||||
/// <returns>If preferences are not null</returns>
|
||||
public bool TryGetCachedPreferences(NetUserId userId,
|
||||
public bool TryGetCachedPreferences(
|
||||
NetUserId userId,
|
||||
[NotNullWhen(true)] out PlayerPreferences? playerPreferences)
|
||||
{
|
||||
if (_cachedPlayerPrefs.TryGetValue(userId, out var prefs))
|
||||
@@ -309,21 +320,27 @@ namespace Content.Server.Preferences.Managers
|
||||
case HumanoidCharacterProfile hp:
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
var selectedSpecies = HumanoidAppearanceSystem.DefaultSpecies;
|
||||
|
||||
if (prototypeManager.TryIndex<SpeciesPrototype>(hp.Species, out var species) && species.RoundStart)
|
||||
if (!prototypeManager.TryIndex<SpeciesPrototype>(hp.Species, out var selectedSpecies) ||
|
||||
selectedSpecies.RoundStart)
|
||||
{
|
||||
selectedSpecies = hp.Species;
|
||||
selectedSpecies = prototypeManager.Index<SpeciesPrototype>(hp.Species);
|
||||
}
|
||||
|
||||
if (!prototypeManager.TryIndex<BodyTypePrototype>(hp.BodyType, out var selectedBodyType) ||
|
||||
!SharedHumanoidAppearanceSystem.IsBodyTypeValid(selectedBodyType, selectedSpecies, hp.Sex))
|
||||
{
|
||||
selectedBodyType = prototypeManager.Index<BodyTypePrototype>(
|
||||
SharedHumanoidAppearanceSystem.DefaultBodyType);
|
||||
}
|
||||
|
||||
newProf = hp
|
||||
.WithJobPriorities(
|
||||
hp.JobPriorities.Where(job =>
|
||||
_protos.HasIndex<JobPrototype>(job.Key)))
|
||||
.WithAntagPreferences(
|
||||
hp.AntagPreferences.Where(antag =>
|
||||
_protos.HasIndex<AntagPrototype>(antag)))
|
||||
.WithSpecies(selectedSpecies);
|
||||
.WithJobPriorities(hp.JobPriorities.Where(job => _protos.HasIndex<JobPrototype>(job.Key)))
|
||||
.WithAntagPreferences(hp.AntagPreferences.Where(antag =>
|
||||
_protos.HasIndex<AntagPrototype>(antag)))
|
||||
.WithSpecies(selectedSpecies.ID)
|
||||
.WithBodyType(selectedBodyType.ID);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user