From f83f16df16d198cb50199a95b98e0d9901f7105c Mon Sep 17 00:00:00 2001
From: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Date: Mon, 17 Oct 2022 14:17:59 +0200
Subject: [PATCH] Add "count" to stack comp's type handler. (#11917)
---
Content.Shared/Stacks/SharedStackComponent.cs | 3 +--
Content.Shared/Stacks/SharedStackSystem.cs | 4 ++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Content.Shared/Stacks/SharedStackComponent.cs b/Content.Shared/Stacks/SharedStackComponent.cs
index 9a58ca1140..44b12572cf 100644
--- a/Content.Shared/Stacks/SharedStackComponent.cs
+++ b/Content.Shared/Stacks/SharedStackComponent.cs
@@ -15,7 +15,6 @@ namespace Content.Shared.Stacks
/// Current stack count.
/// Do NOT set this directly, use the method instead.
///
- [ViewVariables(VVAccess.ReadWrite)]
[DataField("count")]
public int Count { get; set; } = 30;
@@ -24,7 +23,7 @@ namespace Content.Shared.Stacks
///
[ViewVariables(VVAccess.ReadOnly)]
[DataField("max")]
- public int MaxCount { get; set; } = 30;
+ public int MaxCount { get; set; } = 30;
///
/// Set to true to not reduce the count when used.
diff --git a/Content.Shared/Stacks/SharedStackSystem.cs b/Content.Shared/Stacks/SharedStackSystem.cs
index b9a6ae80e7..8a19365507 100644
--- a/Content.Shared/Stacks/SharedStackSystem.cs
+++ b/Content.Shared/Stacks/SharedStackSystem.cs
@@ -18,6 +18,7 @@ namespace Content.Shared.Stacks
[Dependency] protected readonly SharedHandsSystem HandsSystem = default!;
[Dependency] protected readonly SharedTransformSystem Xform = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
+ [Dependency] private readonly IViewVariablesManager _vvm = default!;
public override void Initialize()
{
@@ -28,6 +29,9 @@ namespace Content.Shared.Stacks
SubscribeLocalEvent(OnStackStarted);
SubscribeLocalEvent(OnStackExamined);
SubscribeLocalEvent(OnStackInteractUsing);
+
+ _vvm.GetTypeHandler()
+ .AddPath(nameof(SharedStackComponent.Count), (_, comp) => comp.Count, SetCount);
}
private void OnStackInteractUsing(EntityUid uid, SharedStackComponent stack, InteractUsingEvent args)