feat(stations): the race is a build requirement, shown in the panel

Every race station is listed in RaceStationLock with the race (or
races) that may build it. The build panel shows it in the requirement
row after the materials and the crafting station, with the race's icon
from the race menu and its translated name, blinking red when the
player is not of that race, the way vanilla flags a missing station.
Player.HaveRequirements answers false for CanBuild, so the piece is
greyed and a click gets vanilla's "Missing requirements". IsKnown and
CanAlmostBuild stay vanilla, so every station is still listed.

Seven stations had no race lock at all and are now locked too: Cursed
Body Pile, Pack Trough, Bone Pile, Bound Sentry, Blood Refinery,
Composter and Heartwood Grove. The stations' own placement gates stay
for their boss-tier checks and for no-cost debug building.
This commit is contained in:
kanym 2026-10-17 16:24:09 +02:00
commit 5b2e5f4f86
2 changed files with 153 additions and 0 deletions

View file

@ -451,6 +451,28 @@ namespace RacesOfValheim
GUIManager.BlockInput(true);
}
/// <summary>
/// The icon the race menu shows for a race, for anything else that names a race - the race
/// requirement in the build panel (RaceStationLock). One source, so the two never disagree.
/// </summary>
public static Sprite RaceIcon(string race)
{
if (Instance == null || string.IsNullOrEmpty(race)) return null;
switch (race)
{
case "Fenrir": return Instance.GetFenrirIcon();
case "Skadi": return Instance.GetSkadiIcon();
case SkeletonVisuals.RaceId: return Instance.GetSkeletonIcon();
case "Aswid": return Instance.GetAswidIcon();
case "Furling": return Instance.GetFurlingIcon();
case "Trol": return Instance.GetTrolIcon();
case DvergarConfig.RaceId: return Instance.GetDvergarIcon();
case TrentaConfig.RaceId: return Instance.GetTrentaIcon();
case SvermConfig.RaceId: return Instance.GetSvermIcon();
}
return race == DraughVisuals.RaceId ? Instance.GetDraughIcon() : Instance.GetHumanIcon();
}
private Sprite GetHumanIcon()
{
GameObject clubPrefab = PrefabManager.Cache.GetPrefab<ItemDrop>("Club")?.gameObject;