0 of 0

File information

Last updated

Original upload

Created by

aiTookMyJob

Uploaded by

aiTookMyJob

Virus scan

Safe to use

About this mod

You can change the size of your pins on the large map and minimap.

Permissions and credits
Changelogs
Donations
You can change the size of your pins on the large map and minimap.

using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

namespace AdjustableMapPins
{
    [BepInPlugin("innocreator.adjustablemappins", "AdjustableMapPins", "1.0")]
    [BepInProcess("valheim.exe")]
    public class PinsProPlus : BaseUnityPlugin
    {
        public static ConfigEntry<bool> showDebugMessages;
        public static ConfigEntry<float> pinSizeSmall;
        public static ConfigEntry<float> pinSizeLarge;
        private readonly Harmony harmony = new Harmony("innocreator.adjustablemappins");

        void Awake()
        {
            showDebugMessages = Config.Bind<bool>("General", "showDebugMessages", false, "Display script debug messages.");
            pinSizeSmall = Config.Bind<float>("Options", "pinSizeSmall", 32f, "Icon size when the map is SMALL.");
            pinSizeLarge = Config.Bind<float>("Options", "pinSizeLarge", 48f, "Icon size when the map is LARGE.");

            CreateAMPCommands();
            harmony.PatchAll();
        }

        public void CreateAMPCommands()
        {
            new Terminal.ConsoleCommand("/amptest", "Print 'innoCreator  Adjustable Map Pins TEST' in the valheim console.", delegate (Terminal.ConsoleEventArgs args)
            {
                Console.instance.Print("innoCreator  Adjustable Map Pins TEST");
                return;
            });
        }

        [HarmonyPatch(typeof(Minimap), nameof(Minimap.SetMapMode))]
        public static class MapPause_SetMapMode
        {
            static void Prefix(Minimap.MapMode mode)
            {
                if (Minimap.instance.m_pinSizeSmall == pinSizeSmall.Value)
                    return;
                Minimap.instance.m_pinSizeSmall = pinSizeSmall.Value;
                Minimap.instance.m_pinSizeLarge = pinSizeLarge.Value;
                if (showDebugMessages.Value)
                    Debug.Log("innoCreator  Small: " + Minimap.instance.m_pinSizeSmall + ",  Large:" + Minimap.instance.m_pinSizeLarge);
            }
        }
    }
}