fix(forms): no form attacks in build mode; chair pose 1 m out, turned

RaceInput.AttackDown and AttackHeld now return false while the player
is in place mode (hammer, hoe, cultivator). Right click removes a piece
there and middle click picks a snap point, and every form read both as
its own attacks. Allowed only covered the piece selection panel. Every
form reads the mouse through RaceInput, so all of them are covered.

On a chair the form now settles 1 m in front of the seat and turns a
quarter counter-clockwise, at the player's request after the first try.
This commit is contained in:
kanym 2026-10-17 19:34:51 +02:00
commit ba7f56550d
2 changed files with 20 additions and 4 deletions

View file

@ -31,6 +31,13 @@ namespace RacesOfValheim
// Not public on Player, hence the reflection; resolved once rather than per frame.
private static readonly MethodInfo TakeInputMethod = AccessTools.Method(typeof(Player), "TakeInput");
/// <summary>
/// Hammer, hoe or cultivator in hand. Right click removes a piece there and middle click picks
/// a snap point, and a form read both as its own attacks: an Ulv building a wall bit the air
/// on every click. Allowed only covered the piece selection panel, not the build mode itself.
/// </summary>
private static bool InBuildMode => Player.m_localPlayer != null && Player.m_localPlayer.InPlaceMode();
public static bool Allowed
{
get
@ -156,14 +163,14 @@ namespace RacesOfValheim
/// </summary>
public static bool AttackDown(int mouseButton)
{
if (RadialOpen) return false;
if (RadialOpen || InBuildMode) return false;
return Input.GetMouseButtonDown(mouseButton) || PadAttackDown(mouseButton);
}
/// <summary>Held-down counterpart of <see cref="AttackDown"/>.</summary>
public static bool AttackHeld(int mouseButton)
{
if (RadialOpen) return false;
if (RadialOpen || InBuildMode) return false;
return Input.GetMouseButton(mouseButton) || PadAttackHeld(mouseButton);
}