more component ref removal + combining server/client comps (#13178)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
using Content.Shared.Stacks;
|
||||
|
||||
namespace Content.Server.Stack
|
||||
{
|
||||
// TODO: Naming and presentation and such could use some improvement.
|
||||
[RegisterComponent, Access(typeof(StackSystem))]
|
||||
[ComponentReference(typeof(SharedStackComponent))]
|
||||
public sealed class StackComponent : SharedStackComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ThrowIndividually { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Stack
|
||||
SubscribeLocalEvent<StackComponent, GetVerbsEvent<AlternativeVerb>>(OnStackAlternativeInteract);
|
||||
}
|
||||
|
||||
public override void SetCount(EntityUid uid, int amount, SharedStackComponent? component = null)
|
||||
public override void SetCount(EntityUid uid, int amount, StackComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return;
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.Stack
|
||||
/// <summary>
|
||||
/// Try to split this stack into two. Returns a non-null <see cref="Robust.Shared.GameObjects.EntityUid"/> if successful.
|
||||
/// </summary>
|
||||
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, SharedStackComponent? stack = null)
|
||||
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, StackComponent? stack = null)
|
||||
{
|
||||
if (!Resolve(uid, ref stack))
|
||||
return null;
|
||||
@@ -61,7 +61,7 @@ namespace Content.Server.Stack
|
||||
// Set the output parameter in the event instance to the newly split stack.
|
||||
var entity = Spawn(prototype, spawnPosition);
|
||||
|
||||
if (TryComp(entity, out SharedStackComponent? stackComp))
|
||||
if (TryComp(entity, out StackComponent? stackComp))
|
||||
{
|
||||
// Set the split stack's count.
|
||||
SetCount(entity, amount, stackComp);
|
||||
|
||||
Reference in New Issue
Block a user