feat(text): hover texts come from translation files
What the stations, thralls, the ward and the hive show under the crosshair now reads its text through ModText.Get, and hover.json holds 50 texts in English and Italian. The Aswid thralls and the Race Menu Ward wrote the use key as a literal E; they now use $KEY_Use, which shows the key the player actually bound. For that to work, ModText.Get runs a second localization pass when a $ is left in the result: Valheim resolves tokens once and never looks inside what it inserted, and hover texts go to the HUD without another pass. The Sverm hive stage names stay English for now: the compendium and the hive's goods show them too, and those come with the merchants step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
19d7cbacbd
commit
99a1817eb0
16 changed files with 164 additions and 79 deletions
|
|
@ -222,17 +222,15 @@ namespace RacesOfValheim
|
|||
SvermHiveBehaviour hive = Hive;
|
||||
if (hive == null) return Title;
|
||||
|
||||
return $"{Title}\n" +
|
||||
SvermHiveReadout.Tank(hive.transform) +
|
||||
$"[<color=yellow><b>$KEY_Use</b></color>] {Prompt}";
|
||||
return ModText.Get("rov_hover_sverm_msg", Title, SvermHiveReadout.Tank(hive.transform), Prompt);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The hive at the foot of the nest. Press E, a stack goes in.</summary>
|
||||
public class SvermHiveStomach : SvermHiveMouth
|
||||
{
|
||||
protected override string Title => "Hive Stomach";
|
||||
protected override string Prompt => "Feed it a stack";
|
||||
protected override string Title => "$rov_hover_sverm_stomach_title";
|
||||
protected override string Prompt => "$rov_hover_sverm_stomach_prompt";
|
||||
|
||||
protected override bool Use(SvermHiveBehaviour hive, Player player)
|
||||
{
|
||||
|
|
@ -459,13 +457,11 @@ namespace RacesOfValheim
|
|||
SvermHiveBehaviour nest = Nest;
|
||||
if (nest == null)
|
||||
{
|
||||
return $"{SvermHiveMarketPiece.DisplayName}\n" +
|
||||
$"No hive within {SvermConfigManagement.AuraRadius:0} metres.";
|
||||
return ModText.Get("rov_hover_sverm_market_no_hive", SvermHiveMarketPiece.DisplayName,
|
||||
SvermConfigManagement.AuraRadius.ToString("0"));
|
||||
}
|
||||
|
||||
return $"{SvermHiveMarketPiece.DisplayName}\n" +
|
||||
SvermHiveReadout.Tank(nest.transform) +
|
||||
"[<color=yellow><b>$KEY_Use</b></color>] Trade with the hive";
|
||||
return ModText.Get("rov_hover_sverm_trade_with_hive", SvermHiveMarketPiece.DisplayName, SvermHiveReadout.Tank(nest.transform));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -474,9 +470,10 @@ namespace RacesOfValheim
|
|||
{
|
||||
public static string Tank(Transform nest)
|
||||
{
|
||||
return $"Biomass {SvermBiomass.Bank(nest):0} / {SvermBiomass.Capacity(nest):0}\n" +
|
||||
$"Digesting {SvermBiomass.Digesting(nest):0}\n" +
|
||||
$"Brood eggs {SvermBroodEggs.Count(nest)} / {SvermBroodEggs.Cap(nest)}\n";
|
||||
return ModText.Get("rov_hover_sverm_tank",
|
||||
SvermBiomass.Bank(nest).ToString("0"), SvermBiomass.Capacity(nest).ToString("0"),
|
||||
SvermBiomass.Digesting(nest).ToString("0"),
|
||||
SvermBroodEggs.Count(nest), SvermBroodEggs.Cap(nest));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue