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.
This commit is contained in:
parent
16cacde532
commit
0d1f655598
17 changed files with 414 additions and 14 deletions
|
|
@ -28,9 +28,11 @@ namespace RacesOfValheim
|
|||
"Switching this off leaves every piece already built at the size " +
|
||||
"it was built at; only new placements are affected."));
|
||||
|
||||
// Smaller than vanilla is the Shrink Hammer's job, so this one starts at 1.
|
||||
ScaleFactor = config.Bind(section, "Scale factor", 1.2f,
|
||||
new ConfigDescription("How much bigger than the vanilla piece. 1.2 is the +20% the " +
|
||||
"hammer exists for. Cost and drop never change - this is size " +
|
||||
"hammer exists for. Hold Alt and scroll in build mode to change " +
|
||||
"it in steps of 0.05. Cost and drop never change - this is size " +
|
||||
"only.", new AcceptableValueRange<float>(1f, 3f)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ namespace RacesOfValheim
|
|||
ItemDrop.ItemData.SharedData shared = drop.m_itemData.m_shared;
|
||||
shared.m_name = DisplayName;
|
||||
shared.m_description = "$rov_item_trolshammer_desc";
|
||||
// A blue-steel head and a troll's trophy, so it cannot pass for the vanilla hammer.
|
||||
Sprite icon = HammerIcon.Load("TrolsHammer_icon.png");
|
||||
if (icon != null) shared.m_icons = new[] { icon };
|
||||
|
||||
if (shared.m_buildPieces == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,9 +110,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (ghost != m_tracked) Adopt(ghost);
|
||||
|
||||
float desired = TrolsHammerItem.IsTrolsHammer(player.RightItem)
|
||||
? TrolsHammerConfig.ActiveFactor()
|
||||
: 1f;
|
||||
float desired = BuildScale.For(player.RightItem);
|
||||
|
||||
if (Mathf.Approximately(desired, m_applied)) return;
|
||||
|
||||
|
|
@ -158,9 +156,8 @@ namespace RacesOfValheim
|
|||
private static void Prefix(Player __instance)
|
||||
{
|
||||
if (__instance == null || __instance != Player.m_localPlayer) return;
|
||||
if (!TrolsHammerItem.IsTrolsHammer(__instance.RightItem)) return;
|
||||
|
||||
float factor = TrolsHammerConfig.ActiveFactor();
|
||||
// Trol's Hammer or the Shrink Hammer; any other tool builds at 1 and leaves here.
|
||||
float factor = BuildScale.For(__instance.RightItem);
|
||||
if (Mathf.Approximately(factor, 1f)) return;
|
||||
|
||||
TrolsHammerScaling.Placing = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue