feat(skeleton): show the race on the main-menu character preview
The body swap read the race off the ZDO and gave up when there was none, which is exactly the situation on the menu preview - FejdStartup instantiates a Player and calls PlayerProfile.LoadPlayerData on it, so the preview knows its own custom data and therefore its race, but it has no business owning a network view. It now falls back to m_customData the way every other race in the mod already does, so a Skeleton character looks like one before you press Start. The tier falls back the same way. In the menu there is no world loaded to have killed anything, so the preview is the base skeleton whatever the character has done elsewhere. feat(dvergar): age into a starred dverger's colours One star at Bonemass, two at Fader. Nothing is picked by eye. A starred creature in Valheim is not a second model: it is the same one recoloured by LevelEffects, whose LevelSetup list holds a hue/saturation/value offset per star. Those offsets are read off the Dverger prefab at runtime and applied to the race's own slate blue-grey, so the tiers land on the tints the game itself uses and keep following them if the prefab changes. The tier comes from the ZDO key DvergarRace already publishes, so a remote Dvergar is coloured at their own standing rather than the observer's - which matters as soon as anyone runs personal progression. Crossing a tier pushes a colour refresh through immediately, since the tint is only written from the UpdateColors postfix and Valheim runs that on its own schedule. Same treatment the health malus already gets a few lines above. The hood is deliberately untouched.
This commit is contained in:
parent
93157632a4
commit
eabc1c54bf
6 changed files with 189 additions and 7 deletions
|
|
@ -18,6 +18,7 @@ namespace RacesOfValheim
|
|||
|
||||
// NaN so that the very first frame always counts as a change and pushes the malus through.
|
||||
private float lastAppliedMalus = float.NaN;
|
||||
private int lastAppliedStarTier = -1;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
@ -101,6 +102,18 @@ namespace RacesOfValheim
|
|||
nview.GetZDO().Set(DvergarConfig.StateZdoKey, state);
|
||||
}
|
||||
|
||||
// The skin tint is only written from the UpdateColors postfix, which Valheim runs on
|
||||
// its own schedule - so crossing into a new star tier would otherwise not show until
|
||||
// something else happened to refresh the visuals. Push one through, the same way the
|
||||
// health malus above pushes a food update.
|
||||
int starTier = DvergarVisuals.GetStarTier(state);
|
||||
if (starTier != lastAppliedStarTier)
|
||||
{
|
||||
lastAppliedStarTier = starTier;
|
||||
VisEquipment visEq = player.GetComponent<VisEquipment>();
|
||||
if (visEq != null) Traverse.Create(visEq).Method("UpdateColors").GetValue();
|
||||
}
|
||||
|
||||
DvergarAbilities.Tick(player, state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue