Refactor stacks to not use method events (#4177)
This commit is contained in:
committed by
GitHub
parent
ca4e665296
commit
0093a961bc
@@ -6,6 +6,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
@@ -41,13 +42,9 @@ namespace Content.Server.Medical.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Owner.HasComponent<StackComponent>())
|
||||
if (Owner.TryGetComponent<SharedStackComponent>(out var stack) && !EntitySystem.Get<StackSystem>().Use(Owner.Uid, stack, 1))
|
||||
{
|
||||
var stackUse = new StackUseEvent() {Amount = 1};
|
||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, stackUse);
|
||||
|
||||
if(!stackUse.Result)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var (type, amount) in Heal)
|
||||
|
||||
Reference in New Issue
Block a user