Upstream fixes (#663)

* fix weird name saving

* fix item status

* Fix single-user BUIs erroneously closing (#28375)

(cherry picked from commit 08952b467d9b2b2db85cb9ebb4e8b628c0145716)

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
ThereDrD
2024-08-24 12:36:43 +03:00
committed by GitHub
parent 63b816b83b
commit dba9565865
6 changed files with 35 additions and 17 deletions

View File

@@ -526,6 +526,7 @@ namespace Content.Client.Preferences.UI
_controller.UpdateProfile(Profile); _controller.UpdateProfile(Profile);
_controller.ReloadCharacterUI(); _controller.ReloadCharacterUI();
IsDirty = true; IsDirty = true;
} }
@@ -1308,7 +1309,7 @@ namespace Content.Client.Preferences.UI
private void SetBodyType(string newBodyType) private void SetBodyType(string newBodyType)
{ {
Profile = Profile?.WithBodyType(newBodyType); Profile = Profile?.WithBodyType(newBodyType);
IsDirty = true; SetDirty();
_needUpdatePreview = true; _needUpdatePreview = true;
} }

View File

@@ -28,7 +28,9 @@ namespace Content.Shared.Preferences
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed partial class HumanoidCharacterProfile : ICharacterProfile public sealed partial class HumanoidCharacterProfile : ICharacterProfile
{ {
private static readonly Regex RestrictedNameRegex = new("[^A-Z,a-z,0-9, -]"); // WD edit PLEASE DO NOT CHANGE RUSSIAN TO ENGLISH LETTERS, иначе уебу
private static readonly Regex RestrictedNameRegex = new("[^А-Я,а-я,0-9, -]");
private static readonly Regex RestrictedNameBorgsRegex = new("[^А-Я,а-я,0-9, -\\.]");
private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)"); private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");
public const int MaxNameLength = 32; public const int MaxNameLength = 32;
@@ -461,9 +463,9 @@ namespace Content.Shared.Preferences
{ {
if (maybeOther is not HumanoidCharacterProfile other) return false; if (maybeOther is not HumanoidCharacterProfile other) return false;
if (Name != other.Name) return false; if (Name != other.Name) return false;
if (ClownName != other.ClownName) return false; if (ClownName != other.ClownName) return false; // WD
if (MimeName != other.MimeName) return false; if (MimeName != other.MimeName) return false; // WD
if (BorgName != other.BorgName) return false; if (BorgName != other.BorgName) return false; // WD
if (Age != other.Age) return false; if (Age != other.Age) return false;
if (Sex != other.Sex) return false; if (Sex != other.Sex) return false;
if (Gender != other.Gender) return false; if (Gender != other.Gender) return false;
@@ -532,9 +534,13 @@ namespace Content.Shared.Preferences
}; };
string name; string name;
// WD edit start
string clownName; string clownName;
string mimeName; string mimeName;
string borgName; string borgName;
// WD edit end
if (string.IsNullOrEmpty(Name)) if (string.IsNullOrEmpty(Name))
{ {
name = GetName(Species, gender); name = GetName(Species, gender);
@@ -548,6 +554,7 @@ namespace Content.Shared.Preferences
name = Name; name = Name;
} }
// WD edit start
if (string.IsNullOrEmpty(ClownName)) if (string.IsNullOrEmpty(ClownName))
{ {
clownName = GetClownName(); clownName = GetClownName();
@@ -586,36 +593,48 @@ namespace Content.Shared.Preferences
{ {
borgName = BorgName; borgName = BorgName;
} }
// WD edit end
name = name.Trim(); name = name.Trim();
// WD edit start
clownName = clownName.Trim(); clownName = clownName.Trim();
mimeName = mimeName.Trim(); mimeName = mimeName.Trim();
borgName = borgName.Trim(); borgName = borgName.Trim();
// WD edit end
if (configManager.GetCVar(CCVars.RestrictedNames)) if (configManager.GetCVar(CCVars.RestrictedNames))
{ {
name = RestrictedNameRegex.Replace(name, string.Empty); name = RestrictedNameRegex.Replace(name, string.Empty);
// WD edit start
clownName = RestrictedNameRegex.Replace(clownName, string.Empty); clownName = RestrictedNameRegex.Replace(clownName, string.Empty);
mimeName = RestrictedNameRegex.Replace(mimeName, string.Empty); mimeName = RestrictedNameRegex.Replace(mimeName, string.Empty);
borgName = RestrictedNameRegex.Replace(borgName, string.Empty); borgName = RestrictedNameBorgsRegex.Replace(borgName, string.Empty);
// WD edit end
} }
if (configManager.GetCVar(CCVars.ICNameCase)) if (configManager.GetCVar(CCVars.ICNameCase))
{ {
// This regex replaces the first character of the first and last words of the name with their uppercase version // This regex replaces the first character of the first and last words of the name with their uppercase version
name = name = ICNameCaseRegex.Replace(name, m => m.Groups["word"].Value.ToUpper()); name = ICNameCaseRegex.Replace(name, m => m.Groups["word"].Value.ToUpper());
clownName = clownName = ICNameCaseRegex.Replace(name, m => m.Groups["word"].Value.ToUpper());
mimeName = mimeName = ICNameCaseRegex.Replace(name, m => m.Groups["word"].Value.ToUpper()); // Clowns, mimes and cyborgs may not have surnames
borgName = borgName = ICNameCaseRegex.Replace(name, m => m.Groups["word"].Value.ToUpper()); //clownName = ICNameCaseRegex.Replace(clownName, m => m.Groups["word"].Value.ToUpper());
//mimeName = ICNameCaseRegex.Replace(mimeName, m => m.Groups["word"].Value.ToUpper());
//borgName = ICNameCaseRegex.Replace(borgName, m => m.Groups["word"].Value.ToUpper());
} }
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
{ {
name = GetName(Species, gender); name = GetName(Species, gender);
// WD edit start
clownName = GetClownName(); clownName = GetClownName();
mimeName = GetMimeName(); mimeName = GetMimeName();
borgName = GetBorgName(); borgName = GetBorgName();
// WD edit end
} }
var flavortext = FlavorText.Length > MaxDescLength var flavortext = FlavorText.Length > MaxDescLength

View File

@@ -13,8 +13,8 @@
torso: torso:
part: TorsoHuman part: TorsoHuman
connections: connections:
- left arm
- right arm - right arm
- left arm
- left leg - left leg
- right leg - right leg
right arm: right arm:
@@ -55,8 +55,8 @@
torso: torso:
part: TorsoTerminator part: TorsoTerminator
connections: connections:
- left arm
- right arm - right arm
- left arm
- left leg - left leg
- right leg - right leg
right arm: right arm:

View File

@@ -13,8 +13,8 @@
torso: torso:
part: TorsoHuman part: TorsoHuman
connections: connections:
- left arm
- right arm - right arm
- left arm
- left leg - left leg
- right leg - right leg
organs: organs:

View File

@@ -13,8 +13,8 @@
torso: torso:
part: TorsoHuman part: TorsoHuman
connections: connections:
- left arm
- right arm - right arm
- left arm
- left leg - left leg
- right leg - right leg
organs: organs:

View File

@@ -6,7 +6,6 @@
abstract: true abstract: true
components: components:
- type: HarpySinger - type: HarpySinger
- type: Instrument - type: Instrument
allowPercussion: false allowPercussion: false
program: 52 program: 52
@@ -87,13 +86,12 @@
sprite: "Effects/creampie.rsi" sprite: "Effects/creampie.rsi"
state: "creampie_human" state: "creampie_human"
visible: false visible: false
# Yes, RArm has to be down here # Yes, RArm has to be down here. WHY
- map: [ "enum.HumanoidVisualLayers.RArm" ] - map: [ "enum.HumanoidVisualLayers.RArm" ]
- map: [ "enum.HumanoidVisualLayers.Hair" ] - map: [ "enum.HumanoidVisualLayers.Hair" ]
- map: [ "enum.HumanoidVisualLayers.HeadTop" ] - map: [ "enum.HumanoidVisualLayers.HeadTop" ]
- map: [ "mask" ] - map: [ "mask" ]
- map: [ "head" ] - map: [ "head" ]
- type: HumanoidAppearance - type: HumanoidAppearance
species: Harpy species: Harpy
- type: Fixtures - type: Fixtures