Replace resolve dependency with attribute in components (#1995)

* Replace resolve dependency with attribute in components

* Add changes that went missing in translation
This commit is contained in:
DrSmugleaf
2020-09-02 01:30:03 +02:00
committed by GitHub
parent 4044602187
commit de9dfefd61
23 changed files with 85 additions and 66 deletions

View File

@@ -9,12 +9,14 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
[RegisterComponent]
public class OwOAccentComponent : Component, IAccentComponent
{
[Dependency] private readonly IRobustRandom _random;
public override string Name => "OwOAccent";
private static readonly IReadOnlyList<string> Faces = new List<string>{
" (・`ω´・)", " ;;w;;", " owo", " UwU", " >w<", " ^w^"
}.AsReadOnly();
private string RandomFace => IoCManager.Resolve<IRobustRandom>().Pick(Faces);
private string RandomFace => _random.Pick(Faces);
private static readonly Dictionary<string, string> SpecialWords = new Dictionary<string, string>
{
@@ -23,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
public string Accentuate(string message)
{
foreach ((var word,var repl) in SpecialWords)
foreach (var (word, repl) in SpecialWords)
{
message = message.Replace(word, repl);
}