RacesOfValheim/JotunnModStub/ShrinkHammer/ShrinkHammerConfig.cs
kanym 0d1f655598 feat: Shrink Hammer, and Alt + scroll to size pieces with both hammers
A player asked to build below vanilla size for small details. The new
Shrink Hammer, craftable by any race, builds from 0.25 to 1; Trol's Hammer
keeps 1 to 3. With either hammer, Alt + scroll in build mode changes the
size in steps of 0.05, an Alt: Size row joins the build hints, and the size
floats over the ghost when it is not the default. With the repair tool, the
aimed piece shows the size it was built at. Both hammers get icons of their
own.
2026-10-30 22:49:27 +01:00

33 lines
1.5 KiB
C#

using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// The Shrink Hammer's one number: the size it builds at, from a quarter of the vanilla piece up
/// to the vanilla size. Bigger than vanilla is Trol's Hammer's job. Alt + scroll with the hammer
/// in hand writes this same entry (BuildScale), so the slider in Configuration Manager and the
/// wheel always agree, and the size survives a restart.
/// </summary>
public static class ShrinkHammerConfig
{
public static ConfigEntry<float> ScaleFactor;
public static void Bind(ConfigFile config)
{
ScaleFactor = config.Bind("Shrink Hammer", "Scale factor", 1f,
new ConfigDescription("The size of the pieces the Shrink Hammer builds, against the " +
"vanilla piece: 1 is vanilla size, 0.25 a quarter. Hold Alt and " +
"scroll in build mode to change it in steps of 0.05. Cost and " +
"drop never change. A ship keeps its physics at any size.",
new AcceptableValueRange<float>(0.25f, 1f)));
}
/// <summary>The multiplier a new placement should use; 1 for a value typed into the .cfg
/// file that would make a piece too small to see, hit or remove.</summary>
public static float ActiveFactor()
{
if (ScaleFactor == null) return 1f;
return ScaleFactor.Value > 0.01f ? ScaleFactor.Value : 1f;
}
}
}