private static void DrawMeshModified(Mesh mesh, Vector3 position, Quaternion rotation, Material mat, int layer, Thing eq, float aimAngle) { CompOversizedWeapon compOversized = eq.TryGetComp <CompOversizedWeapon>(); CompEquippable equippable = eq.TryGetComp <CompEquippable>(); Pawn pawn = equippable.PrimaryVerb.CasterPawn; if (pawn == null) { return; } if (compOversized == null || (compOversized != null && compOversized.CompDeflectorIsAnimatingNow) || pawn == null || eq == null) { Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.draw(mesh, default(Matrix4x4), mat, layer, eq, pawn, position, rotation); return; } Vector3 s; if (pawn.RaceProps.Humanlike) { if (HarmonyCompOversizedWeapon.enabled_AlienRaces) { Vector2 v = AlienRaceUtility.AlienRacesPatch(pawn, eq); float f = Mathf.Max(v.x, v.y); s = new Vector3(eq.def.graphicData.drawSize.x * f, 1f, eq.def.graphicData.drawSize.y * f); } else { s = new Vector3(eq.def.graphicData.drawSize.x, 1f, eq.def.graphicData.drawSize.y); } } else { Vector2 v = pawn.ageTracker.CurKindLifeStage.bodyGraphicData.drawSize; s = new Vector3(eq.def.graphicData.drawSize.x + v.x / 10, 1f, eq.def.graphicData.drawSize.y + v.y / 10); } Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(position, rotation, s); Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.draw(mesh, matrix, mat, 0, eq, pawn, position, rotation); }
public static void DrawEquipmentAimingOverride(Mesh mesh, Thing eq, Vector3 drawLoc, float aimAngle, CompOversizedWeapon compOversized, CompEquippable equippable, Pawn pawn, bool offhand = false) { float num = aimAngle - 90f; if (aimAngle > 20f && aimAngle < 160f) { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } else { if (aimAngle > 200f && aimAngle < 340f) { mesh = offhand ? (mesh == MeshPool.plane10 ? MeshPool.plane10Flip : MeshPool.plane10) : MeshPool.plane10Flip; num -= 180f; num -= eq.def.equippedAngleOffset; } else { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } } num %= 360f; Vector3 s; if (pawn.RaceProps.Humanlike) { if (HarmonyPatches_OversizedWeapon.enabled_AlienRaces) { Vector2 v = AlienRaceUtility.AlienRacesPatch(pawn, eq); float f = Mathf.Max(v.x, v.y); s = new Vector3(eq.def.graphicData.drawSize.x * f, 1f, eq.def.graphicData.drawSize.y * f); } else { s = new Vector3(eq.def.graphicData.drawSize.x, 1f, eq.def.graphicData.drawSize.y); } } else { Vector2 v = pawn.ageTracker.CurKindLifeStage.bodyGraphicData.drawSize; s = new Vector3(eq.def.graphicData.drawSize.x + v.x / 10, 1f, eq.def.graphicData.drawSize.y + v.y / 10); } Matrix4x4 matrix = default(Matrix4x4); Quaternion rotation = Quaternion.AngleAxis(num, Vector3.up); matrix.SetTRS(drawLoc, rotation, s); Graphic_StackCount graphic_StackCount = eq.Graphic as Graphic_StackCount; bool flag3 = graphic_StackCount != null; Material matSingle; if (flag3) { matSingle = graphic_StackCount.SubGraphicForStackCount(1, eq.def).MatSingle; } else { matSingle = eq.Graphic.MatSingle; } OversizedUtil.Draw(mesh, matrix, matSingle, 0, eq, pawn, drawLoc, rotation); }