feat: chainmail over the map on the Smith's Table
The smith goes back to the cartography table, like the cook. Its map is painted over with 4-in-1 mail by scripts/paint_smith_mail.py at 512 px: colour, rusted worn colour, a normal map from the rings' height and a metallic map so they shine. Both tables now share one Dress/LayCover path.
This commit is contained in:
parent
069e098cf0
commit
35476eb8ef
6 changed files with 160 additions and 58 deletions
BIN
JotunnModStub/Assets/SmithMail/SmithMail_d.png
Normal file
BIN
JotunnModStub/Assets/SmithMail/SmithMail_d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 340 KiB |
BIN
JotunnModStub/Assets/SmithMail/SmithMail_m.png
Normal file
BIN
JotunnModStub/Assets/SmithMail/SmithMail_m.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
JotunnModStub/Assets/SmithMail/SmithMail_n.png
Normal file
BIN
JotunnModStub/Assets/SmithMail/SmithMail_n.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 441 KiB |
BIN
JotunnModStub/Assets/SmithMail/SmithMail_worn_d.png
Normal file
BIN
JotunnModStub/Assets/SmithMail/SmithMail_worn_d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 339 KiB |
|
|
@ -61,9 +61,7 @@ namespace RacesOfValheim
|
|||
/// making the situation impossible to build rather than by sharing state between them.</summary>
|
||||
public const float TableSpacing = 40f;
|
||||
|
||||
private const string TableSource = "piece_blackmarble_table";
|
||||
private const string ClothTableSource = "piece_cartographytable";
|
||||
private const float ClothTableScale = 0.8f;
|
||||
private const float TableScale = 0.8f;
|
||||
|
||||
/// <summary>
|
||||
/// One skull, one wishbone, eight stone - the same price for both tables.
|
||||
|
|
@ -199,22 +197,19 @@ namespace RacesOfValheim
|
|||
private static void RegisterTable(string pieceName, string displayName, string servantPrefab,
|
||||
ButlerFamily family, string description, string iconSource)
|
||||
{
|
||||
// The smith works at the black marble table, "a slab of bone and slate". The cook keeps the
|
||||
// cartography table, with a tablecloth painted over its map (Dress).
|
||||
bool kitchen = family == ButlerFamily.Kitchen;
|
||||
string source = kitchen ? ClothTableSource : TableSource;
|
||||
GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(pieceName, source);
|
||||
GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(pieceName, "piece_cartographytable");
|
||||
if (prefab == null)
|
||||
{
|
||||
Jotunn.Logger.LogWarning($"[Butler] Could not clone {source}; " +
|
||||
Jotunn.Logger.LogWarning($"[Butler] Could not clone piece_cartographytable; " +
|
||||
$"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. The marble table
|
||||
// carries nothing of the kind today, and the sweep keeps a future patch from adding one.
|
||||
// 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.
|
||||
foreach (MonoBehaviour behaviour in prefab.GetComponentsInChildren<MonoBehaviour>(true))
|
||||
{
|
||||
if (behaviour == null) continue;
|
||||
|
|
@ -222,7 +217,7 @@ namespace RacesOfValheim
|
|||
Object.DestroyImmediate(behaviour);
|
||||
}
|
||||
|
||||
if (kitchen) prefab.transform.localScale = Vector3.one * ClothTableScale;
|
||||
prefab.transform.localScale = Vector3.one * TableScale;
|
||||
Dress(prefab, family);
|
||||
|
||||
ServantTableBehaviour table = prefab.AddComponent<ServantTableBehaviour>();
|
||||
|
|
@ -261,74 +256,63 @@ namespace RacesOfValheim
|
|||
}));
|
||||
}
|
||||
|
||||
// The smith's look. The marble table is 2.6 m by 1.5 m; both props sit either side of its
|
||||
// centre, the anvil 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);
|
||||
// The look, in the table's own space BEFORE TableScale, so sizes are divided by it to come out
|
||||
// in real metres. The cover lies where the map was: x -2.06 to 0.62, read off the mesh. Its top
|
||||
// is the Dvergar bank's PileHeight, on the same vanilla mesh; the mesh's own height is no use
|
||||
// here, since the writing desk stands taller than the map.
|
||||
private const float CoverTop = 1.05f;
|
||||
private static readonly Vector3 TradeSpot = new Vector3(-0.75f, CoverTop, 0.2f);
|
||||
private static readonly Vector3 SkullSpot = new Vector3(-1.55f, CoverTop, 0.35f);
|
||||
private const float AnvilSize = 0.75f;
|
||||
private const float MealSize = 0.6f;
|
||||
private const float SkullSize = 0.45f;
|
||||
|
||||
// The cook's cartography table, in its own space BEFORE ClothTableScale (so sizes are divided by
|
||||
// it to come out the same as the smith's). The cloth covers what was the map: x -2.06 to 0.62,
|
||||
// read off the mesh. Its top is the Dvergar bank's PileHeight, on the same vanilla mesh; the
|
||||
// mesh's own height is no use here, since the writing desk stands taller than the cloth.
|
||||
private const float ClothTop = 1.05f;
|
||||
private static readonly Vector3 MealOnCloth = new Vector3(-0.75f, ClothTop, 0.2f);
|
||||
private static readonly Vector3 SkullOnCloth = new Vector3(-1.55f, ClothTop, 0.35f);
|
||||
|
||||
/// <summary>
|
||||
/// 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. The smith's on the black marble, the cook's on a red and white
|
||||
/// cloth painted over the cartography table's map.
|
||||
/// The map painted over - a sheet of chainmail for the smith, a red and white tablecloth for the
|
||||
/// cook - with the trade's own work on it (an anvil, a meal) and a skeleton's skull beside it.
|
||||
/// </summary>
|
||||
private static void Dress(GameObject prefab, ButlerFamily family)
|
||||
{
|
||||
if (family == ButlerFamily.Kitchen)
|
||||
bool forge = family == ButlerFamily.Forge;
|
||||
LayCover(prefab, forge ? "SmithMail" : "CookCloth", metal: forge);
|
||||
|
||||
float metres = 1f / TableScale;
|
||||
if (forge)
|
||||
{
|
||||
LayCloth(prefab);
|
||||
float size = 1f / ClothTableScale;
|
||||
ModelBorrow.Attach(prefab.transform, "TableMeal", "MeatPlatter",
|
||||
MealOnCloth, Quaternion.identity, MealSize * size, "Butler", activeOnly: true);
|
||||
ModelBorrow.Attach(prefab.transform, "TableSkull", "TrophySkeleton",
|
||||
SkullOnCloth, Quaternion.Euler(0f, -150f, 0f), SkullSize * size, "Butler", activeOnly: true);
|
||||
return;
|
||||
ModelBorrow.Attach(prefab.transform, "TableAnvil", "forge_ext2",
|
||||
TradeSpot, Quaternion.identity, AnvilSize * metres, "Butler", activeOnly: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelBorrow.Attach(prefab.transform, "TableMeal", "MeatPlatter",
|
||||
TradeSpot, Quaternion.identity, MealSize * metres, "Butler", activeOnly: true);
|
||||
}
|
||||
|
||||
// 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, "TableAnvil", "forge_ext2",
|
||||
TradeSpot + up, Quaternion.identity, AnvilSize, "Butler", activeOnly: true);
|
||||
ModelBorrow.Attach(prefab.transform, "TableSkull", "TrophySkeleton",
|
||||
SkullSpot + up, Quaternion.Euler(0f, -150f, 0f), SkullSize, "Butler", activeOnly: true);
|
||||
SkullSpot, Quaternion.Euler(0f, -150f, 0f), SkullSize * metres, "Butler", activeOnly: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The tablecloth: the cartography table's own textures with the map painted over in red and
|
||||
/// white squares, by scripts/paint_cook_cloth.py. The worn texture (a damaged table) has a
|
||||
/// faded, stained cloth of its own, and the normal map is smoothed there so the coastline's
|
||||
/// relief does not show through.
|
||||
/// The cartography table's own textures with the map painted over, offline:
|
||||
/// scripts/paint_cook_cloth.py (CookCloth) and scripts/paint_smith_mail.py (SmithMail). Each set
|
||||
/// has its own worn texture for a damaged table (a stained cloth, rusted mail) and its own normal
|
||||
/// map, so the coastline's relief does not show through. The mail also brings a metallic map,
|
||||
/// which is what makes the rings shine; the cloth keeps vanilla's, which is metal nowhere.
|
||||
/// </summary>
|
||||
private static void LayCloth(GameObject prefab)
|
||||
private static void LayCover(GameObject prefab, string set, bool metal)
|
||||
{
|
||||
var cloth = new System.Collections.Generic.Dictionary<string, Texture>();
|
||||
AddCloth(cloth, "Cartographer_d", "CookCloth_d.png", false);
|
||||
AddCloth(cloth, "Cartographer_worn_d", "CookCloth_worn_d.png", false);
|
||||
AddCloth(cloth, "Cartographer_n", "CookCloth_n.png", true);
|
||||
PieceLook.Retexture(prefab.transform, cloth);
|
||||
var cover = new System.Collections.Generic.Dictionary<string, Texture>();
|
||||
AddCover(cover, "Cartographer_d", set + "_d.png", false);
|
||||
AddCover(cover, "Cartographer_worn_d", set + "_worn_d.png", false);
|
||||
AddCover(cover, "Cartographer_n", set + "_n.png", true);
|
||||
if (metal) AddCover(cover, "Cartographer_m", set + "_m.png", true);
|
||||
PieceLook.Retexture(prefab.transform, cover);
|
||||
}
|
||||
|
||||
private static void AddCloth(System.Collections.Generic.Dictionary<string, Texture> cloth,
|
||||
private static void AddCover(System.Collections.Generic.Dictionary<string, Texture> cover,
|
||||
string vanilla, string resource, bool linear)
|
||||
{
|
||||
Texture2D texture = PieceLook.LoadTexture(resource, linear);
|
||||
if (texture != null) cloth[vanilla] = texture;
|
||||
if (texture != null) cover[vanilla] = texture;
|
||||
}
|
||||
|
||||
public static void EnsureKnown(Player player)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue