public CompOversizedWeapon()
 {
     if (!(props is CompProperties_OversizedWeapon))
     {
         props = new CompProperties_OversizedWeapon();
     }
 }
Esempio n. 2
0
        // Token: 0x0600007D RID: 125 RVA: 0x00006190 File Offset: 0x00004390
        public static void SetAnglesAndOffsets(Thing eq, ThingWithComps offHandEquip, float aimAngle, Thing thing, ref Vector3 offsetMainHand, ref Vector3 offsetOffHand, ref float mainHandAngle, ref float offHandAngle, bool mainHandAiming, bool offHandAiming)
        {
            CompOversizedWeapon compOversized = eq.TryGetComp <CompOversizedWeapon>();

            CompProperties_OversizedWeapon PropsOversized = compOversized.Props;

            Pawn pawn = thing as Pawn;

            bool Melee = pawn != null;

            if (Melee)
            {
                Melee = Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.IsMeleeWeapon(pawn.equipment.Primary);
            }

            bool Dual = false;

            if (PropsOversized != null)
            {
                Dual = PropsOversized.isDualWeapon;
            }
            float   num    = meleeMirrored ? (360f - meleeAngle) : meleeAngle;
            float   num2   = rangedMirrored ? (360f - rangedAngle) : rangedAngle;
            Vector3 offset = AdjustRenderOffsetFromDir(thing.Rotation, compOversized, offHandAiming);

            if (thing.Rotation == Rot4.East)
            {
                offsetMainHand.z += offset.z;
                offsetMainHand.x += offset.x;
                offsetOffHand.y   = -1f;
                offsetOffHand.z   = 0.1f;
                offsetOffHand.z  += offset.z;
                offsetOffHand.x  += offset.x;
                if (PropsOversized != null)
                {
                    mainHandAngle += PropsOversized.angleAdjustmentEast;
                }
                offHandAngle = mainHandAngle;
            }
            else
            {
                if (thing.Rotation == Rot4.West)
                {
                    if (Dual)
                    {
                        offsetMainHand.y = -1f;
                    }
                    offsetMainHand.z += offset.z;
                    offsetMainHand.x += offset.x;
                    offsetOffHand.z   = -0.1f;
                    offsetOffHand.z  += offset.z;
                    offsetOffHand.x  += offset.x;
                    if (PropsOversized != null)
                    {
                        mainHandAngle += PropsOversized.angleAdjustmentWest;
                    }
                    offHandAngle = mainHandAngle;
                }
                else
                {
                    if (thing.Rotation == Rot4.North)
                    {
                        if (!mainHandAiming)
                        {
                            offsetMainHand.x = offset.x + (Dual ? (Melee ? meleeXOffset : rangedXOffset) : 0);
                            offsetOffHand.x  = -offset.x + (Melee ? -meleeXOffset : -rangedXOffset);
                            offsetMainHand.z = offset.z + (Dual ? (Melee ? meleeZOffset : rangedZOffset) : 0);
                            offsetOffHand.z  = offset.z + (Melee ? meleeZOffset : rangedZOffset);
                            if (PropsOversized != null)
                            {
                                offHandAngle  = PropsOversized.angleAdjustmentNorth + (Melee ? meleeAngle : rangedAngle);
                                mainHandAngle = -PropsOversized.angleAdjustmentNorth + (Melee ? num : num2);
                            }
                        }
                        else
                        {
                            offsetOffHand.x = -0.1f;
                        }
                    }
                    else
                    {
                        if (!mainHandAiming)
                        {
                            offsetMainHand.y = 1f;
                            offsetMainHand.x = -offset.x + (Dual ? (Melee ? -meleeXOffset : -rangedXOffset) : 0);
                            offsetOffHand.x  = offset.x + (Melee ? meleeXOffset : rangedXOffset);
                            offsetMainHand.z = offset.z + (Dual ? (Melee ? meleeZOffset : rangedZOffset) : 0);
                            offsetOffHand.z  = offset.z + (Melee ? meleeZOffset : rangedZOffset);
                            if (PropsOversized != null)
                            {
                                offHandAngle  = -PropsOversized.angleAdjustmentSouth + (Melee ? num : num2);
                                mainHandAngle = PropsOversized.angleAdjustmentSouth + (Melee ? meleeAngle : rangedAngle);
                            }
                        }
                        else
                        {
                            offsetOffHand.y = 1f;
                            offHandAngle    = (!Melee ? num : num2);
                            offsetOffHand.x = 0.1f;
                        }
                    }
                }
            }
            if (!thing.Rotation.IsHorizontal)
            {
                if (compOversized.Props != null)
                {
                    /*
                     *
                     * offHandAngle += (float)((pawn.Rotation == Rot4.North) ? record.extraRotation : (-(float)record.extraRotation));
                     * mainHandAngle += (float)((pawn.Rotation == Rot4.North) ? (-(float)compOversized.extraRotation) : compOversized.extraRotation);
                     */
                }
            }
        }