Inline AddComponent

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:33:40 +01:00
parent 2d130e31d6
commit f64df117be
18 changed files with 26 additions and 19 deletions

View File

@@ -47,7 +47,7 @@ namespace Content.Server.AI.Commands
ent.RemoveComponent<IMoverComponent>();
}
var comp = ent.AddComponent<UtilityAi>();
var comp = IoCManager.Resolve<IEntityManager>().AddComponent<UtilityAi>(ent);
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
for (var i = 1; i < args.Length; i++)

View File

@@ -53,7 +53,7 @@ namespace Content.Server.Atmos.Commands
return;
}
grid.AddComponent<GridAtmosphereComponent>();
IoCManager.Resolve<IEntityManager>().AddComponent<GridAtmosphereComponent>(grid);
shell.WriteLine($"Added atmosphere to grid {id}.");
}

View File

@@ -53,7 +53,7 @@ namespace Content.Server.Atmos.Commands
return;
}
grid.AddComponent<UnsimulatedGridAtmosphereComponent>();
IoCManager.Resolve<IEntityManager>().AddComponent<UnsimulatedGridAtmosphereComponent>(grid);
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
}

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Chemistry.Components
return;
Amount = amount;
var inception = Owner.AddComponent<SolutionAreaEffectInceptionComponent>();
var inception = IoCManager.Resolve<IEntityManager>().AddComponent<SolutionAreaEffectInceptionComponent>(Owner);
inception.Add(this);
inception.Setup(amount, duration, spreadDelay, removeDelay);

View File

@@ -141,7 +141,7 @@ namespace Content.Server.Cloning.Components
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(mob.Uid, dna.Profile);
mob.Name = dna.Profile.Name;
var cloneMindReturn = mob.AddComponent<BeingClonedComponent>();
var cloneMindReturn = IoCManager.Resolve<IEntityManager>().AddComponent<BeingClonedComponent>(mob);
cloneMindReturn.Mind = mind;
cloneMindReturn.Parent = Owner.Uid;

View File

@@ -123,7 +123,7 @@ namespace Content.Server.GameTicking
if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}"))
{
mob.AddComponent<OwOAccentComponent>();
IoCManager.Resolve<IEntityManager>().AddComponent<OwOAccentComponent>(mob);
}
AddManifestEntry(character.Name, jobId);

View File

@@ -117,7 +117,7 @@ namespace Content.Server.GameTicking.Presets
var pda = newPDA.GetComponent<PDAComponent>();
_entityManager.EntitySysManager.GetEntitySystem<PDASystem>()
.SetOwner(pda, mind.OwnedEntity.Name);
newPDA.AddComponent<TraitorDeathMatchReliableOwnerTagComponent>().UserId = mind.UserId;
IoCManager.Resolve<IEntityManager>().AddComponent<TraitorDeathMatchReliableOwnerTagComponent>(newPDA).UserId = mind.UserId;
}
// Finally, it would be preferrable if they spawned as far away from other players as reasonably possible.

View File

@@ -357,7 +357,7 @@ namespace Content.Server.Mind
Session?.AttachToEntity(entity);
VisitingEntity = entity;
var comp = entity.AddComponent<VisitingMindComponent>();
var comp = IoCManager.Resolve<IEntityManager>().AddComponent<VisitingMindComponent>(entity);
comp.Mind = this;
Logger.Info($"Session {Session?.Name} visiting entity {entity}.");

View File

@@ -1,6 +1,7 @@
using Content.Shared.Pointing.Components;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
@@ -76,7 +77,7 @@ namespace Content.Server.Pointing.Components
if (_rogue)
{
Owner.RemoveComponent<PointingArrowComponent>();
Owner.AddComponent<RoguePointingArrowComponent>();
IoCManager.Resolve<IEntityManager>().AddComponent<RoguePointingArrowComponent>(Owner);
return;
}