static void Postfix(ClutterSystem __instance) { Dbgl($"Clutter system awake"); //stopwatch.Restart(); logDump.Clear(); Dbgl($"Checking {__instance.m_clutter.Count} clutters"); foreach (ClutterSystem.Clutter clutter in __instance.m_clutter) { ReplaceOneGameObjectTextures(clutter.m_prefab, clutter.m_prefab.name, "object"); } if (logDump.Any()) { Dbgl("\n" + string.Join("\n", logDump)); } if (ZNetScene.instance && dumpSceneTextures.Value) { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "CustomTextures", "scene_dump.txt"); Dbgl($"Writing {path}"); File.WriteAllLines(path, outputDump); } //LogStopwatch("Clutter System"); }
static void Prefix(ClutterSystem __instance) { if (!modEnabled.Value) { return; } __instance.m_amountScale *= amountMult.Value; __instance.m_distance = clutterDistance.Value; __instance.m_grassPatchSize = grassPatchSize.Value; __instance.m_playerPushFade = playerPushFade.Value; for (int i = 0; i < __instance.m_clutter.Count; i++) { __instance.m_clutter[i].m_scaleMin *= scaleMinMult.Value; __instance.m_clutter[i].m_scaleMax *= scaleMaxMult.Value; } }
static void Postfix(ClutterSystem __instance) { Dbgl($"Clutter system awake"); stopwatch.Restart(); logDump.Clear(); Dbgl($"Checking {__instance.m_clutter.Count} clutters"); foreach (ClutterSystem.Clutter clutter in __instance.m_clutter) { ReplaceOneGameObjectTextures(clutter.m_prefab, clutter.m_prefab.name, "object"); } if (logDump.Any()) { Dbgl("\n" + string.Join("\n", logDump)); } LogStopwatch("Clutter System"); }
static bool patchGeneratePatches(bool rebuildAll, UnityEngine.Vector3 center, ref float ___m_amountScale, ref float ___m_distance, ref float ___m_grassPatchSize, ClutterSystem __instance) { if (ClutterSystem.instance == null) { return(true); } ClutterSystem CS = ClutterSystem.instance; ___m_distance = 40f; ___m_grassPatchSize = 8f; ___m_amountScale = 1f; bool flag = false; UnityEngine.Vector2Int vegPatch = __instance.GetVegPatch(center); patchGeneratePatch(ClutterSystem.instance, center, vegPatch, ref flag, rebuildAll); int num = UnityEngine.Mathf.CeilToInt((___m_distance - ___m_grassPatchSize / 2f) / ___m_grassPatchSize); for (int i = 1; i <= num; i++) { Thread taOne = new Thread(new ThreadStart(() => { List <Thread> threads = new List <Thread>(); for (int j = vegPatch.x - i; j <= vegPatch.x + i; j++) { try { Thread taOnee = new Thread(new ThreadStart(() => { patchGeneratePatch(CS, center, new UnityEngine.Vector2Int(j, vegPatch.y - i), ref flag, rebuildAll); })); threads.Add(taOnee); taOnee.Start(); } catch (System.Exception e) { } } foreach (Thread t in threads) { t.Join(); } })); Thread taTwo = new Thread(new ThreadStart(() => { List <Thread> threads = new List <Thread>(); for (int k = vegPatch.y - i + 1; k <= vegPatch.y + i - 1; k++) { try { Thread taTwoo = new Thread(new ThreadStart(() => { patchGeneratePatch(CS, center, new UnityEngine.Vector2Int(vegPatch.x - i, k), ref flag, rebuildAll); })); threads.Add(taTwoo); taTwoo.Start(); } catch (System.Exception e) { } } foreach (Thread t in threads) { t.Join(); } })); Thread taThree = new Thread(new ThreadStart(() => { List <Thread> threads = new List <Thread>(); for (int j = vegPatch.x - i; j <= vegPatch.x + i; j++) { try { Thread taThreee = new Thread(new ThreadStart(() => { patchGeneratePatch(CS, center, new UnityEngine.Vector2Int(j, vegPatch.y + i), ref flag, rebuildAll); })); threads.Add(taThreee); taThreee.Start(); } catch (System.Exception e) { } } foreach (Thread t in threads) { t.Join(); } })); Thread taFour = new Thread(new ThreadStart(() => { List <Thread> threads = new List <Thread>(); for (int k = vegPatch.y - i + 1; k <= vegPatch.y + i - 1; k++) { try { Thread taFourr = new Thread(new ThreadStart(() => { patchGeneratePatch(CS, center, new UnityEngine.Vector2Int(vegPatch.x + i, k), ref flag, rebuildAll); })); threads.Add(taFourr); taFourr.Start(); } catch (System.Exception e) { } } foreach (Thread t in threads) { t.Join(); } })); taOne.Start(); taTwo.Start(); taThree.Start(); taFour.Start(); taOne.Join(); taTwo.Join(); taThree.Join(); taFour.Join(); } return(false); }
static void Prefix(ClutterSystem __instance) { __instance.m_distance = 1000; }