private GameObject UpdateCurrentGameObj(GameObject obj)
        {
            if (obj != null)
            {
                m_currentGameObj       = obj;
                m_currentFVRObj        = null;
                m_currentFVRPhysObj    = null;
                m_currentItemSpawnerID = null;

                if (m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>() != null)
                {
                    m_currentFVRPhysObj    = m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>();
                    m_currentFVRObj        = m_currentFVRPhysObj.ObjectWrapper;
                    m_currentItemSpawnerID = m_currentFVRPhysObj.IDSpawnedFrom;

#if !UNITY_EDITOR && !UNITY_STANDALONE
                    if (m_currentFVRObj != null && IM.HasSpawnedID(m_currentFVRObj.SpawnedFromId))
                    {
                        m_currentItemSpawnerID = IM.GetSpawnerID(m_currentFVRObj.SpawnedFromId);
                    }
#endif
                }
                SpawnerRefreshElements();
            }

            return(m_currentGameObj);
        }
Beispiel #2
0
        public void Update()
        {
            if (Helpers.BepInExGetKeyDown(_shortcutPrintLayerAndTagsInfo.Value))
            {
                string LayerNames = "Layers:";
                for (int i = 0; i < 32; i++)
                {
                    LayerNames += $"\n{i} - {LayerMask.LayerToName(i)}";
                }
                Debug.Log(LayerNames);

                string LayerCollisions = "Layer Collisions: (+ for ignoring)\n";
                LayerCollisions += "   |  0|  1|  2|  3|  4|  5|  6|  7|  8|  9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31|";
                for (int i = 0; i < 32; i++)
                {
                    LayerCollisions += $"\n{i,3}|";
                    for (int j = 0; j < 32; j++)
                    {
                        LayerCollisions += !Physics.GetIgnoreLayerCollision(2 ^ i, 2 ^ j) ? " + |" : "   |";
                    }
                }
                Debug.Log(LayerCollisions);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutPrintAllStreamingAssetsBundles.Value))
            {
                string ootpoot = "";

                foreach (string assBundle in System.IO.Directory.GetFiles(Application.streamingAssetsPath))
                {
                    if (!assBundle.Contains("."))
                    {
                        AssetBundle asset = AnvilManager.GetBundleAsync(System.IO.Path.GetFileName(assBundle)).Result;
                        if (asset != null)
                        {
                            string[] names = System.IO.Path.GetFileName(assBundle).Split(new[] { "_" }, StringSplitOptions.None);
                            string   name  = names[names.Length - 1];
                            ootpoot += $"{name}: {string.Join($"\n{name}: ", asset.GetAllAssetNames())}\n\n\n";
                        }
                    }
                }

                foreach (System.Collections.Generic.KeyValuePair <string, ItemSpawnerID> kvp in (System.Collections.Generic.Dictionary <string, ItemSpawnerID>)AccessTools.Field(typeof(IM), "SpawnerIDDic").GetValue(ManagerSingleton <IM> .Instance))
                {
                    ootpoot += $"{kvp.Key} - {kvp.Value}\n";
                }

                Debug.Log(ootpoot);
            }

            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToReset.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(GM.CurrentSceneSettings.DeathResetPoint.position, true);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayer2mForward.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(GM.CurrentPlayerRoot.position + (GM.CurrentPlayerBody.Head.forward * 2.0f), true);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToOrigin.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(Vector3.zero, true);
            }

            else if (Helpers.BepInExGetKeyDown(_shortcutSpawnModPanelV2.Value))
            {
                ItemSpawnerID id = IM.GetSpawnerID("MiscUtModPanelV2");
                if (id != null)
                {
                    GameObject panel = Instantiate(id.MainObject.GetGameObject(), new Vector3(0f, .25f, 0f) + GM.CurrentPlayerRoot.position, Quaternion.identity);
                    if (GM.CurrentPlayerBody.QuickbeltSlots.Count > 0)
                    {
                        foreach (FVRQuickBeltSlot qbSlot in GM.CurrentPlayerBody.QuickbeltSlots)
                        {
                            if (qbSlot.HeldObject == null && qbSlot.CurObject == null)
                            {
                                panel.GetComponent <FVRPhysicalObject>().SetQuickBeltSlot(qbSlot);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    Logger.LogError("ModPanelV2 was null?");
                }
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMaterials.Value))
            {
                foreach (Renderer mr in UnityEngine.Object.FindObjectsOfType(typeof(UnityEngine.Renderer)))
                {
                    mr.material = (Resources.FindObjectsOfTypeAll(typeof(Material))[UnityEngine.Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Material)).Length)] as Material);
                }
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMeshes.Value))
            {
                foreach (MeshFilter mf in UnityEngine.Object.FindObjectsOfType(typeof(UnityEngine.MeshFilter)))
                {
                    mf.mesh = (Resources.FindObjectsOfTypeAll(typeof(Mesh))[UnityEngine.Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length)] as Mesh);
                }
            }
        }