Skip to content

Commit

Permalink
Fix Custom Specie Name (#1120)
Browse files Browse the repository at this point in the history
# Description

Custom specie name wouldn't properly update when a different race was
selected, or when you changed profiles.
This fixes that.
Also makes it so the text field is automatically filled with the default
name instead of an empty space.
(and makes the species check less bad 😺 )

Solves #1101

---

<details><summary><h1>Media</h1></summary>
<p>

https://gyazo.com/63ba2d8a3456c19c70f25164ae42078d

</p>
</details>

---

# Changelog

:cl:
- fix: Custom specie name doesn't disappear in the editor anymore.
  • Loading branch information
Aidenkrz authored Oct 22, 2024
1 parent 05a1301 commit ec31b11
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ public void SetProfile(HumanoidCharacterProfile? profile, int? slot)
UpdateSkinColor();
UpdateSpawnPriorityControls();
UpdateFlavorTextEdit();
UpdateCustomSpecieNameEdit();
UpdateAgeEdit();
UpdateEyePickers();
UpdateSaveButton();
Expand Down Expand Up @@ -1206,15 +1207,9 @@ private void UpdateNameEdit()

private void UpdateCustomSpecieNameEdit()
{
if (Profile == null)
return;

_customspecienameEdit.Text = Profile.Customspeciename ?? "";

if (!_prototypeManager.TryIndex<SpeciesPrototype>(Profile.Species, out var speciesProto))
return;

_ccustomspecienamecontainerEdit.Visible = speciesProto.CustomName;
var species = _species.Find(x => x.ID == Profile?.Species) ?? _species.First();
_customspecienameEdit.Text = string.IsNullOrEmpty(Profile?.Customspeciename) ? Loc.GetString(species.Name) : Profile.Customspeciename;
_ccustomspecienamecontainerEdit.Visible = species.CustomName;
}

private void UpdateFlavorTextEdit()
Expand Down

0 comments on commit ec31b11

Please sign in to comment.