feat(text): item, piece and creature names come from translation files

The mod's own items, build pieces and summoned creatures now carry
$rov_item_, $rov_piece_ and $rov_creature_ tokens for their names and
descriptions, and items.json holds the texts in English and Italian.
Valheim localizes these fields wherever it shows them: tooltips, hover
texts, messages, the build menu.

Where a name doubles as an identifier, both sides use the same constant,
so the comparisons still hold. The Aswid foods keep their prefix as a
constant for the refinery's check and now name the creature with its
vanilla token, so "Boar" translates too. The Furling crops get one whole
description per crop instead of an English sentence with the metal dropped
in. The Race Menu Ward's panel title is a mod UI Text, so it reads the
translation directly.

Saves are unaffected: items and eaten foods are stored by prefab name.
The Sverm hive's goods stay for the merchant step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-26 19:58:53 +02:00
commit b177c89c71
34 changed files with 405 additions and 142 deletions

View file

@ -30,10 +30,10 @@ namespace RacesOfValheim
// The Aswid food patches recognise a meal by its display name, so these strings are part
// of the contract with AswidPatches - see IsAswidMeal.
public const string EssenceDisplayName = "Blood Essence";
public const string SuperiorEssenceDisplayName = "Superior Blood Essence";
public const string CoreDisplayName = "Blood Core";
public const string PieceDisplayName = "Blood Refinery";
public const string EssenceDisplayName = "$rov_item_aswid_bloodessence_name";
public const string SuperiorEssenceDisplayName = "$rov_item_aswid_superiorbloodessence_name";
public const string CoreDisplayName = "$rov_item_aswid_bloodcore_name";
public const string PieceDisplayName = "$rov_piece_aswid_bloodrefinery_name";
// Regeneration is tied to the health value rather than set per tier, so 60 hp gives 5 and
// 80 hp gives 6.67 without a second number to keep in sync.
@ -94,7 +94,7 @@ namespace RacesOfValheim
public static bool IsAswidMeal(ItemDrop.ItemData item)
{
if (item == null || item.m_shared == null || item.m_shared.m_name == null) return false;
return item.m_shared.m_name.StartsWith("Aswid Food:")
return item.m_shared.m_name.StartsWith(AswidRace.AswidFoodNamePrefix)
|| item.m_shared.m_name == EssenceDisplayName
|| IsEssence(item);
}
@ -122,8 +122,7 @@ namespace RacesOfValheim
ItemDrop.ItemData.SharedData shared = drop.m_itemData.m_shared;
shared.m_name = CoreDisplayName;
shared.m_description = "A knot of clotted blood kept beating by something that is not a heart. " +
"The dead trade them; only the dead know how they are made.";
shared.m_description = "$rov_item_aswid_bloodcore_desc";
shared.m_itemType = ItemDrop.ItemData.ItemType.Material;
shared.m_food = 0f;
shared.m_foodStamina = 0f;
@ -142,8 +141,7 @@ namespace RacesOfValheim
EssencePrefab = BuildEssence(
EssenceName,
EssenceDisplayName,
"Blood rendered down to what it actually is. The only real food an Aswid can " +
"still chew, and the base of every draught worth brewing.",
"$rov_item_aswid_bloodessence_desc",
food: 60f,
tint: EssenceTint,
iconSource: "GemstoneRed");
@ -151,7 +149,7 @@ namespace RacesOfValheim
SuperiorEssencePrefab = BuildEssence(
SuperiorEssenceName,
SuperiorEssenceDisplayName,
"The same blood, rendered twice. Darker, thicker, and worth five of the first pass.",
"$rov_item_aswid_superiorbloodessence_desc",
food: 80f,
tint: SuperiorEssenceTint,
iconSource: "MoltenCore");
@ -267,7 +265,7 @@ namespace RacesOfValheim
PieceConfig config = new PieceConfig
{
Name = PieceDisplayName,
Description = "Flesh goes in, bone goes in, and what is left of both comes out red.",
Description = "$rov_piece_aswid_bloodrefinery_desc",
PieceTable = PieceTables.Hammer,
Category = PieceCategories.Crafting,
Requirements = new[]