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
BIN
JotunnModStub/Assets/Hammers/ShrinkHammer_icon.png
Normal file
BIN
JotunnModStub/Assets/Hammers/ShrinkHammer_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
JotunnModStub/Assets/Hammers/TrolsHammer_icon.png
Normal file
BIN
JotunnModStub/Assets/Hammers/TrolsHammer_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
|
|
@ -47,6 +47,7 @@ namespace RacesOfValheim
|
|||
// Not a race either: a tool any race can craft, so it sits beside the vulture rather
|
||||
// than inside the alphabetical run above.
|
||||
TrolsHammerConfig.Bind(Config);
|
||||
ShrinkHammerConfig.Bind(Config);
|
||||
// Not a race either: the two Bone Servants, shared by the Skeleton and Skadi, so they
|
||||
// bind here rather than inside either race's run.
|
||||
ButlerConfig.Bind(Config);
|
||||
|
|
@ -306,6 +307,7 @@ namespace RacesOfValheim
|
|||
AlfarRace.CreateModAssets();
|
||||
WarVultureItem.Register();
|
||||
TrolsHammerItem.Register();
|
||||
ShrinkHammerItem.Register();
|
||||
BoneServant.Register();
|
||||
}
|
||||
// --- RACE SELECTION UI ---
|
||||
|
|
|
|||
211
JotunnModStub/ShrinkHammer/BuildScale.cs
Normal file
211
JotunnModStub/ShrinkHammer/BuildScale.cs
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// What both sizing hammers share: which size the hammer in hand builds at, Alt + scroll to
|
||||
/// change it, the size floating over the ghost, and the "Alt: Size" row in the bottom bar.
|
||||
///
|
||||
/// Trol's Hammer builds 1 to 3 times the vanilla size, the Shrink Hammer a quarter to 1. Each
|
||||
/// keeps its size in its own config entry, and the wheel writes that entry, so Configuration
|
||||
/// Manager and the wheel never disagree. The entries are not synced: each player picks their own.
|
||||
/// Alt is free in build mode: vanilla's own placing modifier ("AltPlace") is Left Shift.
|
||||
/// </summary>
|
||||
public static class BuildScale
|
||||
{
|
||||
public const float Step = 0.05f;
|
||||
|
||||
/// <summary>The config entry behind the hammer in hand, or null for any other tool.</summary>
|
||||
public static ConfigEntry<float> EntryFor(ItemDrop.ItemData item)
|
||||
{
|
||||
if (TrolsHammerItem.IsTrolsHammer(item)) return TrolsHammerConfig.ScaleFactor;
|
||||
if (ShrinkHammerItem.IsShrinkHammer(item)) return ShrinkHammerConfig.ScaleFactor;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>The multiplier a placement with this item in hand gets: 1 for any other tool.</summary>
|
||||
public static float For(ItemDrop.ItemData item)
|
||||
{
|
||||
if (TrolsHammerItem.IsTrolsHammer(item)) return TrolsHammerConfig.ActiveFactor();
|
||||
if (ShrinkHammerItem.IsShrinkHammer(item)) return ShrinkHammerConfig.ActiveFactor();
|
||||
return 1f;
|
||||
}
|
||||
|
||||
public static bool AltHeld() => Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
|
||||
|
||||
/// <summary>Moves the entry by whole steps, kept on the 0.05 grid and inside its range.</summary>
|
||||
public static void Nudge(ConfigEntry<float> entry, int steps)
|
||||
{
|
||||
AcceptableValueRange<float> range = entry.Description.AcceptableValues as AcceptableValueRange<float>;
|
||||
float min = range != null ? range.MinValue : 0.25f, max = range != null ? range.MaxValue : 3f;
|
||||
float value = Mathf.Round((entry.Value + steps * Step) / Step) * Step;
|
||||
entry.Value = Mathf.Clamp(value, min, max);
|
||||
}
|
||||
|
||||
// --- the size over the ghost ---
|
||||
|
||||
private static GameObject s_labelled;
|
||||
private static float s_shown;
|
||||
|
||||
/// <summary>
|
||||
/// The size in Valheim's own floating NPC text, with one of the two hammers in hand:
|
||||
/// - over the ghost, while the hammer's size differs from its default (1.2 for Trol's
|
||||
/// Hammer, 1 for the Shrink Hammer);
|
||||
/// - with the repair tool selected, over the piece aimed at, always: the size it was built
|
||||
/// at, 1 for a piece no sizing hammer built.
|
||||
/// The text has no timeout, so it is set again only when its piece or the size changes:
|
||||
/// setting it replays its fade-in.
|
||||
/// </summary>
|
||||
public static void UpdateLabel(Player player, GameObject ghost)
|
||||
{
|
||||
if (Chat.instance == null) return;
|
||||
|
||||
ConfigEntry<float> entry = player != null && player.InPlaceMode() ? EntryFor(player.RightItem) : null;
|
||||
if (entry == null)
|
||||
{
|
||||
ClearLabel();
|
||||
return;
|
||||
}
|
||||
|
||||
Piece tool = player.GetSelectedPiece();
|
||||
if (tool != null && tool.m_repairPiece)
|
||||
{
|
||||
Piece aimed = player.GetHoveringPiece();
|
||||
if (aimed != null) Show(aimed.gameObject, BuiltSize(aimed));
|
||||
else ClearLabel();
|
||||
return;
|
||||
}
|
||||
|
||||
float value = For(player.RightItem);
|
||||
if (ghost != null && ghost.activeInHierarchy && !Mathf.Approximately(value, (float)entry.DefaultValue))
|
||||
Show(ghost, value);
|
||||
else
|
||||
ClearLabel();
|
||||
}
|
||||
|
||||
/// <summary>The size a placed piece was built at, from its ZDO; 1 when no sizing hammer built it.</summary>
|
||||
private static float BuiltSize(Piece piece)
|
||||
{
|
||||
ZDO zdo = piece.GetComponent<ZNetView>()?.GetZDO();
|
||||
float saved = zdo != null ? zdo.GetFloat(TrolsHammerScaling.ScaleKey, 0f) : 0f;
|
||||
return saved > 0f ? saved : 1f;
|
||||
}
|
||||
|
||||
private static void Show(GameObject target, float value)
|
||||
{
|
||||
if (target == s_labelled && Mathf.Approximately(value, s_shown)) return;
|
||||
|
||||
ClearLabel();
|
||||
Chat.instance.SetNpcText(target, Vector3.up * (TopOf(target) + 0.3f), 30f, 0f, "",
|
||||
ModText.Get("rov_msg_build_scale", value.ToString("0.00")), false);
|
||||
s_labelled = target;
|
||||
s_shown = value;
|
||||
}
|
||||
|
||||
private static void ClearLabel()
|
||||
{
|
||||
if (s_labelled != null && Chat.instance != null) Chat.instance.ClearNpcText(s_labelled);
|
||||
s_labelled = null;
|
||||
}
|
||||
|
||||
/// <summary>How far above its pivot the ghost reaches, from its renderers.</summary>
|
||||
private static float TopOf(GameObject ghost)
|
||||
{
|
||||
float top = 0.5f;
|
||||
foreach (Renderer renderer in ghost.GetComponentsInChildren<Renderer>())
|
||||
top = Mathf.Max(top, renderer.bounds.max.y - ghost.transform.position.y);
|
||||
return top;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alt + scroll in build mode. Vanilla turns the piece with the same wheel in the same method,
|
||||
/// whatever key is held, so the prefix reads the wheel for the size and the postfix puts the
|
||||
/// rotation back as it was.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(Player), "UpdatePlacement")]
|
||||
public static class BuildScaleScrollPatch
|
||||
{
|
||||
private static float s_scroll;
|
||||
|
||||
private static void Prefix(Player __instance, bool takeInput, int ___m_placeRotation, out int __state)
|
||||
{
|
||||
__state = ___m_placeRotation;
|
||||
if (!takeInput || __instance != Player.m_localPlayer || !__instance.InPlaceMode()) return;
|
||||
if (!BuildScale.AltHeld()) return;
|
||||
ConfigEntry<float> entry = BuildScale.EntryFor(__instance.RightItem);
|
||||
if (entry == null) return;
|
||||
|
||||
s_scroll += ZInput.GetMouseScrollWheel();
|
||||
if (s_scroll > __instance.m_scrollAmountThreshold) { s_scroll = 0f; BuildScale.Nudge(entry, 1); }
|
||||
if (s_scroll < -__instance.m_scrollAmountThreshold) { s_scroll = 0f; BuildScale.Nudge(entry, -1); }
|
||||
}
|
||||
|
||||
private static void Postfix(Player __instance, int __state, ref int ___m_placeRotation,
|
||||
ref float ___m_scrollCurrAmount, GameObject ___m_placementGhost)
|
||||
{
|
||||
if (__instance != Player.m_localPlayer) return;
|
||||
|
||||
if (BuildScale.AltHeld() && BuildScale.EntryFor(__instance.RightItem) != null)
|
||||
{
|
||||
___m_placeRotation = __state;
|
||||
___m_scrollCurrAmount = 0f;
|
||||
}
|
||||
BuildScale.UpdateLabel(__instance, ___m_placementGhost);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The "Alt: Size" row in the build hints, next to vanilla's "Rotate": a copy of that row (the
|
||||
/// wheel icon and its text), shown only while one of the two hammers is in hand. Added beside the
|
||||
/// vanilla rows rather than through Jotunn's key hints, which replace the whole bar for an item.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(KeyHints), "UpdateHints")]
|
||||
public static class BuildScaleKeyHintPatch
|
||||
{
|
||||
private static GameObject s_row;
|
||||
private static bool s_failed;
|
||||
|
||||
private static void Postfix(KeyHints __instance)
|
||||
{
|
||||
if (s_row == null && !s_failed) s_row = MakeRow(__instance);
|
||||
if (s_row == null) return;
|
||||
|
||||
Player player = Player.m_localPlayer;
|
||||
bool show = player != null && BuildScale.EntryFor(player.RightItem) != null;
|
||||
if (s_row.activeSelf != show) s_row.SetActive(show);
|
||||
}
|
||||
|
||||
private static GameObject MakeRow(KeyHints hints)
|
||||
{
|
||||
Transform rotate = hints.m_buildHints != null ? FindDeep(hints.m_buildHints.transform, "rotate") : null;
|
||||
TMP_Text source = rotate != null ? rotate.Find("Text")?.GetComponent<TMP_Text>() : null;
|
||||
if (source == null)
|
||||
{
|
||||
s_failed = true;
|
||||
Jotunn.Logger.LogWarning("[BuildScale] No rotate row in the build hints; the Alt: Size hint is not shown.");
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject row = Object.Instantiate(rotate.gameObject, rotate.parent, false);
|
||||
row.name = "RoV_scale";
|
||||
row.transform.SetSiblingIndex(rotate.GetSiblingIndex() + 1);
|
||||
row.transform.Find("Text").GetComponent<TMP_Text>().text = ModText.Get("rov_hint_build_scale");
|
||||
return row;
|
||||
}
|
||||
|
||||
private static Transform FindDeep(Transform parent, string name)
|
||||
{
|
||||
foreach (Transform child in parent)
|
||||
{
|
||||
if (child.name == name) return child;
|
||||
Transform found = FindDeep(child, name);
|
||||
if (found != null) return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
JotunnModStub/ShrinkHammer/ShrinkHammerConfig.cs
Normal file
33
JotunnModStub/ShrinkHammer/ShrinkHammerConfig.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
JotunnModStub/ShrinkHammer/ShrinkHammerItem.cs
Normal file
77
JotunnModStub/ShrinkHammer/ShrinkHammerItem.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using Jotunn.Configs;
|
||||
using Jotunn.Entities;
|
||||
using Jotunn.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// The Shrink Hammer: the builder's hammer for small work, down to a quarter of the vanilla size.
|
||||
/// Any race can craft it. Built the same way as <see cref="TrolsHammerItem"/>: a clone of the
|
||||
/// vanilla Hammer that keeps the vanilla piece table, so every piece, including those other mods
|
||||
/// add, is in its menu at the same cost. The size lives on the placement (TrolsHammerPatches,
|
||||
/// BuildScale), never on the piece prefabs.
|
||||
/// </summary>
|
||||
public static class ShrinkHammerItem
|
||||
{
|
||||
public const string PrefabName = "ShrinkHammer";
|
||||
public const string DisplayName = "$rov_item_shrinkhammer_name";
|
||||
|
||||
private const string SourcePrefab = "Hammer";
|
||||
private const string Label = "ShrinkHammer";
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(PrefabName, SourcePrefab);
|
||||
ItemDrop drop = prefab != null ? prefab.GetComponent<ItemDrop>() : null;
|
||||
if (drop == null || drop.m_itemData == null || drop.m_itemData.m_shared == null)
|
||||
{
|
||||
Jotunn.Logger.LogWarning($"[{Label}] Could not clone {SourcePrefab}; {DisplayName} not registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
ItemDrop.ItemData.SharedData shared = drop.m_itemData.m_shared;
|
||||
shared.m_name = DisplayName;
|
||||
shared.m_description = "$rov_item_shrinkhammer_desc";
|
||||
Sprite icon = HammerIcon.Load("ShrinkHammer_icon.png");
|
||||
if (icon != null) shared.m_icons = new[] { icon };
|
||||
|
||||
ItemManager.Instance.AddItem(new CustomItem(prefab, fixReference: false));
|
||||
ItemManager.Instance.AddRecipe(new CustomRecipe(new RecipeConfig
|
||||
{
|
||||
Item = PrefabName,
|
||||
Amount = 1,
|
||||
CraftingStation = CraftingStations.Workbench,
|
||||
MinStationLevel = 1,
|
||||
Requirements = new[]
|
||||
{
|
||||
new RequirementConfig("FineWood", 2, 0, true),
|
||||
new RequirementConfig("Resin", 2, 0, true),
|
||||
},
|
||||
}));
|
||||
|
||||
Jotunn.Logger.LogInfo($"[{Label}] {DisplayName} registered on the vanilla hammer's piece table.");
|
||||
}
|
||||
|
||||
/// <summary>Whether an item in hand is this hammer; the display name is the fallback for an
|
||||
/// ItemData built before ObjectDB finished, as in TrolsHammerItem.</summary>
|
||||
public static bool IsShrinkHammer(ItemDrop.ItemData item)
|
||||
{
|
||||
if (item == null) return false;
|
||||
if (item.m_dropPrefab != null) return item.m_dropPrefab.name == PrefabName;
|
||||
return item.m_shared != null && item.m_shared.m_name == DisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The two hammers' own icons, painted offline (scripts/paint_hammer_icons.py) and
|
||||
/// embedded in the DLL.</summary>
|
||||
internal static class HammerIcon
|
||||
{
|
||||
public static Sprite Load(string resource)
|
||||
{
|
||||
Texture2D texture = PieceLook.LoadTexture(resource);
|
||||
if (texture == null) return null;
|
||||
return Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,8 +81,10 @@
|
|||
"rov_item_trenta_rotseed_name": "Rot Seed",
|
||||
"rov_item_trol_giantslog_desc": "A massive tree log wielded as a weapon.",
|
||||
"rov_item_trol_giantslog_name": "Giant's Log",
|
||||
"rov_item_trolshammer_desc": "A hammer swung by something that never had to duck through a doorway. It builds everything the ordinary one builds, out of the same materials, and simply builds it bigger.",
|
||||
"rov_item_trolshammer_desc": "A hammer swung by something that never had to duck through a doorway. It builds everything the ordinary one builds, out of the same materials, and simply builds it bigger. Hold Alt and scroll to choose how much bigger.",
|
||||
"rov_item_trolshammer_name": "Trol's Hammer",
|
||||
"rov_item_shrinkhammer_name": "Shrink Hammer",
|
||||
"rov_item_shrinkhammer_desc": "A fine hammer for small work. It builds everything the ordinary one builds, out of the same materials, down to a quarter of the size. Hold Alt and scroll to choose the size.",
|
||||
"rov_item_warvulture_desc": "A vulture's head, kept. Raise it and the bird comes back under you, and it will carry you as long as you care to stay up - though it only has so much haste in it before it settles into a glide.",
|
||||
"rov_item_warvulture_name": "War Vulture",
|
||||
"rov_piece_aswid_bloodrefinery_desc": "Flesh goes in, bone goes in, and what is left of both comes out red.",
|
||||
|
|
|
|||
|
|
@ -238,5 +238,7 @@
|
|||
"rov_msg_build_limit_alfar_chest": "This core already has one of these within reach.",
|
||||
"rov_msg_build_limit_alfar_ljosgard": "This core already has its Ljosgard."
|
||||
,
|
||||
"rov_msg_alfar_nexus_no_store": "The nucleus has nothing to offer right now."
|
||||
"rov_msg_alfar_nexus_no_store": "The nucleus has nothing to offer right now.",
|
||||
"rov_msg_build_scale": "Size $1",
|
||||
"rov_hint_build_scale": "Alt: Size"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,10 @@
|
|||
"rov_item_trenta_rotseed_name": "Seme marcio",
|
||||
"rov_item_trol_giantslog_desc": "Un enorme tronco d'albero brandito come arma.",
|
||||
"rov_item_trol_giantslog_name": "Tronco del gigante",
|
||||
"rov_item_trolshammer_desc": "Un martello brandito da qualcosa che non ha mai dovuto chinarsi sotto una porta. Costruisce tutto ciò che costruisce quello normale, con gli stessi materiali, e lo fa semplicemente più grande.",
|
||||
"rov_item_trolshammer_desc": "Un martello brandito da qualcosa che non ha mai dovuto chinarsi sotto una porta. Costruisce tutto ciò che costruisce quello normale, con gli stessi materiali, e lo fa semplicemente più grande. Tieni premuto Alt e usa la rotellina per scegliere quanto.",
|
||||
"rov_item_trolshammer_name": "Martello del Trol",
|
||||
"rov_item_shrinkhammer_name": "Martello Riduttore",
|
||||
"rov_item_shrinkhammer_desc": "Un martello fine per i lavori piccoli. Costruisce tutto ciò che costruisce quello normale, con gli stessi materiali, fino a un quarto della grandezza. Tieni premuto Alt e usa la rotellina per sceglierla.",
|
||||
"rov_item_warvulture_desc": "La testa di un avvoltoio, conservata. Sollevala e l'uccello torna sotto di te, e ti porterà finché vorrai restare in aria, anche se ha solo un po' di slancio prima di mettersi a planare.",
|
||||
"rov_item_warvulture_name": "Avvoltoio da guerra",
|
||||
"rov_piece_aswid_bloodrefinery_desc": "Entra carne, entra osso, e quel che resta di entrambi esce rosso.",
|
||||
|
|
|
|||
|
|
@ -238,5 +238,7 @@
|
|||
"rov_msg_build_limit_alfar_chest": "Questo nucleo ne ha gia' una nel suo raggio.",
|
||||
"rov_msg_build_limit_alfar_ljosgard": "Questo nucleo ha gia' il suo Ljosgard."
|
||||
,
|
||||
"rov_msg_alfar_nexus_no_store": "Il nucleo non ha niente da offrire adesso."
|
||||
"rov_msg_alfar_nexus_no_store": "Il nucleo non ha niente da offrire adesso.",
|
||||
"rov_msg_build_scale": "Grandezza $1",
|
||||
"rov_hint_build_scale": "Alt: Grandezza"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,10 @@
|
|||
"rov_item_trenta_rotseed_name": "Семя гнили",
|
||||
"rov_item_trol_giantslog_desc": "Исполинский ствол векового дерева, используемый как сокрушительное оружие.",
|
||||
"rov_item_trol_giantslog_name": "Бревно великана",
|
||||
"rov_item_trolshammer_desc": "Молот, которым размахивает тот, кому никогда не приходилось пригибаться в дверях. Возводит те же постройки, что и обычный молот, из тех же материалов, но с истинным тролльим размахом.",
|
||||
"rov_item_trolshammer_desc": "Молот, которым размахивает тот, кому никогда не приходилось пригибаться в дверях. Возводит те же постройки, что и обычный молот, из тех же материалов, но с истинным тролльим размахом. Зажмите Alt и крутите колесо мыши, чтобы выбрать, насколько.",
|
||||
"rov_item_trolshammer_name": "Молот тролля",
|
||||
"rov_item_shrinkhammer_name": "Молот-уменьшитель",
|
||||
"rov_item_shrinkhammer_desc": "Тонкий молот для мелкой работы. Возводит те же постройки, что и обычный молот, из тех же материалов, вплоть до четверти размера. Зажмите Alt и крутите колесо мыши, чтобы выбрать размер.",
|
||||
"rov_item_warvulture_desc": "Высушенная голова стервятника. Поднимите ее — и птица опустится вам под ноги, неся вас вперед, пока вам не надоест (хотя силы для рывка у нее быстро сменяются плавным парением).",
|
||||
"rov_item_warvulture_name": "Боевой стервятник",
|
||||
"rov_piece_aswid_bloodrefinery_desc": "Загрузите плоть, бросьте кости — и то, что от них останется, выйдет алым соком.",
|
||||
|
|
|
|||
|
|
@ -238,5 +238,7 @@
|
|||
"rov_msg_build_limit_alfar_chest": "У этого ядра уже есть такой сундук в радиусе.",
|
||||
"rov_msg_build_limit_alfar_ljosgard": "У этого ядра уже есть свой Льосгард."
|
||||
,
|
||||
"rov_msg_alfar_nexus_no_store": "У ядра сейчас нечего предложить."
|
||||
"rov_msg_alfar_nexus_no_store": "У ядра сейчас нечего предложить.",
|
||||
"rov_msg_build_scale": "Размер $1",
|
||||
"rov_hint_build_scale": "Alt: размер"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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