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:
parent
9bf144aedc
commit
b177c89c71
34 changed files with 405 additions and 142 deletions
|
|
@ -27,8 +27,8 @@ namespace RacesOfValheim
|
|||
public const string SuperiorBaseName = "MeadBaseSuperiorBloodPotion";
|
||||
public const string SuperiorPotionName = "MeadSuperiorBloodPotion";
|
||||
|
||||
private const string PotionDisplayName = "Blood Potion";
|
||||
private const string SuperiorPotionDisplayName = "Superior Blood Potion";
|
||||
private const string PotionDisplayName = "$rov_item_aswid_bloodpotion_name";
|
||||
private const string SuperiorPotionDisplayName = "$rov_item_aswid_superiorbloodpotion_name";
|
||||
|
||||
private const float HealDuration = 8f;
|
||||
private const float HealFraction = 0.05f;
|
||||
|
|
@ -54,15 +54,14 @@ namespace RacesOfValheim
|
|||
SE_BloodPotion superiorDrink = CreateEffect("SE_SuperiorBloodPotion", SuperiorPotionDisplayName,
|
||||
SuperiorHealFraction, AswidBloodRefinery.SuperiorEssenceName, "MoltenCore");
|
||||
|
||||
GameObject meadBase = CloneItem(BaseName, "MeadBaseHealthMinor", "Blood Potion Mead Base",
|
||||
"Blood, berries and crypt light, waiting on a barrel.");
|
||||
GameObject meadBase = CloneItem(BaseName, "MeadBaseHealthMinor", "$rov_item_aswid_bloodpotionbase_name",
|
||||
"$rov_item_aswid_bloodpotionbase_desc");
|
||||
GameObject potion = CloneItem(PotionName, "MeadHealthMinor", PotionDisplayName,
|
||||
"Drink and the hunger stops mattering for a while. Fills every stomach with blood essence, " +
|
||||
"full or not, and knits the flesh back together.");
|
||||
GameObject superiorBase = CloneItem(SuperiorBaseName, "MeadBaseHealthMedium", "Superior Blood Potion Mead Base",
|
||||
"The twice-rendered draught, still raw.");
|
||||
"$rov_item_aswid_bloodpotion_desc");
|
||||
GameObject superiorBase = CloneItem(SuperiorBaseName, "MeadBaseHealthMedium", "$rov_item_aswid_superiorbloodpotionbase_name",
|
||||
"$rov_item_aswid_superiorbloodpotionbase_desc");
|
||||
GameObject superiorPotion = CloneItem(SuperiorPotionName, "MeadHealthMedium", SuperiorPotionDisplayName,
|
||||
"The same mercy, twice as deep.");
|
||||
"$rov_item_aswid_superiorbloodpotion_desc");
|
||||
|
||||
AttachEffect(potion, drink);
|
||||
AttachEffect(superiorPotion, superiorDrink);
|
||||
|
|
|
|||
|
|
@ -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[]
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace RacesOfValheim
|
|||
|
||||
public override string RaceId => "Aswid";
|
||||
public override string ItemName => "AswidBeastClaws";
|
||||
public override string DisplayName => "Claws of the Beast";
|
||||
public override string Description => "Grown in the dark, and darker for it. They do not come off.";
|
||||
public override string DisplayName => "$rov_item_aswid_claws_name";
|
||||
public override string Description => "$rov_item_aswid_claws_desc";
|
||||
|
||||
// The Bjorn claw first, by name, because that is the one this race is meant to wear. The
|
||||
// rest are the near-identical ids the manifest also carries - see SvermConfig's own
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ namespace RacesOfValheim
|
|||
{
|
||||
public class AswidRace : MonoBehaviour
|
||||
{
|
||||
/// <summary>The start of every Aswid food's name, and how those items are told apart.</summary>
|
||||
public const string AswidFoodNamePrefix = "$rov_item_aswid_food_name";
|
||||
|
||||
public static AswidRace Instance { get; private set; }
|
||||
|
||||
private static Dictionary<string, string> mobToTrophyMap = new Dictionary<string, string>
|
||||
|
|
@ -117,8 +120,12 @@ namespace RacesOfValheim
|
|||
string foodName = "AswidFood_" + mobName;
|
||||
|
||||
Jotunn.Configs.ItemConfig config = new Jotunn.Configs.ItemConfig();
|
||||
config.Name = "Aswid Food: " + mobName;
|
||||
config.Description = "The life force of the conquered.";
|
||||
// The prefix token and the creature's own vanilla token ("$enemy_boar"), which the
|
||||
// game translates too. The prefix is also how the refinery recognises these items -
|
||||
// see AswidBloodRefinery.IsAswidMeal - so the two must stay the same string.
|
||||
string mobDisplay = Jotunn.Managers.PrefabManager.Cache.GetPrefab<Character>(mobName)?.m_name;
|
||||
config.Name = AswidFoodNamePrefix + " " + (string.IsNullOrEmpty(mobDisplay) ? mobName : mobDisplay);
|
||||
config.Description = "$rov_item_aswid_food_desc";
|
||||
|
||||
Jotunn.Entities.CustomItem customItem = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ namespace RacesOfValheim
|
|||
ItemDrop itemDrop = clone.GetComponent<ItemDrop>();
|
||||
if (itemDrop == null) return false;
|
||||
|
||||
itemDrop.m_itemData.m_shared.m_name = "Spectral Claw";
|
||||
itemDrop.m_itemData.m_shared.m_description = "A claw of pure shadow, bound to your rage rather than your grip.";
|
||||
itemDrop.m_itemData.m_shared.m_name = "$rov_item_aswid_spectralclaw_name";
|
||||
itemDrop.m_itemData.m_shared.m_description = "$rov_item_aswid_spectralclaw_desc";
|
||||
itemDrop.m_itemData.m_shared.m_weight = 0f;
|
||||
itemDrop.m_itemData.m_shared.m_useDurability = false;
|
||||
itemDrop.m_itemData.m_shared.m_questItem = true; // undroppable, unsellable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue