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:
@@ -7,17 +7,14 @@ namespace Content.Client.Interactable.Components
|
||||
[RegisterComponent]
|
||||
public sealed partial class InteractionOutlineComponent : Component
|
||||
{
|
||||
private static readonly ProtoId<ShaderPrototype> ShaderInRange = "SelectionOutlineInrange";
|
||||
private static readonly ProtoId<ShaderPrototype> ShaderOutOfRange = "SelectionOutline";
|
||||
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private const float DefaultWidth = 1;
|
||||
|
||||
[ValidatePrototypeId<ShaderPrototype>]
|
||||
private const string ShaderInRange = "SelectionOutlineInrange";
|
||||
|
||||
[ValidatePrototypeId<ShaderPrototype>]
|
||||
private const string ShaderOutOfRange = "SelectionOutline";
|
||||
|
||||
private bool _inRange;
|
||||
private ShaderInstance? _shader;
|
||||
private int _lastRenderScale;
|
||||
@@ -65,7 +62,7 @@ namespace Content.Client.Interactable.Components
|
||||
{
|
||||
var shaderName = inRange ? ShaderInRange : ShaderOutOfRange;
|
||||
|
||||
var instance = _prototypeManager.Index<ShaderPrototype>(shaderName).InstanceUnique();
|
||||
var instance = _prototypeManager.Index(shaderName).InstanceUnique();
|
||||
instance.SetParameter("outline_width", DefaultWidth * renderScale);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user