mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Updates for HAR:
fixes for offsets not working fixes for animations not starting
This commit is contained in:
parent
803f8b1dbd
commit
a9ad5d6b15
2 changed files with 5 additions and 3 deletions
Binary file not shown.
|
@ -39,7 +39,7 @@ namespace Rimworld_Animations {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool Prefix_AnimateHeadAddons(bool portrait, Vector3 vector, Pawn pawn, Quaternion quat, Rot4 rotation, bool invisible) {
|
||||
public static bool Prefix_AnimateHeadAddons(bool portrait, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation, bool invisible) {
|
||||
|
||||
if (portrait || pawn.TryGetComp<CompBodyAnimator>() == null || !pawn.TryGetComp<CompBodyAnimator>().isAnimating) return true;
|
||||
if (!(pawn.def is ThingDef_AlienRace alienProps) || invisible) return false;
|
||||
|
@ -103,6 +103,8 @@ namespace Rimworld_Animations {
|
|||
num = 0;
|
||||
}
|
||||
|
||||
moffsetX += bodyOffset.x + crownOffset.x;
|
||||
moffsetZ += bodyOffset.y + crownOffset.y;
|
||||
|
||||
if (((ba.drawnInBed || ba.alignWithHead) ? pawnAnimator.headFacing : rotation) == Rot4.East) {
|
||||
moffsetX = -moffsetX;
|
||||
|
@ -117,14 +119,14 @@ namespace Rimworld_Animations {
|
|||
Graphic addonGraphic = alienComp.addonGraphics[i];
|
||||
addonGraphic.drawSize = (portrait && ba.drawSizePortrait != Vector2.zero ? ba.drawSizePortrait : ba.drawSize) * (ba.scaleWithPawnDrawsize ? alienComp.customDrawSize : Vector2.one) * 1.5f;
|
||||
|
||||
if (ba.drawnInBed || ba.alignWithHead && pawn.TryGetComp<CompBodyAnimator>() != null && pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
if ((ba.drawnInBed || ba.alignWithHead) && pawn.TryGetComp<CompBodyAnimator>() != null && pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
|
||||
Quaternion headQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up);
|
||||
Rot4 headRotInAnimation = pawnAnimator.headFacing;
|
||||
Vector3 headPositionInAnimation = pawnAnimator.getPawnHeadPosition() - pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing).RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: headQuatInAnimation)) * 2f * 57.29578f);
|
||||
|
||||
|
||||
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: headRotInAnimation), loc: headPositionInAnimation + offsetVector.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: headQuatInAnimation)) * 2f * 57.29578f),
|
||||
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: headRotInAnimation), loc: headPositionInAnimation + (ba.alignWithHead ? headOffset : Vector3.zero) + offsetVector.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: headQuatInAnimation)) * 2f * 57.29578f),
|
||||
quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * headQuatInAnimation, mat: addonGraphic.MatAt(rot: pawnAnimator.headFacing), drawNow: portrait);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue