Refactor stacks to not use method events (#4177)

This commit is contained in:
Vera Aguilera Puerto
2021-06-12 11:24:34 +02:00
committed by GitHub
parent ca4e665296
commit 0093a961bc
17 changed files with 79 additions and 248 deletions

View File

@@ -52,15 +52,15 @@ namespace Content.Server.Construction.Components
var resultPosition = Owner.Transform.Coordinates;
Owner.Delete();
// spawn each result afrer refine
// spawn each result after refine
foreach (var result in _refineResult!)
{
var droppedEnt = Owner.EntityManager.SpawnEntity(result, resultPosition);
// TODO: If something has a stack... Just use a prototype with a single thing in the stack.
// This is not a good way to do it.
if (droppedEnt.HasComponent<StackComponent>())
Owner.EntityManager.EventBus.RaiseLocalEvent(droppedEnt.Uid, new StackChangeCountEvent(1), false);
if (droppedEnt.TryGetComponent<StackComponent>(out var stack))
EntitySystem.Get<StackSystem>().SetCount(droppedEnt.Uid, stack, 1);
}
return true;