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

@@ -304,7 +304,7 @@ namespace Content.Shared.Body.Components
foreach (var mechanism in _mechanisms)
{
Owner.EntityManager.EventBus.RaiseLocalEvent(mechanism.OwnerUid, new AddedToBodyEvent(body));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.OwnerUid, new AddedToBodyEvent(body));
}
}
@@ -319,7 +319,7 @@ namespace Content.Shared.Body.Components
foreach (var mechanism in _mechanisms)
{
Owner.EntityManager.EventBus.RaiseLocalEvent(mechanism.OwnerUid, new RemovedFromBodyEvent(old));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.OwnerUid, new RemovedFromBodyEvent(old));
}
}

View File

@@ -2,6 +2,7 @@
using Content.Shared.Body.Events;
using Content.Shared.Body.Part;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -36,11 +37,11 @@ namespace Content.Shared.Body.Components
{
if (old.Body == null)
{
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartEvent(old));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartEvent(old));
}
else
{
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartInBodyEvent(old.Body, old));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartInBodyEvent(old.Body, old));
}
}
@@ -48,11 +49,11 @@ namespace Content.Shared.Body.Components
{
if (value.Body == null)
{
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartEvent(value));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartEvent(value));
}
else
{
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartInBodyEvent(value.Body, value));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartInBodyEvent(value.Body, value));
}
}
}