Replace ComponentManager with EntityManager in StackSystem.

Stacks are the most advanced piece of code in this codebase...
This commit is contained in:
Vera Aguilera Puerto
2021-09-26 15:43:38 +02:00
parent e71e5bec39
commit 0869d837d6
2 changed files with 4 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ namespace Content.Server.Stack
// Set the output parameter in the event instance to the newly split stack. // Set the output parameter in the event instance to the newly split stack.
var entity = EntityManager.SpawnEntity(prototype, spawnPosition); var entity = EntityManager.SpawnEntity(prototype, spawnPosition);
if (ComponentManager.TryGetComponent(entity.Uid, out SharedStackComponent? stackComp)) if (EntityManager.TryGetComponent(entity.Uid, out SharedStackComponent? stackComp))
{ {
// Set the split stack's count. // Set the split stack's count.
SetCount(entity.Uid, amount, stackComp); SetCount(entity.Uid, amount, stackComp);
@@ -65,7 +65,7 @@ namespace Content.Server.Stack
{ {
// Set the output result parameter to the new stack entity... // Set the output result parameter to the new stack entity...
var entity = EntityManager.SpawnEntity(prototype.Spawn, spawnPosition); var entity = EntityManager.SpawnEntity(prototype.Spawn, spawnPosition);
var stack = ComponentManager.GetComponent<StackComponent>(entity.Uid); var stack = EntityManager.GetComponent<StackComponent>(entity.Uid);
// And finally, set the correct amount! // And finally, set the correct amount!
SetCount(entity.Uid, amount, stack); SetCount(entity.Uid, amount, stack);

View File

@@ -51,7 +51,7 @@ namespace Content.Shared.Stacks
EntityManager.QueueDeleteEntity(uid); EntityManager.QueueDeleteEntity(uid);
// Change appearance data. // Change appearance data.
if (ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance)) if (EntityManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance))
appearance.SetData(StackVisuals.Actual, component.Count); appearance.SetData(StackVisuals.Actual, component.Count);
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count), false); RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count), false);
@@ -79,7 +79,7 @@ namespace Content.Shared.Stacks
private void OnStackStarted(EntityUid uid, SharedStackComponent component, ComponentStartup args) private void OnStackStarted(EntityUid uid, SharedStackComponent component, ComponentStartup args)
{ {
if (!ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance)) if (!EntityManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance))
return; return;
appearance.SetData(StackVisuals.Actual, component.Count); appearance.SetData(StackVisuals.Actual, component.Count);