Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Tacos Cleaner v1.0.1
TacosCleaner.dll
Decompiled 14 minutes agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using CleanerUnstuck; using HarmonyLib; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Employees; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Trash; using Il2CppSystem.Collections.Generic; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Mod), "Tacos Cleaner", "1.0.1", "Taco", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("TacosCleaner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TacosCleaner")] [assembly: AssemblyTitle("TacosCleaner")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CleanerUnstuck { public class Mod : MelonMod { private class Track { public int TargetId; public float Start; public float BestDist; public float BestTime; } private const float TickSeconds = 1f; private const float StallSeconds = 8f; private const float MaxTaskSeconds = 90f; private const float GrabReach = 4f; private const float SkipSeconds = 600f; private const float StatusEvery = 120f; private static readonly Dictionary<int, float> Skipped = new Dictionary<int, float>(); private readonly Dictionary<int, Track> _tracks = new Dictionary<int, Track>(); private readonly Dictionary<int, int> _forceCount = new Dictionary<int, int>(); private readonly List<Cleaner> _cleaners = new List<Cleaner>(); private float _nextTick; private float _nextScan; private float _nextStatus; private int _grabbed; private int _skipped; public override void OnInitializeMelon() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(typeof(TrashContainerItem), "AddTrashToRadius", (Type[])null, (Type[])null); ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Mod), "AddTrashPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((MelonBase)this).LoggerInstance.Msg("Ready: stuck cleaners grab trash within " + 4f + " m or skip it for " + 10f + " min."); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Could not patch AddTrashToRadius (skipping still works, less tidy): " + ex.Message); } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { _tracks.Clear(); _forceCount.Clear(); _cleaners.Clear(); Skipped.Clear(); _nextScan = 0f; _nextStatus = Time.time + 30f; } public static bool AddTrashPrefix(TrashItem trashItem) { try { if ((Object)(object)trashItem == (Object)null) { return true; } if (Skipped.TryGetValue(((Object)trashItem).GetInstanceID(), out var value)) { if (Time.time < value) { return false; } Skipped.Remove(((Object)trashItem).GetInstanceID()); } } catch { } return true; } public override void OnUpdate() { float time = Time.time; if (time < _nextTick) { return; } _nextTick = time + 1f; try { if (!InstanceFinder.IsServer) { return; } if (time >= _nextScan) { Scan(); _nextScan = time + 10f; } foreach (Cleaner cleaner in _cleaners) { try { Check(cleaner, time); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("check failed: " + ex.Message); } } if (time >= _nextStatus) { Status(); _nextStatus = time + 120f; } } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Warning("tick failed: " + ex2.Message); } } private void Scan() { _cleaners.Clear(); Il2CppReferenceArray<Object> val = Object.FindObjectsOfType(Il2CppType.Of<Cleaner>()); if (val == null) { return; } foreach (Object item in (Il2CppArrayBase<Object>)(object)val) { Cleaner val2 = ((item != null) ? ((Il2CppObjectBase)item).TryCast<Cleaner>() : null); if ((Object)(object)val2 != (Object)null) { _cleaners.Add(val2); } } } private void Check(Cleaner c, float now) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null) { return; } int instanceID = ((Object)c).GetInstanceID(); PickUpTrashBehaviour pickUpTrashBehaviour = c.PickUpTrashBehaviour; TrashItem val = (((Object)(object)pickUpTrashBehaviour != (Object)null && ((Behaviour)pickUpTrashBehaviour).Active) ? pickUpTrashBehaviour.TargetTrash : null); if ((Object)(object)val == (Object)null) { _tracks.Remove(instanceID); return; } int instanceID2 = ((Object)val).GetInstanceID(); float num = Vector3.Distance(((Component)c).transform.position, ((Component)val).transform.position); if (!_tracks.TryGetValue(instanceID, out var value) || value.TargetId != instanceID2) { value = new Track { TargetId = instanceID2, Start = now, BestDist = num, BestTime = now }; _tracks[instanceID] = value; return; } if (num < value.BestDist - 0.5f) { value.BestDist = num; value.BestTime = now; } bool num2 = now - value.BestTime >= 8f; bool flag = now - value.Start >= 90f; if (!num2 && !flag) { return; } _forceCount.TryGetValue(instanceID2, out var value2); string text = val.ID + " " + num.ToString("F1") + " m away"; if (num <= 4f && value2 < 2) { _forceCount[instanceID2] = value2 + 1; NPCMovement movement = ((NPC)c).Movement; if (movement != null) { movement.Stop(); } pickUpTrashBehaviour.PerformAction(); _grabbed++; ((MelonBase)this).LoggerInstance.Msg(Name(c) + " was stuck on " + text + " for " + (now - value.Start).ToString("F0") + " s: grabbed it."); value.Start = now; value.BestTime = now; value.BestDist = num; return; } Skipped[instanceID2] = now + 600f; CleanerConfiguration configuration = c.configuration; List<TrashContainerItem> val2 = ((configuration != null) ? configuration.binItems : null); if (val2 != null) { for (int i = 0; i < val2.Count; i++) { TrashContainerItem val3 = val2[i]; if ((Object)(object)val3 != (Object)null && val3.TrashItemsInRadius != null && val3.TrashItemsInRadius.Contains(val)) { val3.RemoveTrashItemFromRadius(val); } } } _tracks.Remove(instanceID); _skipped++; ((Behaviour)pickUpTrashBehaviour).Disable_Networked((NetworkConnection)null); ((MelonBase)this).LoggerInstance.Msg(Name(c) + " can't reach " + text + ": skipping it for " + 10f + " min."); } private void Status() { foreach (Cleaner cleaner in _cleaners) { try { if ((Object)(object)cleaner == (Object)null) { continue; } CleanerConfiguration configuration = cleaner.configuration; List<TrashContainerItem> val = ((configuration != null) ? configuration.binItems : null); int num = val?.Count ?? 0; HashSet<int> hashSet = new HashSet<int>(); if (val != null) { for (int i = 0; i < val.Count; i++) { TrashContainerItem obj = val[i]; List<TrashItem> val2 = ((obj != null) ? obj.TrashItemsInRadius : null); if (val2 == null) { continue; } for (int j = 0; j < val2.Count; j++) { if ((Object)(object)val2[j] != (Object)null) { hashSet.Add(((Object)val2[j]).GetInstanceID()); } } } } int count = hashSet.Count; PickUpTrashBehaviour pickUpTrashBehaviour = cleaner.PickUpTrashBehaviour; string text = (((Object)(object)pickUpTrashBehaviour != (Object)null && ((Behaviour)pickUpTrashBehaviour).Active && (Object)(object)pickUpTrashBehaviour.TargetTrash != (Object)null) ? ("picking up " + pickUpTrashBehaviour.TargetTrash.ID) : "not picking up"); ((MelonBase)this).LoggerInstance.Msg("[status] " + Name(cleaner) + ": " + num + " cans, " + count + " trash in their areas, grabber " + cleaner.GetTrashGrabberAmount() + ", " + text + "."); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("status failed: " + ex.Message); } } if (_grabbed + _skipped > 0) { ((MelonBase)this).LoggerInstance.Msg("[status] so far: " + _grabbed + " stuck pickups grabbed, " + _skipped + " unreachable pieces skipped."); } } private static string Name(Cleaner c) { try { return ((NPC)c).FirstName + " " + ((NPC)c).LastName; } catch { return "cleaner"; } } } }