Validate remaining ProtoId strings (#38747)
Validate remaining ProtoId strings
This commit is contained in:
@@ -8,12 +8,14 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Body.Systems;
|
||||
|
||||
public partial class SharedBodySystem
|
||||
{
|
||||
private static readonly ProtoId<DamageTypePrototype> BloodlossDamageType = "Bloodloss";
|
||||
private void InitializeParts()
|
||||
{
|
||||
// TODO: This doesn't handle comp removal on child ents.
|
||||
@@ -178,7 +180,7 @@ public partial class SharedBodySystem
|
||||
)
|
||||
{
|
||||
// TODO BODY SYSTEM KILL : remove this when wounding and required parts are implemented properly
|
||||
var damage = new DamageSpecifier(Prototypes.Index<DamageTypePrototype>("Bloodloss"), 300);
|
||||
var damage = new DamageSpecifier(Prototypes.Index(BloodlossDamageType), 300);
|
||||
Damageable.TryChangeDamage(bodyEnt, damage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Shared.Chat;
|
||||
|
||||
public sealed class SharedSuicideSystem : EntitySystem
|
||||
{
|
||||
private static readonly ProtoId<DamageTypePrototype> FallbackDamageType = "Blunt";
|
||||
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -57,8 +59,8 @@ public sealed class SharedSuicideSystem : EntitySystem
|
||||
// We don't want structural damage for the same reasons listed above
|
||||
if (!_prototypeManager.TryIndex(damageType, out var damagePrototype) || damagePrototype.ID == "Structural")
|
||||
{
|
||||
Log.Error($"{nameof(SharedSuicideSystem)} could not find the damage type prototype associated with {damageType}. Falling back to Blunt");
|
||||
damagePrototype = _prototypeManager.Index<DamageTypePrototype>("Blunt");
|
||||
Log.Error($"{nameof(SharedSuicideSystem)} could not find the damage type prototype associated with {damageType}. Falling back to {FallbackDamageType}");
|
||||
damagePrototype = _prototypeManager.Index(FallbackDamageType);
|
||||
}
|
||||
|
||||
var damage = new DamageSpecifier(damagePrototype, lethalAmountOfDamage);
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace Content.Shared.Humanoid
|
||||
/// </summary>
|
||||
public sealed class NamingSystem : EntitySystem
|
||||
{
|
||||
private static readonly ProtoId<SpeciesPrototype> FallbackSpecies = "Human";
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -21,8 +23,8 @@ namespace Content.Shared.Humanoid
|
||||
// Some downstream is probably gonna have this eventually but then they can deal with fallbacks.
|
||||
if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesProto))
|
||||
{
|
||||
speciesProto = _prototypeManager.Index<SpeciesPrototype>("Human");
|
||||
Log.Warning($"Unable to find species {species} for name, falling back to Human");
|
||||
speciesProto = _prototypeManager.Index(FallbackSpecies);
|
||||
Log.Warning($"Unable to find species {species} for name, falling back to {FallbackSpecies}");
|
||||
}
|
||||
|
||||
switch (speciesProto.Naming)
|
||||
|
||||
Reference in New Issue
Block a user