[GenerateTypedNameReferences]
public sealed partial class GroupedAccessLevelChecklist : BoxContainer
{
+ private static readonly ProtoId<AccessGroupPrototype> GeneralAccessGroup = "General";
+
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private bool _isMonotone;
// Ensure that the 'general' access group is added to handle
// misc. access levels that aren't associated with any group
- if (_protoManager.TryIndex<AccessGroupPrototype>("General", out var generalAccessProto))
+ if (_protoManager.TryIndex(GeneralAccessGroup, out var generalAccessProto))
_groupedAccessLevels.TryAdd(generalAccessProto, new());
// Assign known access levels with their associated groups
if (!_prototype.TryIndex<JobIconPrototype>(job, out var icon))
{
- SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(_prototype.Index("JobIconUnknown")));
+ SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(_prototype.Index(UnknownIcon).Icon));
return;
}
public sealed class MutationSystem : EntitySystem
{
+ private static ProtoId<RandomPlantMutationListPrototype> RandomPlantMutations = "RandomPlantMutations";
+
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private RandomPlantMutationListPrototype _randomMutations = default!;
public override void Initialize()
{
- _randomMutations = _prototypeManager.Index<RandomPlantMutationListPrototype>("RandomPlantMutations");
+ _randomMutations = _prototypeManager.Index(RandomPlantMutations);
}
/// <summary>
public sealed class CluwneSystem : EntitySystem
{
+ private static readonly ProtoId<DamageGroupPrototype> GeneticDamageGroup = "Genetic";
+
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
RemComp<CluwneComponent>(uid);
RemComp<ClumsyComponent>(uid);
RemComp<AutoEmoteComponent>(uid);
- var damageSpec = new DamageSpecifier(_prototypeManager.Index<DamageGroupPrototype>("Genetic"), 300);
+ var damageSpec = new DamageSpecifier(_prototypeManager.Index(GeneticDamageGroup), 300);
_damageableSystem.TryChangeDamage(uid, damageSpec);
}
}
[DataDefinition]
public sealed partial class WeightedSpawnEntityBehavior : IThresholdBehavior
{
+ private static readonly EntProtoId TempEntityProtoId = "TemporaryEntityForTimedDespawnSpawners";
+
/// <summary>
/// A table of entities with assigned weights to randomly pick from
/// </summary>
if (SpawnAfter != 0)
{
// if it fails to get the spawner, this won't ever work so just return
- if (!system.PrototypeManager.TryIndex("TemporaryEntityForTimedDespawnSpawners", out var tempSpawnerProto))
+ if (!system.PrototypeManager.TryIndex(TempEntityProtoId, out var tempSpawnerProto))
return;
// spawn the spawner, assign it a lifetime, and assign the entity that it will spawn when despawned
public sealed class EntityEffectSystem : EntitySystem
{
+ private static readonly ProtoId<WeightedRandomFillSolutionPrototype> RandomPickBotanyReagent = "RandomPickBotanyReagent";
+
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly ChatSystem _chat = default!;
return;
var chemicals = plantholder.Seed.Chemicals;
- var randomChems = _protoManager.Index<WeightedRandomFillSolutionPrototype>("RandomPickBotanyReagent").Fills;
+ var randomChems = _protoManager.Index(RandomPickBotanyReagent).Fills;
// Add a random amount of a random chemical to this set of chemicals
if (randomChems != null)
[Dependency] private readonly SharedSalvageSystem _salvage = default!;
[Dependency] private readonly TileSystem _tile = default!;
- [ValidatePrototypeId<LocalizedDatasetPrototype>]
- private const string PlanetNames = "NamesBorer";
+ private static readonly ProtoId<LocalizedDatasetPrototype> PlanetNames = "NamesBorer";
+ private static readonly ProtoId<BiomeTemplatePrototype> BiomeTemplate = "Continental";
+ private static readonly ProtoId<DungeonConfigPrototype> DungeonConfig = "Experiment";
// TODO:
// Fix shader some more
var random = new Random(seed);
var mapUid = _maps.CreateMap();
- var gatewayName = _salvage.GetFTLName(_protoManager.Index<LocalizedDatasetPrototype>(PlanetNames), seed);
+ var gatewayName = _salvage.GetFTLName(_protoManager.Index(PlanetNames), seed);
_metadata.SetEntityName(mapUid, gatewayName);
var origin = new Vector2i(random.Next(-MaxOffset, MaxOffset), random.Next(-MaxOffset, MaxOffset));
};
AddComp(mapUid, restricted);
- _biome.EnsurePlanet(mapUid, _protoManager.Index<BiomeTemplatePrototype>("Continental"), seed);
+ _biome.EnsurePlanet(mapUid, _protoManager.Index(BiomeTemplate), seed);
var grid = Comp<MapGridComponent>(mapUid);
var dungeonRotation = _dungeon.GetDungeonRotation(seed);
var dungeonPosition = (origin + dungeonRotation.RotateVec(new Vector2i(0, dungeonDistance))).Floored();
- _dungeon.GenerateDungeon(_protoManager.Index<DungeonConfigPrototype>("Experiment"), args.MapUid, grid, dungeonPosition, seed);
+ _dungeon.GenerateDungeon(_protoManager.Index(DungeonConfig), args.MapUid, grid, dungeonPosition, seed);
// TODO: Dungeon mobs + loot.
private EntityQuery<PhysicsComponent> _physicsQuery;
private static readonly ProtoId<TagPrototype> AllowGhostShownByEventTag = "AllowGhostShownByEvent";
+ private static readonly ProtoId<DamageTypePrototype> AsphyxiationDamageType = "Asphyxiation";
public override void Initialize()
{
dealtDamage = playerDeadThreshold - damageable.TotalDamage;
}
- DamageSpecifier damage = new(_prototypeManager.Index<DamageTypePrototype>("Asphyxiation"), dealtDamage);
+ DamageSpecifier damage = new(_prototypeManager.Index(AsphyxiationDamageType), dealtDamage);
_damageable.TryChangeDamage(playerEntity, damage, true);
}
public sealed partial class SalvageSystem
{
- [ValidatePrototypeId<EntityPrototype>]
- public const string CoordinatesDisk = "CoordinatesDisk";
+ public static readonly EntProtoId CoordinatesDisk = "CoordinatesDisk";
+ public static readonly ProtoId<LocalizedDatasetPrototype> PlanetNames = "NamesBorer";
private void OnSalvageClaimMessage(EntityUid uid, SalvageExpeditionConsoleComponent component, ClaimSalvageMessage args)
{
var mission = GetMission(_prototypeManager.Index<SalvageDifficultyPrototype>(missionparams.Difficulty), missionparams.Seed);
data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1);
- _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index<LocalizedDatasetPrototype>("NamesBorer"), missionparams.Seed));
+ _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index(PlanetNames), missionparams.Seed));
_audio.PlayPvs(component.PrintSound, uid);
UpdateConsoles((station.Value, data));
destComp.Enabled = true;
_metaData.SetEntityName(
mapUid,
- _entManager.System<SharedSalvageSystem>().GetFTLName(_prototypeManager.Index<LocalizedDatasetPrototype>("NamesBorer"), _missionParams.Seed));
+ _entManager.System<SharedSalvageSystem>().GetFTLName(_prototypeManager.Index(SalvageSystem.PlanetNames), _missionParams.Seed));
_entManager.AddComponent<FTLBeaconComponent>(mapUid);
// Saving the mission mapUid to a CD is made optional, in case one is somehow made in a process without a CD entity
public sealed class RandomSentienceRule : StationEventSystem<RandomSentienceRuleComponent>
{
+ private static readonly ProtoId<LocalizedDatasetPrototype> DataSourceNames = "RandomSentienceEventData";
+ private static readonly ProtoId<LocalizedDatasetPrototype> IntelligenceLevelNames = "RandomSentienceEventStrength";
+
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IRobustRandom _random = default!;
protected override void Started(EntityUid uid, RandomSentienceRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
station.Value,
Loc.GetString("station-event-random-sentience-announcement",
("kind1", kind1), ("kind2", kind2), ("kind3", kind3), ("amount", groupList.Count),
- ("data", _random.Pick(_prototype.Index<LocalizedDatasetPrototype>("RandomSentienceEventData"))),
- ("strength", _random.Pick(_prototype.Index<LocalizedDatasetPrototype>("RandomSentienceEventStrength")))
+ ("data", _random.Pick(_prototype.Index(DataSourceNames))),
+ ("strength", _random.Pick(_prototype.Index(IntelligenceLevelNames)))
),
playDefaultSound: false,
colorOverride: Color.Gold
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.
)
{
// 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);
}
}
public sealed class SharedSuicideSystem : EntitySystem
{
+ private static readonly ProtoId<DamageTypePrototype> FallbackDamageType = "Blunt";
+
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
// 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);
/// </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!;
// 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)