Invalid species fallback on spawn/profile validation (#14675)
* if a player's profile has an invalid species, station spawning will always try to fallback to the default humanoid species * validation always ensures that if a species can't be indexed, the species falls back to the default species
This commit is contained in:
@@ -105,9 +105,12 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
return jobEntity;
|
return jobEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = EntityManager.SpawnEntity(
|
if (!_prototypeManager.TryIndex(profile?.Species ?? HumanoidAppearanceSystem.DefaultSpecies, out SpeciesPrototype? species))
|
||||||
_prototypeManager.Index<SpeciesPrototype>(profile?.Species ?? HumanoidAppearanceSystem.DefaultSpecies).Prototype,
|
{
|
||||||
coordinates);
|
species = _prototypeManager.Index<SpeciesPrototype>(HumanoidAppearanceSystem.DefaultSpecies);
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = EntityManager.SpawnEntity(species.Prototype, coordinates);
|
||||||
|
|
||||||
if (job?.StartingGear != null)
|
if (job?.StartingGear != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -354,7 +354,11 @@ namespace Content.Shared.Preferences
|
|||||||
{
|
{
|
||||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
|
|
||||||
prototypeManager.TryIndex<SpeciesPrototype>(Species, out var speciesPrototype);
|
if (!prototypeManager.TryIndex<SpeciesPrototype>(Species, out var speciesPrototype))
|
||||||
|
{
|
||||||
|
Species = SharedHumanoidAppearanceSystem.DefaultSpecies;
|
||||||
|
speciesPrototype = prototypeManager.Index<SpeciesPrototype>(Species);
|
||||||
|
}
|
||||||
|
|
||||||
var sex = Sex switch
|
var sex = Sex switch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user