Refactor stacks to not use method events (#4177)
This commit is contained in:
committed by
GitHub
parent
ca4e665296
commit
0093a961bc
@@ -44,8 +44,8 @@ namespace Content.Server.Wires.Components
|
||||
var droppedEnt = Owner.EntityManager.SpawnEntity(_wireDroppedOnCutPrototype, eventArgs.ClickLocation);
|
||||
|
||||
// TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated...
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -47,14 +47,9 @@ namespace Content.Server.Wires.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (Owner.HasComponent<StackComponent>())
|
||||
{
|
||||
var stackUse = new StackUseEvent(){Amount = 1};
|
||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, stackUse);
|
||||
|
||||
if(!stackUse.Result)
|
||||
return true;
|
||||
}
|
||||
if (Owner.TryGetComponent<StackComponent>(out var stack)
|
||||
&& !EntitySystem.Get<StackSystem>().Use(Owner.Uid, stack, 1))
|
||||
return true;
|
||||
|
||||
Owner.EntityManager.SpawnEntity(_wirePrototypeID, grid.GridTileToLocal(snapPos));
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user