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

@@ -10,6 +10,8 @@ namespace Content.Server.GameObjects.Components.Research
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
public class ProtolatheDatabaseComponent : SharedProtolatheDatabaseComponent
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override string Name => "ProtolatheDatabase";
public override ComponentState GetComponentState()
@@ -24,13 +26,11 @@ namespace Content.Server.GameObjects.Components.Research
{
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)) return;
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
foreach (var technology in database.Technologies)
{
foreach (var id in technology.UnlockedRecipes)
{
var recipe = (LatheRecipePrototype)prototypeManager.Index(typeof(LatheRecipePrototype), id);
var recipe = (LatheRecipePrototype) _prototypeManager.Index(typeof(LatheRecipePrototype), id);
UnlockRecipe(recipe);
}
}