Validate some SpeciesPrototype fields (#35965)
* Convert SpeciesPrototype strings to ProtoIds * Simplify protoman indexing calls
This commit is contained in:
@@ -62,7 +62,7 @@ namespace Content.Shared.Humanoid.Markings
|
||||
string species)
|
||||
{
|
||||
var speciesProto = _prototypeManager.Index<SpeciesPrototype>(species);
|
||||
var onlyWhitelisted = _prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var onlyWhitelisted = _prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var res = new Dictionary<string, MarkingPrototype>();
|
||||
|
||||
foreach (var (key, marking) in MarkingsByCategory(category))
|
||||
@@ -125,7 +125,7 @@ namespace Content.Shared.Humanoid.Markings
|
||||
string species, Sex sex)
|
||||
{
|
||||
var speciesProto = _prototypeManager.Index<SpeciesPrototype>(species);
|
||||
var onlyWhitelisted = _prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var onlyWhitelisted = _prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var res = new Dictionary<string, MarkingPrototype>();
|
||||
|
||||
foreach (var (key, marking) in MarkingsByCategory(category))
|
||||
@@ -197,7 +197,7 @@ namespace Content.Shared.Humanoid.Markings
|
||||
IoCManager.Resolve(ref prototypeManager);
|
||||
|
||||
var speciesProto = prototypeManager.Index<SpeciesPrototype>(species);
|
||||
var onlyWhitelisted = prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var onlyWhitelisted = prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
|
||||
if (!TryGetMarking(marking, out var prototype))
|
||||
{
|
||||
@@ -228,7 +228,7 @@ namespace Content.Shared.Humanoid.Markings
|
||||
IoCManager.Resolve(ref prototypeManager);
|
||||
|
||||
var speciesProto = prototypeManager.Index<SpeciesPrototype>(species);
|
||||
var onlyWhitelisted = prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
var onlyWhitelisted = prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted;
|
||||
|
||||
if (onlyWhitelisted && prototype.SpeciesRestrictions == null)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ namespace Content.Shared.Humanoid.Markings
|
||||
IoCManager.Resolve(ref prototypeManager);
|
||||
var speciesProto = prototypeManager.Index<SpeciesPrototype>(species);
|
||||
if (
|
||||
!prototypeManager.TryIndex(speciesProto.SpriteSet, out HumanoidSpeciesBaseSpritesPrototype? baseSprites) ||
|
||||
!prototypeManager.TryIndex(speciesProto.SpriteSet, out var baseSprites) ||
|
||||
!baseSprites.Sprites.TryGetValue(layer, out var spriteName) ||
|
||||
!prototypeManager.TryIndex(spriteName, out HumanoidSpeciesSpriteLayer? sprite) ||
|
||||
sprite == null ||
|
||||
|
||||
Reference in New Issue
Block a user