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.
This commit is contained in:
kanym 2026-10-28 13:22:56 +01:00
commit b3edb2aed1
3 changed files with 36 additions and 32 deletions

View file

@ -61,7 +61,7 @@ namespace RacesOfValheim
/// making the situation impossible to build rather than by sharing state between them.</summary> /// making the situation impossible to build rather than by sharing state between them.</summary>
public const float TableSpacing = 40f; public const float TableSpacing = 40f;
private const float TableScale = 0.8f; private const string TableSource = "piece_blackmarble_table";
/// <summary> /// <summary>
/// One skull, one wishbone, eight stone - the same price for both tables. /// 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, private static void RegisterTable(string pieceName, string displayName, string servantPrefab,
ButlerFamily family, string description, string iconSource) 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) 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."); $"the {displayName} is not registered.");
return; return;
} }
// The MapTable trap, and it is the reason this is a blanket sweep by capability rather than // A blanket sweep by capability rather than a named DestroyImmediate. The cartography table
// a named DestroyImmediate: MapTable is Interactable AND Hoverable, so it takes the E key // taught it: its MapTable is Interactable AND Hoverable, so it took the E key before our own
// before our own Switch ever sees it and opens the shared map instead. Same bug as the // Switch ever saw it. The marble table carries nothing of the kind today, and the sweep
// barrel's Container on the Fenrir trough and the Trader on the vanilla wolf; the Dvergar // keeps a future patch from adding one behind our back.
// contract bank pays for this lesson already.
foreach (MonoBehaviour behaviour in prefab.GetComponentsInChildren<MonoBehaviour>(true)) foreach (MonoBehaviour behaviour in prefab.GetComponentsInChildren<MonoBehaviour>(true))
{ {
if (behaviour == null) continue; if (behaviour == null) continue;
@ -217,7 +218,6 @@ namespace RacesOfValheim
Object.DestroyImmediate(behaviour); Object.DestroyImmediate(behaviour);
} }
prefab.transform.localScale = Vector3.one * TableScale;
Dress(prefab, family); Dress(prefab, family);
ServantTableBehaviour table = prefab.AddComponent<ServantTableBehaviour>(); ServantTableBehaviour table = prefab.AddComponent<ServantTableBehaviour>();
@ -256,33 +256,40 @@ namespace RacesOfValheim
})); }));
} }
// The look, in the table's own space BEFORE TableScale, like the Dvergar bank's coin pile. // The look. The marble table is 2.6 m by 1.5 m; both props sit either side of its centre, the
// TableTop is that pile's height: the same vanilla mesh, so the same surface. // trade's tool the bigger of the two. X and Z only: the height is the table's, measured.
private static readonly Color BoneSlateTint = new Color(0.72f, 0.74f, 0.78f, 1f); private const float MarbleTableTop = 0.82f;
private const float TableTop = 1.05f; private static readonly Vector3 TradeSpot = new Vector3(-0.35f, 0f, 0f);
private static readonly Vector3 SkullSpot = new Vector3(1.6f, TableTop, -0.5f); private static readonly Vector3 SkullSpot = new Vector3(0.6f, 0f, 0.1f);
private static readonly Vector3 TradeSpot = new Vector3(-1.55f, TableTop, 0.3f); private const float AnvilSize = 0.75f;
private const float MealSize = 0.6f;
private const float SkullSize = 0.45f;
/// <summary> /// <summary>
/// "A slab of bone and slate": the cartography table greyed down, a skeleton's skull on one end /// "A slab of bone and slate": the black marble table, with the trade's own work in the middle -
/// and the trade's own tool on the other - an anvil for the smith, a mortar for the cook. /// an anvil for the smith, a meal for the cook - and a skeleton's skull beside it.
/// </summary> /// </summary>
private static void Dress(GameObject prefab, ButlerFamily family) 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", 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) if (family == ButlerFamily.Forge)
{ {
ModelBorrow.Attach(prefab.transform, "TableAnvil", "forge_ext2", ModelBorrow.Attach(prefab.transform, "TableAnvil", "forge_ext2",
TradeSpot, Quaternion.identity, 0.55f, "Butler", activeOnly: true); TradeSpot + up, Quaternion.identity, AnvilSize, "Butler", activeOnly: true);
} }
else else
{ {
ModelBorrow.Attach(prefab.transform, "TableMortar", "cauldron_ext5_mortarandpestle", ModelBorrow.Attach(prefab.transform, "TableMeal", "MeatPlatter",
TradeSpot, Quaternion.identity, 0.6f, "Butler", activeOnly: true); TradeSpot + up, Quaternion.identity, MealSize, "Butler", activeOnly: true);
} }
} }

View file

@ -143,7 +143,8 @@ namespace RacesOfValheim
string status = servant.Status; string status = servant.Status;
if (string.IsNullOrEmpty(status)) status = ModText.Get("rov_hover_butler_waiting"); 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;
} }
/// <summary> /// <summary>

View file

@ -77,12 +77,10 @@ namespace RacesOfValheim
private const float PileSize = 0.45f; private const float PileSize = 0.45f;
// The dressing, in the same unscaled table space as the pile. The pile owns the centre, so the // 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 Color BankWoodTint = new Color(0.62f, 0.55f, 0.5f, 1f);
private static readonly Vector3 LanternSpot = new Vector3(-1.75f, PileHeight, 0.55f); private static readonly Vector3 TankardSpot = new Vector3(0.45f, PileHeight, -0.25f);
private const float LanternSize = 0.55f; private const float TankardSize = 0.38f;
private static readonly Vector3 TankardSpot = new Vector3(0.35f, PileHeight, -0.65f);
private const float TankardSize = 0.2f;
public class Troop public class Troop
{ {
@ -284,11 +282,9 @@ namespace RacesOfValheim
prefab.transform.localScale = Vector3.one * TableScale; prefab.transform.localScale = Vector3.one * TableScale;
// A counting table, not a map table: darker wood, a dvergr lantern at the far end and a // A counting table, not a map table: darker wood and a dvergr tankard beside the coin.
// tankard by the ledger. Tinted BEFORE the props go on, or they would be darkened too. // Tinted BEFORE the tankard goes on, or it would be darkened too.
PieceLook.Tint(prefab.transform, BankWoodTint); 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", ModelBorrow.Attach(prefab.transform, "BankTankard", "Tankard_dvergr",
TankardSpot, Quaternion.identity, TankardSize, "Dvergar", activeOnly: true); TankardSpot, Quaternion.identity, TankardSize, "Dvergar", activeOnly: true);