Fix name serialization for secret stashes (#3301)
* Fix name serialization for secret stashes * Fix old usages of secret part name
This commit is contained in:
@@ -20,10 +20,12 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
public override string Name => "SecretStash";
|
||||
|
||||
[ViewVariables] private int _maxItemSize;
|
||||
[ViewVariables] private string _secretPartName = "";
|
||||
[ViewVariables] private string? _secretPartName;
|
||||
|
||||
[ViewVariables] private ContainerSlot _itemContainer = default!;
|
||||
|
||||
public string SecretPartName => _secretPartName ?? Loc.GetString("{0:theName}", Owner);
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -32,8 +34,9 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _maxItemSize, "maxItemSize", (int) ReferenceSizes.Pocket);
|
||||
serializer.DataField(ref _secretPartName, "secretPartName", Loc.GetString("{0:theName}"));
|
||||
serializer.DataField(ref _secretPartName, "secretPartName", null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -56,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
if (item.Size > _maxItemSize)
|
||||
{
|
||||
Owner.PopupMessage(user,
|
||||
Loc.GetString("{0:TheName} is too big to fit in {1}!", itemToHide, _secretPartName));
|
||||
Loc.GetString("{0:TheName} is too big to fit in {1}!", itemToHide, SecretPartName));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -66,7 +69,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
if (!hands.Drop(itemToHide, _itemContainer))
|
||||
return false;
|
||||
|
||||
Owner.PopupMessage(user, Loc.GetString("You hide {0:theName} in {1}.", itemToHide, _secretPartName));
|
||||
Owner.PopupMessage(user, Loc.GetString("You hide {0:theName} in {1}.", itemToHide, SecretPartName));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
if (_itemContainer.ContainedEntity == null)
|
||||
return false;
|
||||
|
||||
Owner.PopupMessage(user, Loc.GetString("There was something inside {0}!", _secretPartName));
|
||||
Owner.PopupMessage(user, Loc.GetString("There was something inside {0}!", SecretPartName));
|
||||
|
||||
if (user.TryGetComponent(out HandsComponent? hands))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user