mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
parent
4808eeb47b
commit
574148fe42
3 changed files with 7 additions and 24 deletions
Binary file not shown.
|
@ -405,7 +405,7 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
public Vector3 getPawnHeadPosition() {
|
public Vector3 getPawnHeadPosition() {
|
||||||
|
|
||||||
Vector3 headPos = anchor + deltaPos + headBob;
|
Vector3 headPos = anchor + deltaPos + Quaternion.AngleAxis(bodyAngle, Vector3.up) * (pawn.Drawer.renderer.BaseHeadOffsetAt(headFacing) + headBob);
|
||||||
|
|
||||||
return headPos;
|
return headPos;
|
||||||
|
|
||||||
|
|
|
@ -23,32 +23,13 @@ namespace Rimworld_Animations {
|
||||||
{
|
{
|
||||||
|
|
||||||
Quaternion headQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up);
|
Quaternion headQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up);
|
||||||
Quaternion bodyQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.bodyAngle, Vector3.up);
|
|
||||||
Rot4 headRotInAnimation = pawnAnimator.headFacing;
|
Rot4 headRotInAnimation = pawnAnimator.headFacing;
|
||||||
Vector3 headPositionInAnimation = pawnAnimator.getPawnHeadPosition();
|
Vector3 headPositionInAnimation = pawnAnimator.getPawnHeadPosition();
|
||||||
|
|
||||||
headPositionInAnimation.y = loc.y;
|
headPositionInAnimation.y = loc.y;
|
||||||
|
|
||||||
AlienPartGenerator.AlienComp comp = pawn.GetComp<AlienPartGenerator.AlienComp>();
|
GenDraw.DrawMeshNowOrLater(mesh: graphic.MeshAt(rot: headRotInAnimation), loc: headPositionInAnimation, //+ (bodyAddon.alignWithHead ? headOffset : Vector3.zero) + v.RotatedBy(Mathf.Acos(Quaternion.Dot(Quaternion.identity, quat)) * 2f * 57.29578f),
|
||||||
AlienPartGenerator.RotationOffset offset = bodyAddon.defaultOffsets.GetOffset(pawnAnimator.headFacing);
|
quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * headQuatInAnimation, mat: graphic.MatAt(rot: pawnAnimator.headFacing), drawNow: drawNow);;
|
||||||
AlienPartGenerator.RotationOffset offset2 = bodyAddon.offsets.GetOffset(pawnAnimator.headFacing);
|
|
||||||
|
|
||||||
Vector3 a = (offset != null) ? offset.GetOffset(renderFlags.FlagSet(PawnRenderFlags.Portrait), pawn.story.bodyType, comp.crownType) : Vector3.zero;
|
|
||||||
var vec = a + ((offset2 != null) ? offset2.GetOffset(renderFlags.FlagSet(PawnRenderFlags.Portrait), pawn.story.bodyType, comp.crownType) : Vector3.zero);
|
|
||||||
vec.y = (bodyAddon.inFrontOfBody ? (0.3f + vec.y) : (-0.3f - vec.y));
|
|
||||||
if (headRotInAnimation == Rot4.North)
|
|
||||||
{
|
|
||||||
if (bodyAddon.layerInvert)
|
|
||||||
{
|
|
||||||
vec.y = -vec.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (headRotInAnimation == Rot4.East)
|
|
||||||
{
|
|
||||||
vec.x = -vec.x;
|
|
||||||
}
|
|
||||||
GenDraw.DrawMeshNowOrLater(mesh: graphic.MeshAt(rot: headRotInAnimation), loc: headPositionInAnimation + (bodyAddon.alignWithHead ? headOffset : Vector3.zero) + vec.RotatedBy(Mathf.Acos(Quaternion.Dot(Quaternion.identity, bodyQuatInAnimation)) * 2f * 57.29578f),
|
|
||||||
quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * headQuatInAnimation, mat: graphic.MatAt(rot: pawnAnimator.headFacing), drawNow: drawNow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -56,15 +37,17 @@ namespace Rimworld_Animations {
|
||||||
GenDraw.DrawMeshNowOrLater(mesh, loc, quat, mat, drawNow);
|
GenDraw.DrawMeshNowOrLater(mesh, loc, quat, mat, drawNow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||||
{
|
{
|
||||||
List<CodeInstruction> ins = instructions.ToList();
|
List<CodeInstruction> ins = instructions.ToList();
|
||||||
Type[] type = new Type[] { typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material), typeof(bool) };
|
|
||||||
|
|
||||||
for (int i = 0; i < ins.Count; i++)
|
for (int i = 0; i < ins.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Type[] type = new Type[] { typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material), typeof(bool) };
|
||||||
|
|
||||||
|
|
||||||
if (ins[i].OperandIs(AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater", type)))
|
if (ins[i].OperandIs(AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater", type)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue