[feat] Custom name for clown, mime and borgs

This commit is contained in:
rhailrake
2023-05-04 13:44:24 +06:00
committed by Aviu00
parent f04400926e
commit 68e52f60c9
18 changed files with 3124 additions and 43 deletions

View File

@@ -19,7 +19,31 @@ namespace Content.Client.Preferences.UI
if (Profile == null) return;
var name = HumanoidCharacterProfile.GetName(Profile.Species, Profile.Gender);
SetName(name);
UpdateNameEdit();
UpdateNamesEdit();
}
private void RandomizeClownName()
{
if (Profile == null) return;
var name = HumanoidCharacterProfile.GetClownName();
SetClownName(name);
UpdateNamesEdit();
}
private void RandomizeMimeName()
{
if (Profile == null) return;
var name = HumanoidCharacterProfile.GetMimeName();
SetMimeName(name);
UpdateNamesEdit();
}
private void RandomizeBorgName()
{
if (Profile == null) return;
var name = HumanoidCharacterProfile.GetBorgName();
SetBorgName(name);
UpdateNamesEdit();
}
}
}

View File

@@ -19,6 +19,21 @@
<LineEdit Name="CNameEdit" MinSize="270 0" VerticalAlignment="Center" Margin="5 0 0 0" />
<Button Name="CNameRandomize" Text="{Loc 'humanoid-profile-editor-name-random-button'}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clown-name-label'}" />
<LineEdit Name="CClownNameEdit" MinSize="270 0" VerticalAlignment="Center" Margin="5 0 0 0" />
<Button Name="CClownNameRandomize" Text="{Loc 'humanoid-profile-editor-name-random-button'}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-mime-name-label'}" />
<LineEdit Name="CMimeNameEdit" MinSize="270 0" VerticalAlignment="Center" Margin="5 0 0 0" />
<Button Name="CMimeNameRandomize" Text="{Loc 'humanoid-profile-editor-name-random-button'}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-borg-name-label'}" />
<LineEdit Name="CBorgNameEdit" MinSize="270 0" VerticalAlignment="Center" Margin="5 0 0 0" />
<Button Name="CBorgNameRandomize" Text="{Loc 'humanoid-profile-editor-name-random-button'}" />
</BoxContainer>
<Button Name="CRandomizeEverything" HorizontalAlignment="Center"
HorizontalExpand="False" MaxWidth="256"
Text="{Loc 'humanoid-profile-editor-randomize-everything-button'}" />

View File

@@ -69,7 +69,13 @@ namespace Content.Client.Preferences.UI
private LineEdit _ageEdit => CAgeEdit;
private LineEdit _nameEdit => CNameEdit;
private TextEdit _flavorTextEdit = null!;
private LineEdit _nameClownEdit => CClownNameEdit;
private LineEdit _nameMimeEdit => CMimeNameEdit;
private LineEdit _nameBorgEdit => CBorgNameEdit;
private Button _nameRandomButton => CNameRandomize;
private Button _nameClownRandomButton => CClownNameRandomize;
private Button _nameMimeRandomButton => CMimeNameRandomize;
private Button _nameBorgRandomButton => CBorgNameRandomize;
private Button _randomizeEverythingButton => CRandomizeEverything;
private RichTextLabel _warningLabel => CWarningLabel;
private Button _saveButton => CSaveButton;
@@ -136,7 +142,13 @@ namespace Content.Client.Preferences.UI
#region Name
_nameEdit.OnTextChanged += args => { SetName(args.Text); };
_nameClownEdit.OnTextChanged += args => { SetClownName(args.Text); };
_nameMimeEdit.OnTextChanged += args => { SetMimeName(args.Text); };
_nameBorgEdit.OnTextChanged += args => { SetBorgName(args.Text); };
_nameRandomButton.OnPressed += args => RandomizeName();
_nameClownRandomButton.OnPressed += args => RandomizeClownName();
_nameMimeRandomButton.OnPressed += args => RandomizeMimeName();
_nameBorgRandomButton.OnPressed += args => RandomizeBorgName();
_randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
_warningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]");
@@ -817,6 +829,24 @@ namespace Content.Client.Preferences.UI
IsDirty = true;
}
private void SetClownName(string newName)
{
Profile = Profile?.WithClownName(newName);
IsDirty = true;
}
private void SetMimeName(string newName)
{
Profile = Profile?.WithMimeName(newName);
IsDirty = true;
}
private void SetBorgName(string newName)
{
Profile = Profile?.WithBorgName(newName);
IsDirty = true;
}
private void SetClothing(ClothingPreference newClothing)
{
Profile = Profile?.WithClothingPreference(newClothing);
@@ -852,9 +882,12 @@ namespace Content.Client.Preferences.UI
}
}
private void UpdateNameEdit()
private void UpdateNamesEdit()
{
_nameEdit.Text = Profile?.Name ?? "";
_nameClownEdit.Text = Profile?.ClownName ?? "";
_nameMimeEdit.Text = Profile?.MimeName ?? "";
_nameBorgEdit.Text = Profile?.BorgName ?? "";
}
private void UpdateFlavorTextEdit()
@@ -1134,8 +1167,10 @@ namespace Content.Client.Preferences.UI
public void UpdateControls()
{
if (Profile is null) return;
UpdateNameEdit();
if (Profile is null)
return;
UpdateNamesEdit();
UpdateFlavorTextEdit();
UpdateSexControls();
UpdateGenderControls();

View File

@@ -40,6 +40,9 @@ namespace Content.IntegrationTests.Tests.Preferences
{
return new(
"Charlie Charlieson",
"HONK",
"Quiet",
"Silicon",
"The biggest boy around.",
"Human",
"Eugene",

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Content.Server.Database.Migrations.Postgres
{
public partial class CATaddNamesToProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "borg_name",
table: "profile",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "clown_name",
table: "profile",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "mime_name",
table: "profile",
type: "text",
nullable: false,
defaultValue: "");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "borg_name",
table: "profile");
migrationBuilder.DropColumn(
name: "clown_name",
table: "profile");
migrationBuilder.DropColumn(
name: "mime_name",
table: "profile");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Content.Server.Database.Migrations.Sqlite
{
public partial class CATaddNamesToProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "borg_name",
table: "profile",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "clown_name",
table: "profile",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "mime_name",
table: "profile",
type: "TEXT",
nullable: false,
defaultValue: "");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "borg_name",
table: "profile");
migrationBuilder.DropColumn(
name: "clown_name",
table: "profile");
migrationBuilder.DropColumn(
name: "mime_name",
table: "profile");
}
}
}

View File

@@ -320,6 +320,9 @@ namespace Content.Server.Database
public int Id { get; set; }
public int Slot { get; set; }
[Column("char_name")] public string CharacterName { get; set; } = null!;
public string ClownName { get; set; } = null!;
public string MimeName { get; set; } = null!;
public string BorgName { get; set; } = null!;
public string FlavorText { get; set; } = null!;
public int Age { get; set; }
public string Sex { get; set; } = null!;

View File

@@ -213,6 +213,9 @@ namespace Content.Server.Database
return new HumanoidCharacterProfile(
profile.CharacterName,
profile.ClownName,
profile.MimeName,
profile.BorgName,
profile.FlavorText,
profile.Species,
voice,
@@ -250,6 +253,9 @@ namespace Content.Server.Database
var markings = JsonSerializer.SerializeToDocument(markingStrings);
profile.CharacterName = humanoid.Name;
profile.ClownName = humanoid.ClownName;
profile.MimeName = humanoid.MimeName;
profile.BorgName = humanoid.BorgName;
profile.FlavorText = humanoid.FlavorText;
profile.Species = humanoid.Species;
profile.Age = humanoid.Age;

View File

@@ -202,7 +202,7 @@ namespace Content.Server.GameTicking
DebugTools.AssertNotNull(data);
var newMind = _mind.CreateMind(data!.UserId, character.Name);
var newMind = _mind.CreateMind(data!.UserId, character.Name, character.ClownName, character.MimeName, character.BorgName);
_mind.SetUserId(newMind, data.UserId);
var jobPrototype = _prototypeManager.Index<JobPrototype>(jobId);
@@ -210,42 +210,31 @@ namespace Content.Server.GameTicking
_roles.MindAddRole(newMind, job, silent: silent);
var jobName = _jobs.MindTryGetJobName(newMind);
_playTimeTrackings.PlayerRolesChanged(player);
var whitelistedSpecies = jobPrototype.WhitelistedSpecies;
if (whitelistedSpecies.Count > 0 && !whitelistedSpecies.Contains(character.Species))
if (_cfg.GetCVar(WhiteCVars.FanaticXenophobiaEnabled))
{
var playerProfiles = _prefsManager.GetPreferences(player.UserId).Characters.Values.Cast<HumanoidCharacterProfile>().ToList();
var existedAllowedProfile = playerProfiles.FindAll(x => whitelistedSpecies.Contains(x.Species));
if (existedAllowedProfile.Count == 0)
{
character = HumanoidCharacterProfile.RandomWithSpecies(_robustRandom.Pick(whitelistedSpecies));
_chatManager.DispatchServerMessage(player, "Данному виду запрещено играть на этой профессии. Вам была выдана случайная внешность.");
}
else
{
character = _robustRandom.Pick(existedAllowedProfile);
_chatManager.DispatchServerMessage(player, "Данному виду запрещено играть на этой профессии. Вам была выдана случайная внешность с подходящим видом из вашего профиля.");
}
StringBuilder availableSpeciesLoc = new StringBuilder();
foreach (var specie in whitelistedSpecies)
{
availableSpeciesLoc.AppendLine("-" + Loc.GetString($"species-name-{specie.ToLower()}"));
}
_chatManager.DispatchServerMessage(player, $"Доступные виды: \n {availableSpeciesLoc}");
character = ReplaceBlacklistedSpecies(player, character, jobPrototype);
newMind.Comp.CharacterName = character.Name;
newMind.Comp.ClownName = character.ClownName;
newMind.Comp.MimeName = character.MimeName;
newMind.Comp.BorgName = character.BorgName;
}
_playTimeTrackings.PlayerRolesChanged(player);
var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character);
DebugTools.AssertNotNull(mobMaybe);
var mob = mobMaybe!.Value;
if (jobId.Contains("Clown"))
if (newMind.Comp.ClownName != null)
_metaData.SetEntityName(mob, newMind.Comp.ClownName);
if (jobId.Contains("Mime"))
if (newMind.Comp.MimeName != null)
_metaData.SetEntityName(mob, newMind.Comp.MimeName);
if (jobId.Contains("Cyborg"))
if (newMind.Comp.BorgName != null)
_metaData.SetEntityName(mob, newMind.Comp.BorgName);
_mind.TransferTo(newMind, mob);
if (lateJoin && !silent)
@@ -308,6 +297,42 @@ namespace Content.Server.GameTicking
RaiseLocalEvent(mob, aev, true);
}
private HumanoidCharacterProfile ReplaceBlacklistedSpecies(ICommonSession player, HumanoidCharacterProfile character, JobPrototype jobPrototype)
{
var whitelistedSpecies = jobPrototype.WhitelistedSpecies;
if (whitelistedSpecies.Count > 0 && !whitelistedSpecies.Contains(character.Species))
{
var playerProfiles = _prefsManager.GetPreferences(player.UserId).Characters.Values
.Cast<HumanoidCharacterProfile>().ToList();
var existedAllowedProfile = playerProfiles.FindAll(x => whitelistedSpecies.Contains(x.Species));
if (existedAllowedProfile.Count == 0)
{
character = HumanoidCharacterProfile.RandomWithSpecies(_robustRandom.Pick(whitelistedSpecies));
_chatManager.DispatchServerMessage(player,
"Данному виду запрещено играть на этой профессии. Вам была выдана случайная внешность.");
}
else
{
character = _robustRandom.Pick(existedAllowedProfile);
_chatManager.DispatchServerMessage(player,
"Данному виду запрещено играть на этой профессии. Вам была выдана случайная внешность с подходящим видом из вашего профиля.");
}
StringBuilder availableSpeciesLoc = new StringBuilder();
foreach (var specie in whitelistedSpecies)
{
availableSpeciesLoc.AppendLine("-" + Loc.GetString($"species-name-{specie.ToLower()}"));
}
_chatManager.DispatchServerMessage(player, $"Доступные виды: \n {availableSpeciesLoc}");
}
return character;
}
public void Respawn(ICommonSession player)
{
_mind.WipeMind(player);

View File

@@ -105,7 +105,7 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
DebugTools.Assert(entity is null);
var jobEntity = EntityManager.SpawnEntity(prototype.JobEntity, coordinates);
MakeSentientCommand.MakeSentient(jobEntity, EntityManager);
DoJobSpecials(job, jobEntity);
DoJobSpecials(job, jobEntity, profile);
_identity.QueueIdentityUpdate(jobEntity);
return jobEntity;
}
@@ -141,7 +141,14 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
var startingGear = _prototypeManager.Index<StartingGearPrototype>(prototype.StartingGear);
EquipStartingGear(entity.Value, startingGear, profile);
if (profile != null)
EquipIdCard(entity.Value, profile.Name, prototype, station);
{
if (prototype.ID.Contains("Clown"))
EquipIdCard(entity.Value, profile.ClownName, prototype, station);
else if (prototype.ID.Contains("Mime"))
EquipIdCard(entity.Value, profile.MimeName, prototype, station);
else
EquipIdCard(entity.Value, profile.Name, prototype, station);
}
}
if (profile != null)
@@ -154,12 +161,12 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
}
}
DoJobSpecials(job, entity.Value);
DoJobSpecials(job, entity.Value, profile);
_identity.QueueIdentityUpdate(entity.Value);
return entity.Value;
}
private void DoJobSpecials(JobComponent? job, EntityUid entity)
private void DoJobSpecials(JobComponent? job, EntityUid entity, HumanoidCharacterProfile? profile)
{
if (!_prototypeManager.TryIndex(job?.Prototype ?? string.Empty, out JobPrototype? prototype))
return;
@@ -168,6 +175,42 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
{
jobSpecial.AfterEquip(entity);
}
if (prototype.ID.Contains("Cyborg"))
{
if (_randomizeCharacters || profile == null)
{
_metaSystem.SetEntityName(entity, HumanoidCharacterProfile.GetBorgName());
}
else
{
_metaSystem.SetEntityName(entity, profile.BorgName);
}
}
if (prototype.ID.Contains("Clown"))
{
if (_randomizeCharacters || profile == null)
{
_metaSystem.SetEntityName(entity, HumanoidCharacterProfile.GetClownName());
}
else
{
_metaSystem.SetEntityName(entity, profile.ClownName);
}
}
if (prototype.ID.Contains("Mime"))
{
if (_randomizeCharacters || profile == null)
{
_metaSystem.SetEntityName(entity, HumanoidCharacterProfile.GetMimeName());
}
else
{
_metaSystem.SetEntityName(entity, profile.MimeName);
}
}
}
/// <summary>

View File

@@ -69,7 +69,7 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem
TryComp<FingerprintComponent>(player, out var fingerprintComponent);
TryComp<DnaComponent>(player, out var dnaComponent);
CreateGeneralRecord(station, idUid.Value, profile.Name, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records);
CreateGeneralRecord(station, idUid.Value, profile.Name, profile.ClownName, profile.MimeName, profile.BorgName, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records);
}
@@ -100,7 +100,7 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem
/// Optional - other systems should anticipate this.
/// </param>
/// <param name="records">Station records component.</param>
public void CreateGeneralRecord(EntityUid station, EntityUid? idUid, string name, int age, string species, Gender gender, string jobId, string? mobFingerprint, string? dna, HumanoidCharacterProfile? profile = null,
public void CreateGeneralRecord(EntityUid station, EntityUid? idUid, string name, string clownName, string mimeName, string borgName, int age, string species, Gender gender, string jobId, string? mobFingerprint, string? dna, HumanoidCharacterProfile? profile = null,
StationRecordsComponent? records = null)
{
if (!Resolve(station, ref records))
@@ -116,6 +116,9 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem
var record = new GeneralStationRecord()
{
Name = name,
ClownName = clownName,
MimeName = mimeName,
BorgName = borgName,
Age = age,
JobTitle = jobPrototype.LocalizedName,
JobIcon = jobPrototype.Icon,

View File

@@ -72,5 +72,20 @@ namespace Content.Shared.Humanoid
}
// WD-EDIT
}
public string GetBorgName()
{
return _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_autoborg").Values); //Реди
}
public string GetMimeName()
{
return _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_mime").Values); //Реди
}
public string GetClownName()
{
return _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_clown").Values); //Реди
}
}
}

View File

@@ -64,6 +64,15 @@ namespace Content.Shared.Mind
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? CharacterName { get; set; }
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? ClownName { get; set; }
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? MimeName { get; set; }
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? BorgName { get; set; }
/// <summary>
/// The time of death for this Mind.
/// Can be null - will be null if the Mind is not considered "dead".

View File

@@ -184,12 +184,15 @@ public abstract class SharedMindSystem : EntitySystem
return null;
}
public Entity<MindComponent> CreateMind(NetUserId? userId, string? name = null)
public Entity<MindComponent> CreateMind(NetUserId? userId, string? name = null, string? clownName = null, string? mimeName = null, string? borgName = null)
{
var mindId = Spawn(null, MapCoordinates.Nullspace);
_metadata.SetEntityName(mindId, name == null ? "mind" : $"mind ({name})");
var mind = EnsureComp<MindComponent>(mindId);
mind.CharacterName = name;
mind.ClownName = clownName;
mind.MimeName = mimeName;
mind.BorgName = borgName;
SetUserId(mindId, userId, mind);
return (mindId, mind);

View File

@@ -34,6 +34,9 @@ namespace Content.Shared.Preferences
private HumanoidCharacterProfile(
string name,
string clownName,
string mimeName,
string borgName,
string flavortext,
string species,
int age,
@@ -49,6 +52,9 @@ namespace Content.Shared.Preferences
List<string> traitPreferences)
{
Name = name;
ClownName = clownName;
MimeName = mimeName;
BorgName = borgName;
FlavorText = flavortext;
Species = species;
Voice = voice;
@@ -70,7 +76,7 @@ namespace Content.Shared.Preferences
Dictionary<string, JobPriority> jobPriorities,
List<string> antagPreferences,
List<string> traitPreferences)
: this(other.Name, other.FlavorText, other.Species, other.Voice, other.Age, other.Sex, other.Gender, other.Appearance, other.Clothing, other.Backpack,
: this(other.Name, other.ClownName, other.MimeName, other.BorgName, other.FlavorText, other.Species, other.Voice, other.Age, other.Sex, other.Gender, other.Appearance, other.Clothing, other.Backpack,
jobPriorities, other.PreferenceUnavailable, antagPreferences, traitPreferences)
{
}
@@ -83,6 +89,9 @@ namespace Content.Shared.Preferences
public HumanoidCharacterProfile(
string name,
string clownName,
string mimeName,
string borgName,
string flavortext,
string species,
string voice,
@@ -96,7 +105,7 @@ namespace Content.Shared.Preferences
PreferenceUnavailableMode preferenceUnavailable,
IReadOnlyList<string> antagPreferences,
IReadOnlyList<string> traitPreferences)
: this(name, flavortext, species, age, sex, voice, gender, appearance, clothing, backpack, new Dictionary<string, JobPriority>(jobPriorities),
: this(name, clownName, mimeName, borgName, flavortext, species, age, sex, voice, gender, appearance, clothing, backpack, new Dictionary<string, JobPriority>(jobPriorities),
preferenceUnavailable, new List<string>(antagPreferences), new List<string>(traitPreferences))
{
}
@@ -108,6 +117,9 @@ namespace Content.Shared.Preferences
/// <returns></returns>
public HumanoidCharacterProfile() : this(
"John Doe",
"HONK",
"Quiet",
"Silicon",
"",
SharedHumanoidAppearanceSystem.DefaultSpecies,
SharedHumanoidAppearanceSystem.DefaultVoice,
@@ -136,6 +148,9 @@ namespace Content.Shared.Preferences
{
return new(
"John Doe",
"HONK",
"Quiet",
"Silicon",
"",
species,
SharedHumanoidAppearanceSystem.DefaultVoice,
@@ -190,8 +205,11 @@ namespace Content.Shared.Preferences
var gender = sex == Sex.Male ? Gender.Male : Gender.Female;
var name = GetName(species, gender);
var clownName = GetClownName();
var mimeName = GetMimeName();
var borgName = GetBorgName();
return new HumanoidCharacterProfile(name, "", species, voiceId, age, sex, gender, HumanoidCharacterAppearance.Random(species, sex), ClothingPreference.Jumpsuit, BackpackPreference.Backpack,
return new HumanoidCharacterProfile(name, clownName, mimeName, borgName, "", species, voiceId, age, sex, gender, HumanoidCharacterAppearance.Random(species, sex), ClothingPreference.Jumpsuit, BackpackPreference.Backpack,
new Dictionary<string, JobPriority>
{
{SharedGameTicker.FallbackOverflowJob, JobPriority.High},
@@ -199,6 +217,9 @@ namespace Content.Shared.Preferences
}
public string Name { get; private set; }
public string ClownName { get; private set; }
public string MimeName { get; private set; }
public string BorgName { get; private set; }
public string FlavorText { get; private set; }
public string Species { get; private set; }
@@ -235,6 +256,19 @@ namespace Content.Shared.Preferences
return new(this) { Name = name };
}
public HumanoidCharacterProfile WithClownName(string name)
{
return new(this) { ClownName = name };
}
public HumanoidCharacterProfile WithMimeName(string name)
{
return new(this) { MimeName = name };
}
public HumanoidCharacterProfile WithBorgName(string name)
{
return new(this) { BorgName = name };
}
public HumanoidCharacterProfile WithFlavorText(string flavorText)
{
return new(this) { FlavorText = flavorText };
@@ -357,6 +391,9 @@ namespace Content.Shared.Preferences
{
if (maybeOther is not HumanoidCharacterProfile other) return false;
if (Name != other.Name) return false;
if (ClownName != other.ClownName) return false;
if (MimeName != other.MimeName) return false;
if (BorgName != other.BorgName) return false;
if (Age != other.Age) return false;
if (Sex != other.Sex) return false;
if (Gender != other.Gender) return false;
@@ -414,6 +451,9 @@ namespace Content.Shared.Preferences
};
string name;
string clownName;
string mimeName;
string borgName;
if (string.IsNullOrEmpty(Name))
{
name = GetName(Species, gender);
@@ -426,13 +466,55 @@ namespace Content.Shared.Preferences
{
name = Name;
}
if (string.IsNullOrEmpty(ClownName))
{
clownName = GetClownName();
}
else if (ClownName.Length > MaxNameLength)
{
clownName = ClownName[..MaxNameLength];
}
else
{
clownName = ClownName;
}
if (string.IsNullOrEmpty(MimeName))
{
mimeName = GetMimeName();
}
else if (MimeName.Length > MaxNameLength)
{
mimeName = MimeName[..MaxNameLength];
}
else
{
mimeName = MimeName;
}
if (string.IsNullOrEmpty(BorgName))
{
borgName = GetBorgName();
}
else if (BorgName.Length > MaxNameLength)
{
borgName = BorgName[..MaxNameLength];
}
else
{
borgName = BorgName;
}
name = name.Trim();
clownName = clownName.Trim();
mimeName = mimeName.Trim();
borgName = borgName.Trim();
var configManager = IoCManager.Resolve<IConfigurationManager>();
if (configManager.GetCVar(CCVars.RestrictedNames))
{
name = Regex.Replace(name, @"[^А-Я,а-я,0-9, -]", string.Empty); //WD EDIT
clownName = Regex.Replace(clownName, @"[^А-Я,а-я,0-9, -]", string.Empty);
mimeName = Regex.Replace(mimeName, @"[^А-Я,а-я,0-9, -]", string.Empty);
borgName = Regex.Replace(borgName, @"[^А-Я,а-я,0-9, -]", string.Empty);
}
if (configManager.GetCVar(CCVars.ICNameCase))
@@ -441,11 +523,23 @@ namespace Content.Shared.Preferences
name = Regex.Replace(name,
@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)",
m => m.Groups["word"].Value.ToUpper());
clownName = Regex.Replace(clownName,
@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)",
m => m.Groups["word"].Value.ToUpper());
mimeName = Regex.Replace(mimeName,
@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)",
m => m.Groups["word"].Value.ToUpper());
borgName = Regex.Replace(borgName,
@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)",
m => m.Groups["word"].Value.ToUpper());
}
if (string.IsNullOrEmpty(name))
{
name = GetName(Species, gender);
clownName = GetClownName();
mimeName = GetMimeName();
borgName = GetBorgName();
}
string flavortext;
@@ -503,6 +597,9 @@ namespace Content.Shared.Preferences
.ToList();
Name = name;
ClownName = clownName;
MimeName = mimeName;
BorgName = borgName;
FlavorText = flavortext;
Age = age;
Sex = sex;
@@ -544,6 +641,24 @@ namespace Content.Shared.Preferences
return namingSystem.GetName(species, gender);
}
public static string GetClownName()
{
var namingSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<NamingSystem>();
return namingSystem.GetClownName();
}
public static string GetMimeName()
{
var namingSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<NamingSystem>();
return namingSystem.GetMimeName();
}
public static string GetBorgName()
{
var namingSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<NamingSystem>();
return namingSystem.GetBorgName();
}
public override bool Equals(object? obj)
{
return obj is HumanoidCharacterProfile other && MemberwiseEquals(other);
@@ -562,6 +677,9 @@ namespace Content.Shared.Preferences
Clothing,
Backpack
),
ClownName,
MimeName,
BorgName,
PreferenceUnavailable,
_jobPriorities,
_antagPreferences,

View File

@@ -15,6 +15,15 @@ public sealed class GeneralStationRecord
[ViewVariables]
public string Name = string.Empty;
[ViewVariables]
public string ClownName = string.Empty;
[ViewVariables]
public string MimeName = string.Empty;
[ViewVariables]
public string BorgName = string.Empty;
/// <summary>
/// Age of the person that this station record represents.
/// </summary>