fix(trol): True Form log visible, slam reaches the ground, skin tint

The log in the troll's fist was there but switched off: an item's
attach child is stored inactive in its prefab and VisEquipment turns
it on after the Instantiate. It is now switched on, hung with the
item's equipoffset, and sized to the costume, since AttachItem keeps
an attach at its world size and the costume is not at scale 1.

The slam never ran its slam code. troll_groundslam is a Vertical
attack in vanilla, not Area, so asking the attack type sent every slam
down the punch's sweep: damage, but no AoE, no dust and no crater. The
slam now goes by the key that was pressed.

The tint multiplied _Color, which the creature shader does not read.
It now shifts _Hue, _Saturation and _Value, as LevelEffects does for
starred creatures, by the distance from the vanilla troll's colour to
the player's skin colour.
This commit is contained in:
kanym 2026-10-14 17:17:20 +02:00
commit a9e66aeeb7
2 changed files with 69 additions and 13 deletions

View file

@ -109,7 +109,11 @@ namespace RacesOfValheim
if (profile == null) return;
bool log = kind == TrolTrueFormModel.AttackKind.LogSwingH || kind == TrolTrueFormModel.AttackKind.LogSwingV;
StartCoroutine(AttackRoutine(profile, log));
// The slam goes by what the key means, not by the troll's attack type: troll_groundslam
// is a Vertical attack in vanilla, not an Area one, so asking the type sent every slam
// down the punch's sweep - no dust, no crater, only the damage.
bool slam = kind == TrolTrueFormModel.AttackKind.Slam && profile == TrolTrueFormModel.Get(TrolTrueFormModel.AttackKind.Slam);
StartCoroutine(AttackRoutine(profile, log, slam));
}
/// <summary>
@ -134,7 +138,7 @@ namespace RacesOfValheim
SetAttacking(false);
}
private IEnumerator AttackRoutine(TrolTrueFormModel.Profile profile, bool log)
private IEnumerator AttackRoutine(TrolTrueFormModel.Profile profile, bool log, bool slam)
{
SetAttacking(true);
Player player = Player.m_localPlayer;
@ -153,7 +157,7 @@ namespace RacesOfValheim
{
float scale = transform.localScale.x;
int landed;
if (profile.Type == Attack.AttackType.Area)
if (slam)
{
landed = TrolTrueFormHit.Slam(player, profile, scale);
}