Example #1
0
        static void Postfix(bool __result, string ___m_rightItem, ref GameObject ___m_rightItemInstance)
        {
            if (!__result || ___m_rightItemInstance == null)
            {
                return;
            }

            MeshFilter meshFilter = ___m_rightItemInstance.GetComponentInChildren <MeshFilter>();

            if (meshFilter == null)
            {
                return;
            }

            Player player = ___m_rightItemInstance.GetComponentInParent <Player>();

            if (player == null)
            {
                return;
            }

            var vrPlayerSync = player.GetComponent <VRPlayerSync>();

            if (vrPlayerSync != null)
            {
                player.GetComponent <VRPlayerSync>().currentRightWeapon      = meshFilter.gameObject;
                player.GetComponent <VRPlayerSync>().currentRightWeapon.name = ___m_rightItem;
                VrikCreator.resetVrikHandTransform(player);
            }

            if (Player.m_localPlayer != player || !VHVRConfig.UseVrControls())
            {
                return;
            }

            if (StaticObjects.quickSwitch != null)
            {
                StaticObjects.quickSwitch.GetComponent <QuickSwitch>().refreshItems();
                StaticObjects.quickActions.GetComponent <QuickActions>().refreshItems();
            }

            switch (EquipScript.getRight())
            {
            case EquipType.Fishing:
                meshFilter.gameObject.AddComponent <FishingManager>();
                return;

            case EquipType.Spear:
            case EquipType.SpearChitin:
                meshFilter.gameObject.AddComponent <SpearManager>();
                // (no return, we want collider for spear also)
                break;
            }

            StaticObjects.rightWeaponCollider().GetComponent <WeaponCollision>().setColliderParent(meshFilter.transform, ___m_rightItem, true);
            ParticleFix.maybeFix(___m_rightItemInstance);
        }
Example #2
0
        static bool Prefix(ref Transform __result, ref Humanoid ___m_character)
        {
            if (___m_character != Player.m_localPlayer || !VHVRConfig.UseVrControls())
            {
                return(true);
            }

            __result = StaticObjects.rightWeaponCollider().transform;
            return(false);
        }