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:
parent
9662ec6b38
commit
ba7f56550d
2 changed files with 20 additions and 4 deletions
|
|
@ -135,7 +135,11 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
// How far in front of the seat a creature on a chair settles, in metres.
|
||||
private const float ChairForward = 0.5f;
|
||||
private const float ChairForward = 1f;
|
||||
|
||||
// And turned a quarter left, counter-clockwise seen from above, so it lies across the front
|
||||
// of the seat rather than facing out of it.
|
||||
private static readonly Quaternion ChairTurn = Quaternion.Euler(0f, -90f, 0f);
|
||||
private static readonly int ChairGroundMask = LayerMask.GetMask("Default", "static_solid", "terrain", "piece", "vehicle");
|
||||
private static readonly RaycastHit[] chairHits = new RaycastHit[16];
|
||||
private Transform placedRoot;
|
||||
|
|
@ -154,7 +158,11 @@ namespace RacesOfValheim
|
|||
bool onChair = player.IsSitting();
|
||||
if (!onChair)
|
||||
{
|
||||
if (placedRoot == root && root.localPosition != Vector3.zero) root.localPosition = Vector3.zero;
|
||||
if (placedRoot == root)
|
||||
{
|
||||
if (root.localPosition != Vector3.zero) root.localPosition = Vector3.zero;
|
||||
if (root.localRotation != Quaternion.identity) root.localRotation = Quaternion.identity;
|
||||
}
|
||||
return;
|
||||
}
|
||||
placedRoot = root;
|
||||
|
|
@ -175,6 +183,7 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
root.localPosition = body.InverseTransformPoint(new Vector3(target.x, groundY, target.z));
|
||||
root.localRotation = ChairTurn;
|
||||
}
|
||||
|
||||
/// <summary>The chair or bench the player sits on: the first piece straight under them.</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue