Inline EntityManager

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:11:52 +01:00
parent bd18574412
commit 5e177ae734
108 changed files with 250 additions and 199 deletions

View File

@@ -62,7 +62,7 @@ namespace Content.Server.Spawners.Components
}
if(!Owner.Deleted)
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
}
public virtual void MapInit()

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Spawners.Components
{
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
{
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
return;
}
@@ -54,7 +54,7 @@ namespace Content.Server.Spawners.Components
var x_negative = random.Prob(0.5f) ? -1 : 1;
var y_negative = random.Prob(0.5f) ? -1 : 1;
var entity = Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
}

View File

@@ -76,7 +76,7 @@ namespace Content.Server.Spawners.Components
for (int i = 0; i < number; i++)
{
var entity = _robustRandom.Pick(Prototypes);
Owner.EntityManager.SpawnEntity(entity, Owner.Transform.Coordinates);
IoCManager.Resolve<IEntityManager>().SpawnEntity(entity, Owner.Transform.Coordinates);
}
}
}