From b3edb2aed14059cbbbaf5baf33ec4d9b1431c030 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 28 Oct 2026 13:22:56 +0100 Subject: [PATCH] feat: marble Bone Servant tables, bigger centred props, fix table hover name The Smith's and Cook's Tables clone the black marble table: the cartography table's map is baked into its texture. Anvil or meal and a skull sit near the centre at the table's measured height. The bank loses its lantern and its tankard grows. The servant table hover localizes its title, which showed as a raw token once a servant stood there. --- JotunnModStub/Butler/BoneServant.cs | 51 +++++++++++-------- JotunnModStub/Butler/ServantTableBehaviour.cs | 3 +- JotunnModStub/Dvergar/DvergarBanco.cs | 14 ++--- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/JotunnModStub/Butler/BoneServant.cs b/JotunnModStub/Butler/BoneServant.cs index cd633b1..344b9d3 100644 --- a/JotunnModStub/Butler/BoneServant.cs +++ b/JotunnModStub/Butler/BoneServant.cs @@ -61,7 +61,7 @@ namespace RacesOfValheim /// making the situation impossible to build rather than by sharing state between them. public const float TableSpacing = 40f; - private const float TableScale = 0.8f; + private const string TableSource = "piece_blackmarble_table"; /// /// One skull, one wishbone, eight stone - the same price for both tables. @@ -197,19 +197,20 @@ namespace RacesOfValheim private static void RegisterTable(string pieceName, string displayName, string servantPrefab, ButlerFamily family, string description, string iconSource) { - GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(pieceName, "piece_cartographytable"); + // The black marble table: "a slab of bone and slate". It was the cartography table once, + // whose map is baked into its own texture and could not be taken off. + GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(pieceName, TableSource); if (prefab == null) { - Jotunn.Logger.LogWarning($"[Butler] Could not clone piece_cartographytable; " + + Jotunn.Logger.LogWarning($"[Butler] Could not clone {TableSource}; " + $"the {displayName} is not registered."); return; } - // The MapTable trap, and it is the reason this is a blanket sweep by capability rather than - // a named DestroyImmediate: MapTable is Interactable AND Hoverable, so it takes the E key - // before our own Switch ever sees it and opens the shared map instead. Same bug as the - // barrel's Container on the Fenrir trough and the Trader on the vanilla wolf; the Dvergar - // contract bank pays for this lesson already. + // A blanket sweep by capability rather than a named DestroyImmediate. The cartography table + // taught it: its MapTable is Interactable AND Hoverable, so it took the E key before our own + // Switch ever saw it. The marble table carries nothing of the kind today, and the sweep + // keeps a future patch from adding one behind our back. foreach (MonoBehaviour behaviour in prefab.GetComponentsInChildren(true)) { if (behaviour == null) continue; @@ -217,7 +218,6 @@ namespace RacesOfValheim Object.DestroyImmediate(behaviour); } - prefab.transform.localScale = Vector3.one * TableScale; Dress(prefab, family); ServantTableBehaviour table = prefab.AddComponent(); @@ -256,33 +256,40 @@ namespace RacesOfValheim })); } - // The look, in the table's own space BEFORE TableScale, like the Dvergar bank's coin pile. - // TableTop is that pile's height: the same vanilla mesh, so the same surface. - private static readonly Color BoneSlateTint = new Color(0.72f, 0.74f, 0.78f, 1f); - private const float TableTop = 1.05f; - private static readonly Vector3 SkullSpot = new Vector3(1.6f, TableTop, -0.5f); - private static readonly Vector3 TradeSpot = new Vector3(-1.55f, TableTop, 0.3f); + // The look. The marble table is 2.6 m by 1.5 m; both props sit either side of its centre, the + // trade's tool the bigger of the two. X and Z only: the height is the table's, measured. + private const float MarbleTableTop = 0.82f; + private static readonly Vector3 TradeSpot = new Vector3(-0.35f, 0f, 0f); + private static readonly Vector3 SkullSpot = new Vector3(0.6f, 0f, 0.1f); + private const float AnvilSize = 0.75f; + private const float MealSize = 0.6f; + private const float SkullSize = 0.45f; /// - /// "A slab of bone and slate": the cartography table greyed down, a skeleton's skull on one end - /// and the trade's own tool on the other - an anvil for the smith, a mortar for the cook. + /// "A slab of bone and slate": the black marble table, with the trade's own work in the middle - + /// an anvil for the smith, a meal for the cook - and a skeleton's skull beside it. /// private static void Dress(GameObject prefab, ButlerFamily family) { - PieceLook.Tint(prefab.transform, BoneSlateTint); + // The table's own height off its own mesh, with vanilla's 0.82 m as the fallback. The mesh + // stands on the piece's origin, so its height IS the height of the top. + Transform model = prefab.transform.Find("new"); + float top = model != null ? ModelBorrow.HeightOf(model.gameObject) : 0f; + if (top <= 0f) top = MarbleTableTop; + Vector3 up = Vector3.up * top; ModelBorrow.Attach(prefab.transform, "TableSkull", "TrophySkeleton", - SkullSpot, Quaternion.Euler(0f, -120f, 0f), 0.3f, "Butler", activeOnly: true); + SkullSpot + up, Quaternion.Euler(0f, -150f, 0f), SkullSize, "Butler", activeOnly: true); if (family == ButlerFamily.Forge) { ModelBorrow.Attach(prefab.transform, "TableAnvil", "forge_ext2", - TradeSpot, Quaternion.identity, 0.55f, "Butler", activeOnly: true); + TradeSpot + up, Quaternion.identity, AnvilSize, "Butler", activeOnly: true); } else { - ModelBorrow.Attach(prefab.transform, "TableMortar", "cauldron_ext5_mortarandpestle", - TradeSpot, Quaternion.identity, 0.6f, "Butler", activeOnly: true); + ModelBorrow.Attach(prefab.transform, "TableMeal", "MeatPlatter", + TradeSpot + up, Quaternion.identity, MealSize, "Butler", activeOnly: true); } } diff --git a/JotunnModStub/Butler/ServantTableBehaviour.cs b/JotunnModStub/Butler/ServantTableBehaviour.cs index e4964e6..44346b0 100644 --- a/JotunnModStub/Butler/ServantTableBehaviour.cs +++ b/JotunnModStub/Butler/ServantTableBehaviour.cs @@ -143,7 +143,8 @@ namespace RacesOfValheim string status = servant.Status; if (string.IsNullOrEmpty(status)) status = ModText.Get("rov_hover_butler_waiting"); - return m_title + "\n" + status; + // m_title is a $token, and a hover text goes to the HUD as it is: nothing localizes it later. + return Localization.instance.Localize(m_title) + "\n" + status; } /// diff --git a/JotunnModStub/Dvergar/DvergarBanco.cs b/JotunnModStub/Dvergar/DvergarBanco.cs index 36d945a..8f24220 100644 --- a/JotunnModStub/Dvergar/DvergarBanco.cs +++ b/JotunnModStub/Dvergar/DvergarBanco.cs @@ -77,12 +77,10 @@ namespace RacesOfValheim private const float PileSize = 0.45f; // The dressing, in the same unscaled table space as the pile. The pile owns the centre, so the - // lantern takes the far end of the map half and the tankard the near edge of the writing half. + // tankard stands just clear of it, on the near side. private static readonly Color BankWoodTint = new Color(0.62f, 0.55f, 0.5f, 1f); - private static readonly Vector3 LanternSpot = new Vector3(-1.75f, PileHeight, 0.55f); - private const float LanternSize = 0.55f; - private static readonly Vector3 TankardSpot = new Vector3(0.35f, PileHeight, -0.65f); - private const float TankardSize = 0.2f; + private static readonly Vector3 TankardSpot = new Vector3(0.45f, PileHeight, -0.25f); + private const float TankardSize = 0.38f; public class Troop { @@ -284,11 +282,9 @@ namespace RacesOfValheim prefab.transform.localScale = Vector3.one * TableScale; - // A counting table, not a map table: darker wood, a dvergr lantern at the far end and a - // tankard by the ledger. Tinted BEFORE the props go on, or they would be darkened too. + // A counting table, not a map table: darker wood and a dvergr tankard beside the coin. + // Tinted BEFORE the tankard goes on, or it would be darkened too. PieceLook.Tint(prefab.transform, BankWoodTint); - ModelBorrow.Attach(prefab.transform, "BankLantern", "piece_dvergr_lantern", - LanternSpot, Quaternion.identity, LanternSize, "Dvergar", activeOnly: true); ModelBorrow.Attach(prefab.transform, "BankTankard", "Tankard_dvergr", TankardSpot, Quaternion.identity, TankardSize, "Dvergar", activeOnly: true);