Mouse rotator system (#19267)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Kara
2023-09-22 22:45:13 -07:00
committed by GitHub
parent 69bcd69715
commit b8b4e918e2
10 changed files with 217 additions and 11 deletions

View File

@@ -44,7 +44,7 @@ namespace Content.Shared.Interaction
if (Math.Abs(rotationDiff) > maxRotate)
{
var goalTheta = worldRot + Math.Sign(rotationDiff) * maxRotate;
_transform.SetWorldRotation(xform, goalTheta);
TryFaceAngle(uid, goalTheta, xform);
rotationDiff = (goalRotation - goalTheta);
if (Math.Abs(rotationDiff) > tolerance)
@@ -55,11 +55,11 @@ namespace Content.Shared.Interaction
return true;
}
_transform.SetWorldRotation(xform, goalRotation);
TryFaceAngle(uid, goalRotation, xform);
}
else
{
_transform.SetWorldRotation(xform, goalRotation);
TryFaceAngle(uid, goalRotation, xform);
}
return true;
@@ -85,7 +85,7 @@ namespace Content.Shared.Interaction
if (!Resolve(user, ref xform))
return false;
xform.WorldRotation = diffAngle;
_transform.SetWorldRotation(xform, diffAngle);
return true;
}
@@ -101,7 +101,7 @@ namespace Content.Shared.Interaction
// (Since the user being buckled to it holds it down with their weight.)
// This is logically equivalent to RotateWhileAnchored.
// Barstools and office chairs have independent wheels, while regular chairs don't.
Transform(rotatable.Owner).WorldRotation = diffAngle;
_transform.SetWorldRotation(Transform(suid.Value), diffAngle);
return true;
}
}