Prevent players ever spawning as hidden species (#5608)

* Prevent players ever spawning as hidden species

* Prevent double logic

* Update Content.Shared/Preferences/PlayerPreferences.cs

Signed-off-by: Tobias Berger <toby@tobot.dev>

---------

Signed-off-by: Tobias Berger <toby@tobot.dev>
Co-authored-by: Tobias Berger <toby@tobot.dev>
This commit is contained in:
William Lemon 2026-04-03 10:02:38 +11:00 committed by GitHub
parent f7e571fa7c
commit beed7b5a5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,4 @@
using Content.Shared._DV.Species; // DeltaV - Hidden species
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@ -41,7 +42,21 @@ namespace Content.Shared.Preferences
/// <summary>
/// The currently selected character.
/// </summary>
public ICharacterProfile SelectedCharacter => Characters[SelectedCharacterIndex];
public ICharacterProfile SelectedCharacter
{ // Start DeltaV - Prevent spawning as hidden speceis (At all costs)
get
{
// If we can't spawn as the selected character, try to find the NEXT one we can, wrapping if we must.
for (int i = 0; i < Characters.Count; i++)
{
var candidate = Characters[(SelectedCharacterIndex + i) % Characters.Count];
if (candidate is not HumanoidCharacterProfile nextHumanoidProfile) return candidate;
if (!SpeciesHiderSystem.IsHidden(nextHumanoidProfile.Species)) return candidate;
}
// If we can't find ANY valid character, make a new one.
return HumanoidCharacterProfile.Random();
}
} // End DeltaV
public Color AdminOOCColor { get; set; }