Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of AreaTrashGrabber Mono v1.0.0
AreaTrashGrabber.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AreaTrashGrabberMono; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using ScheduleOne.DevUtilities; using ScheduleOne.Equipping; using ScheduleOne.Interaction; using ScheduleOne.Trash; using UnityEngine; using UnityEngine.Rendering.Universal; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(AreaTrashGrabber), "AreaTrashGrabber", "1.0.0", "NanobotZ", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AreaTrashGrabber")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AreaTrashGrabber")] [assembly: AssemblyTitle("AreaTrashGrabber")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 AreaTrashGrabberMono { public class AreaTrashGrabber : MelonMod { internal static AreaTrashGrabber Instance; internal static DecalProjector PickupAreaProjector; private MelonPreferences_Category config; internal MelonPreferences_Entry<float> configPickupRadius; internal MelonPreferences_Entry<bool> configAllowOverfilling; internal MelonPreferences_Entry<bool> configRemoveCapacityLimit; public static float PickupRadius => Instance.configPickupRadius.Value; public static float PickupRadiusSquared => PickupRadius * PickupRadius; public static bool AllowOverfilling => Instance.configAllowOverfilling.Value; public static bool RemoveCapacityLimit => Instance.configRemoveCapacityLimit.Value; public override void OnInitializeMelon() { Instance = this; config = MelonPreferences.CreateCategory("AreaTrashGrabber"); config.SetFilePath("UserData/AreaTrashGrabber.cfg"); configPickupRadius = config.CreateEntry<float>("PickupRadius", 1f, "Pickup Radius", (string)null, false, false, (ValueValidator)null, (string)null); configAllowOverfilling = config.CreateEntry<bool>("AllowOverfilling", false, "Allow Overfilling", (string)null, false, false, (ValueValidator)null, (string)null); configRemoveCapacityLimit = config.CreateEntry<bool>("RemoveCapacityLimit", false, "Remove Capacity Limit", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonBase)this).LoggerInstance.Msg("Initialized."); } } [HarmonyPatch(typeof(Equippable_TrashGrabber), "Update")] public static class Patch_EquippableTrashGrabber_Update { internal static void Postfix() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AreaTrashGrabber.PickupAreaProjector == (Object)null) { return; } if ((Object)(object)Singleton<InteractionManager>.Instance.hoveredValidInteractableObject == (Object)null) { ((Component)AreaTrashGrabber.PickupAreaProjector).gameObject.SetActive(false); return; } TrashItem component = ((Component)Singleton<InteractionManager>.Instance.hoveredValidInteractableObject).GetComponent<TrashItem>(); if ((Object)(object)component == (Object)null || !component.CanGoInContainer) { ((Component)AreaTrashGrabber.PickupAreaProjector).gameObject.SetActive(false); return; } float num = Mathf.Abs(AreaTrashGrabber.PickupRadius) / 0.45f; AreaTrashGrabber.PickupAreaProjector.size = new Vector3(num, num, 0.5f); ((Component)AreaTrashGrabber.PickupAreaProjector).transform.position = ((Component)component).transform.position; ((Component)AreaTrashGrabber.PickupAreaProjector).gameObject.SetActive(true); } } [HarmonyPatch(typeof(Equippable_TrashGrabber), "Equip")] public static class Patch_EquippableTrashGrabber_Equip { internal static void Postfix() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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)AreaTrashGrabber.PickupAreaProjector == (Object)null) { AreaTrashGrabber.PickupAreaProjector = Object.Instantiate<DecalProjector>(Resources.FindObjectsOfTypeAll<TrashBag_Equippable>().FirstOrDefault().PickupAreaProjector); ((Component)AreaTrashGrabber.PickupAreaProjector).transform.SetParent(NetworkSingleton<GameManager>.Instance.Temp); ((Component)AreaTrashGrabber.PickupAreaProjector).transform.localScale = Vector3.one; ((Component)AreaTrashGrabber.PickupAreaProjector).transform.forward = -Vector3.up; ((Component)AreaTrashGrabber.PickupAreaProjector).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(Equippable_TrashGrabber), "Unequip")] public static class Patch_EquippableTrashGrabber_Unequip { internal static void Postfix() { if (!((Object)(object)AreaTrashGrabber.PickupAreaProjector == (Object)null)) { ((Component)AreaTrashGrabber.PickupAreaProjector).gameObject.SetActive(false); Object.Destroy((Object)(object)AreaTrashGrabber.PickupAreaProjector); AreaTrashGrabber.PickupAreaProjector = null; } } } [HarmonyPatch(typeof(Equippable_TrashGrabber), "PickupTrash")] public static class Patch_EquippableTrashGrabber_PickupTrash { private struct TrashItemDistance { public TrashItem item; public float distanceSquared; public TrashItemDistance(TrashItem item, float distanceSquared) { this.item = item; this.distanceSquared = distanceSquared; } } private static readonly FieldInfo trashItemsFieldInfo = typeof(TrashManager).GetField("trashItems", BindingFlags.Instance | BindingFlags.NonPublic); private static bool DontRun = false; internal static void Postfix(Equippable_TrashGrabber __instance, TrashItem item) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (DontRun) { return; } try { DontRun = true; List<TrashItemDistance> list = new List<TrashItemDistance>(); float pickupRadiusSquared = AreaTrashGrabber.PickupRadiusSquared; bool allowOverfilling = AreaTrashGrabber.AllowOverfilling; foreach (TrashItem item2 in (List<TrashItem>)trashItemsFieldInfo.GetValue(NetworkSingleton<TrashManager>.Instance)) { if (!(item.GUID == item2.GUID) && item2.CanGoInContainer) { Vector3 val = ((Component)item2).transform.position - ((Component)item).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude > pickupRadiusSquared)) { list.Add(new TrashItemDistance(item2, sqrMagnitude)); } } } Melon<AreaTrashGrabber>.Logger.Msg($"Picking up {list.Count + 1} trash items."); int num = 1; foreach (TrashItemDistance item3 in list.OrderBy((TrashItemDistance x) => x.distanceSquared)) { __instance.PickupTrash(item3.item); num++; if (!allowOverfilling && __instance.GetCapacity() <= 0) { Melon<AreaTrashGrabber>.Logger.Msg($"Picked up only {num} items - bin is full."); break; } } } finally { DontRun = false; } } } [HarmonyPatch(typeof(Equippable_TrashGrabber), "GetCapacity")] public static class Patch_EquippableTrashGrabber_GetCapacity { internal static bool Prefix(ref int __result) { if (AreaTrashGrabber.RemoveCapacityLimit) { __result = int.MaxValue; return false; } return true; } } }