[HarmonyPatch(typeof(PrefabDatabase), "GetPrefabForFilename")] // method can be absent
        internal static bool GetPrefabForFilename_Prefix(string filename, ref GameObject __result)
        {
            if (!ModPrefab.TryGetFromFileName(filename, out ModPrefab prefab))
            {
                return(true);
            }

            __result = prefab.GetGameObjectInternal();
            return(false);
        }
Example #2
0
        internal static bool Prefix(ref UnityEngine.Object __result, string path)
        {
            if (ModPrefab.TryGetFromFileName(path, out ModPrefab prefab))
            {
                __result = prefab.GetGameObject();
                return(false);
            }

            return(true);
        }
Example #3
0
        internal static bool DeferredSpawner_AddressablesTask_Spawn_Prefix(DeferredSpawner.AddressablesTask __instance, ref IEnumerator __result)
        {
            if (!ModPrefab.TryGetFromFileName(__instance.key, out ModPrefab prefab))
            {
                return(true);
            }

            __result = SpawnAsyncReplacement(__instance, prefab);
            return(false);
        }
Example #4
0
        internal static bool Prefix_Async(ref UnityEngine.ResourceRequest __result, string path)
        {
            if (ModPrefab.TryGetFromFileName(path, out ModPrefab prefab))
            {
                __result = new UnityEngine.ResourceRequest();
                AssetsInfo.SetValue(__result, prefab.GetGameObject(), null);

                MPathInfo.SetValue(__result, path);
                MTypeInfo.SetValue(__result, prefab.GetGameObject().GetType());

                return(false);
            }

            return(true);
        }