Stickers: Fixed error saving melon prefs

This commit is contained in:
NotAKidoS 2024-09-05 10:06:25 -05:00
parent 9c45d8179d
commit f711f6fb9c
3 changed files with 9 additions and 4 deletions

View file

@ -51,7 +51,7 @@ public static class ModSettings
Category.CreateEntry("tab_double_click", TabDoubleClick.ToggleStickerMode, "Tab Double Click", "The action to perform when double clicking the Stickers tab.");
internal static readonly MelonPreferences_Entry<string[]> Hidden_SelectedStickerNames =
Category.CreateEntry("selected_sticker_name", Array.Empty<string>(),
Category.CreateEntry("selected_sticker_name", new[] { "", "", "", "" },
display_name: "Selected Sticker Name",
description: "The name of the sticker selected for stickering.",
is_hidden: true);
@ -78,6 +78,11 @@ public static class ModSettings
// ensure sticker slots are initialized to the correct size
string[] selectedStickerNames = Hidden_SelectedStickerNames.Value;
if (selectedStickerNames.Length != MaxStickerSlots) Array.Resize(ref selectedStickerNames, MaxStickerSlots);
// ensure theres no null entries so toml shuts the fuck up
for (int i = 0; i < selectedStickerNames.Length; i++)
selectedStickerNames[i] ??= "";
Hidden_SelectedStickerNames.Value = selectedStickerNames;
foreach (var selectedSticker in selectedStickerNames)

View file

@ -27,6 +27,6 @@ using System.Reflection;
namespace NAK.Stickers.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.5";
public const string Version = "1.0.6";
public const string Author = "NotAKidoS";
}

View file

@ -1,7 +1,7 @@
{
"_id": 232,
"name": "Stickers",
"modversion": "1.0.5",
"modversion": "1.0.6",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
@ -18,6 +18,6 @@
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r40/Stickers.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/Stickers/",
"changelog": "- Added Friends Only setting.\n- Added button to clear sticker thumbnail cache.\n- Added Identify button to Player Selection page.\n- Added `[NoSticker]` GameObject name check. \n- Adjusted inbound network buffers to be cleared on initial connection to an instance.\n- Adjusted selecting a new image for a sticker slot to clear stickers in-scene for that slot.\n- Stripped all unused classes a bunch of other methods from decalery.\n - Completely removed Skinned Mesh Renderer support as it required running on CPU.\n - Most uploaded content is not marked as readable anyways (plus it crashed consistantly).\n- Fixed nullref spam when clearing stickers when sticker was already marked as dead.",
"changelog": "- Added Friends Only setting.\n- Added button to clear sticker thumbnail cache.\n- Added Identify button to Player Selection page.\n- Added `[NoSticker]` GameObject name check. \n- Adjusted inbound network buffers to be cleared on initial connection to an instance.\n- Adjusted selecting a new image for a sticker slot to clear stickers in-scene for that slot.\n- Stripped all unused classes a bunch of other methods from decalery.\n - Completely removed Skinned Mesh Renderer support as it required running on CPU.\n - Most uploaded content is not marked as readable anyways (plus it crashed consistantly).\n- Fixed nullref spam when clearing stickers when sticker was already marked as dead.\n- Fixed issue where saving melon preferences would error due to null sticker selection.",
"embedcolor": "#f61963"
}