Replace ValidatePrototypeId uses with ProtoId or EntProtoId (#38814)
* The easy ones * For certain values of easy * Easy test * Hair * Fix sandbox violations * Sort usings
This commit is contained in:
@@ -24,13 +24,10 @@ public abstract class SharedChatSystem : EntitySystem
|
||||
public const char WhisperPrefix = ',';
|
||||
public const char DefaultChannelKey = 'h';
|
||||
|
||||
[ValidatePrototypeId<RadioChannelPrototype>]
|
||||
public const string CommonChannel = "Common";
|
||||
public static readonly ProtoId<RadioChannelPrototype> CommonChannel = "Common";
|
||||
|
||||
public static string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}";
|
||||
|
||||
[ValidatePrototypeId<SpeechVerbPrototype>]
|
||||
public const string DefaultSpeechVerb = "Default";
|
||||
public static readonly string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}";
|
||||
public static readonly ProtoId<SpeechVerbPrototype> DefaultSpeechVerb = "Default";
|
||||
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
@@ -43,7 +40,7 @@ public abstract class SharedChatSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
DebugTools.Assert(_prototypeManager.HasIndex<RadioChannelPrototype>(CommonChannel));
|
||||
DebugTools.Assert(_prototypeManager.HasIndex(CommonChannel));
|
||||
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypeReload);
|
||||
CacheRadios();
|
||||
}
|
||||
@@ -67,13 +64,13 @@ public abstract class SharedChatSystem : EntitySystem
|
||||
public SpeechVerbPrototype GetSpeechVerb(EntityUid source, string message, SpeechComponent? speech = null)
|
||||
{
|
||||
if (!Resolve(source, ref speech, false))
|
||||
return _prototypeManager.Index<SpeechVerbPrototype>(DefaultSpeechVerb);
|
||||
return _prototypeManager.Index(DefaultSpeechVerb);
|
||||
|
||||
// check for a suffix-applicable speech verb
|
||||
SpeechVerbPrototype? current = null;
|
||||
foreach (var (str, id) in speech.SuffixSpeechVerbs)
|
||||
{
|
||||
var proto = _prototypeManager.Index<SpeechVerbPrototype>(id);
|
||||
var proto = _prototypeManager.Index(id);
|
||||
if (message.EndsWith(Loc.GetString(str)) && proto.Priority >= (current?.Priority ?? 0))
|
||||
{
|
||||
current = proto;
|
||||
@@ -81,7 +78,7 @@ public abstract class SharedChatSystem : EntitySystem
|
||||
}
|
||||
|
||||
// if no applicable suffix verb return the normal one used by the entity
|
||||
return current ?? _prototypeManager.Index<SpeechVerbPrototype>(speech.SpeechVerb);
|
||||
return current ?? _prototypeManager.Index(speech.SpeechVerb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user