Validate ShaderPrototype IDs (#38728)

* Convert all shader prototype string literals to protoids in overlays

* Convert more shader prototype literal strings to protoids

* Convert ValidatePrototypeId to ProtoId

* Later
This commit is contained in:
Tayrtahn
2025-07-03 21:11:31 -04:00
committed by GitHub
parent fba22e831d
commit 9186b65b14
36 changed files with 130 additions and 68 deletions

View File

@@ -15,6 +15,9 @@ namespace Content.Client.Outline;
/// </summary>
public sealed class TargetOutlineSystem : EntitySystem
{
private static readonly ProtoId<ShaderPrototype> ShaderTargetValid = "SelectionOutlineInrange";
private static readonly ProtoId<ShaderPrototype> ShaderTargetInvalid = "SelectionOutline";
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
@@ -70,12 +73,6 @@ public sealed class TargetOutlineSystem : EntitySystem
private Vector2 LookupVector => new(LookupSize, LookupSize);
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderTargetValid = "SelectionOutlineInrange";
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderTargetInvalid = "SelectionOutline";
private ShaderInstance? _shaderTargetValid;
private ShaderInstance? _shaderTargetInvalid;
@@ -85,8 +82,8 @@ public sealed class TargetOutlineSystem : EntitySystem
{
base.Initialize();
_shaderTargetValid = _prototypeManager.Index<ShaderPrototype>(ShaderTargetValid).InstanceUnique();
_shaderTargetInvalid = _prototypeManager.Index<ShaderPrototype>(ShaderTargetInvalid).InstanceUnique();
_shaderTargetValid = _prototypeManager.Index(ShaderTargetValid).InstanceUnique();
_shaderTargetInvalid = _prototypeManager.Index(ShaderTargetInvalid).InstanceUnique();
}
public void Disable()