Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of CrossProperty Transportation IL2CPP v1.0.1
CrossPropertyTransport.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using CrossPropertyTransport; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Employees; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Management; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(global::CrossPropertyTransport.CrossPropertyTransport), "CrossPropertyTransport", "1.0.1", "NanobotZ", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("CrossPropertyTransport")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CrossPropertyTransport")] [assembly: AssemblyTitle("CrossPropertyTransport")] [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 CrossPropertyTransport { public class CrossPropertyTransport : MelonMod { internal static List<Property> teleportProperties; internal static Vector3 playerTeleportPosition; internal static Vector3 playerTeleportForward; internal static int? playerTeleportIndex; internal static bool PlayerWasTeleporting => playerTeleportIndex.HasValue; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Initialized."); } public override void OnUpdate() { HandleTeleportLogic(); } private static void HandleTeleportLogic() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (teleportProperties == null) { return; } int num = 0; if (Input.GetKeyDown((KeyCode)273)) { num = 1; } if (Input.GetKeyDown((KeyCode)274)) { num = -1; } if (num == 0) { return; } if (!playerTeleportIndex.HasValue) { if (num > 0) { playerTeleportIndex = 1; } else { playerTeleportIndex = teleportProperties.Count - 1; } } else { playerTeleportIndex += num; if (playerTeleportIndex >= teleportProperties.Count) { playerTeleportIndex = 0; } else if (playerTeleportIndex < 0) { playerTeleportIndex = teleportProperties.Count - 1; } } Property property = teleportProperties[playerTeleportIndex.Value]; Transform propertyCrossTransform = Helpers.GetPropertyCrossTransform(null, property); PlayerSingleton<PlayerMovement>.Instance.Teleport(propertyCrossTransform.position + Vector3.up * 1f); ((Component)Player.Local).transform.forward = propertyCrossTransform.forward * -1f; } internal static void OpenManagementUI() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) List<Property> list = new List<Property>(); Enumerator<Property> enumerator = Property.OwnedProperties.GetEnumerator(); while (enumerator.MoveNext()) { Property current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { list.Add(current); } } if (list.Count > 1) { teleportProperties = list; playerTeleportPosition = ((Component)Player.Local).transform.position; playerTeleportForward = ((Component)Player.Local).transform.forward; } } internal static void CloseManagementUI() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (PlayerWasTeleporting) { PlayerSingleton<PlayerMovement>.Instance.Teleport(playerTeleportPosition); ((Component)Player.Local).transform.forward = playerTeleportForward; playerTeleportIndex = null; } teleportProperties = null; } } internal static class Helpers { private static readonly Dictionary<string, Transform> propertyCrossTransformDict; static Helpers() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) propertyCrossTransformDict = new Dictionary<string, Transform>(); CreateCrossPlatformGameObject("RV", new Vector3(11.543796f, 0.970375f, -75.74756f), new Vector3(-0.020820871f, -0.047304332f, 0.9986635f)); CreateCrossPlatformGameObject("MotelRoom", new Vector3(-66.22975f, 1.6867679f, 82.86325f), new Vector3(0.99759513f, -0.0008907849f, 0.06930524f)); CreateCrossPlatformGameObject("Sweatshop", new Vector3(-60.897114f, -3.034998f, 146.39929f), new Vector3(0.7232971f, -0.008608431f, 0.6904833f)); CreateCrossPlatformGameObject("Bungalow", new Vector3(-160.01097f, -3.0348783f, 114.80028f), new Vector3(0.9974299f, 0.0034683319f, 0.07156569f)); CreateCrossPlatformGameObject("Barn", new Vector3(177.10942f, 0.96622044f, -8.631995f), new Vector3(-0.9965599f, 0.02527189f, -0.078929305f)); CreateCrossPlatformGameObject("DocksWarehouse", new Vector3(-73.51609f, -1.455f, -55.68945f), new Vector3(0.99936974f, -0.015709592f, 0.03183621f)); CreateCrossPlatformGameObject("Manor", new Vector3(161.44713f, 10.99f, -74.11461f), new Vector3(0.32149658f, -0.061523672f, -0.94491005f)); } private static void CreateCrossPlatformGameObject(string name, Vector3 position, Vector3 forward) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name + "_CrossPlatform"); Object.DontDestroyOnLoad((Object)(object)val); val.transform.position = position; val.transform.forward = forward; propertyCrossTransformDict.Add(name, val.transform); } internal static Transform GetCrossTransform(Employee employee, BuildableItem buildableItem) { if ((Object)(object)buildableItem == (Object)null || (Object)(object)buildableItem.ParentProperty == (Object)null) { return null; } if ((Object)(object)employee == (Object)null) { return null; } if ((Object)(object)employee.AssignedProperty == (Object)(object)buildableItem.ParentProperty) { return null; } return GetPropertyCrossTransform(employee, employee.AssignedProperty); } internal static Transform GetPropertyCrossTransform(Employee employee, Property property) { if (propertyCrossTransformDict.TryGetValue(((Object)((Component)property).gameObject).name, out var value)) { return value; } Melon<CrossPropertyTransport>.Logger.Msg("Property '" + ((Object)((Component)property).gameObject).name + "' doesn't have a predetermined CrossTransform, using NPC's idle point"); if ((Object)(object)employee != (Object)null) { IdleBehaviour waitOutside = employee.WaitOutside; Transform val = ((waitOutside != null) ? waitOutside.IdlePoint : null) ?? null; if ((Object)(object)val != (Object)null) { return val; } Melon<CrossPropertyTransport>.Logger.Msg("NPC doesn't have an idle point, using NPC's current positon"); return ((Component)employee).transform; } return property.NPCSpawnPoint; } } [HarmonyPatch(typeof(ObjectSelector), "IsObjectTypeValid")] public static class Patch_ObjectSelector_IsObjectTypeValid { internal static void Postfix(ref string reason, ref bool __result) { if (reason == "Wrong property") { reason = string.Empty; __result = true; } } } [HarmonyPatch(typeof(MoveItemBehaviour), "GetSourceAccessPoint")] public static class Patch_MoveItemBehaviour_GetSourceAccessPoint { internal static bool Prefix(MoveItemBehaviour __instance, ref Transform __result, TransitRoute route) { if (route.Source == null) { return true; } BuildableItem buildableItem = ((Il2CppObjectBase)route.Source).TryCast<BuildableItem>(); Transform crossTransform = Helpers.GetCrossTransform(((Il2CppObjectBase)((Behaviour)__instance).Npc).TryCast<Employee>(), buildableItem); if ((Object)(object)crossTransform != (Object)null) { __result = crossTransform; return false; } return true; } } [HarmonyPatch(typeof(MoveItemBehaviour), "GetDestinationAccessPoint")] public static class Patch_MoveItemBehaviour_GetDestinationAccessPoint { internal static bool Prefix(MoveItemBehaviour __instance, ref Transform __result, TransitRoute route) { if (route.Destination == null) { return true; } BuildableItem buildableItem = ((Il2CppObjectBase)route.Destination).TryCast<BuildableItem>(); Transform crossTransform = Helpers.GetCrossTransform(((Il2CppObjectBase)((Behaviour)__instance).Npc).TryCast<Employee>(), buildableItem); if ((Object)(object)crossTransform != (Object)null) { __result = crossTransform; return false; } return true; } } [HarmonyPatch(typeof(MoveItemBehaviour), "IsAtSource")] public static class Patch_MoveItemBehaviour_IsAtSource { internal static bool Prefix(MoveItemBehaviour __instance, ref bool __result) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) TransitRoute assignedRoute = __instance.assignedRoute; if (((assignedRoute != null) ? assignedRoute.Destination : null) == null) { return true; } BuildableItem buildableItem = ((Il2CppObjectBase)__instance.assignedRoute.Source).TryCast<BuildableItem>(); Transform crossTransform = Helpers.GetCrossTransform(((Il2CppObjectBase)((Behaviour)__instance).Npc).TryCast<Employee>(), buildableItem); if ((Object)(object)crossTransform != (Object)null) { __result = Vector3.Distance(crossTransform.position, ((Component)((Behaviour)__instance).Npc).transform.position) <= 2f; return false; } return true; } } [HarmonyPatch(typeof(MoveItemBehaviour), "IsAtDestination")] public static class Patch_MoveItemBehaviour_IsAtDestination { internal static bool Prefix(MoveItemBehaviour __instance, ref bool __result) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) TransitRoute assignedRoute = __instance.assignedRoute; if (((assignedRoute != null) ? assignedRoute.Destination : null) == null) { return true; } BuildableItem buildableItem = ((Il2CppObjectBase)__instance.assignedRoute.Destination).TryCast<BuildableItem>(); Transform crossTransform = Helpers.GetCrossTransform(((Il2CppObjectBase)((Behaviour)__instance).Npc).TryCast<Employee>(), buildableItem); if ((Object)(object)crossTransform != (Object)null) { __result = Vector3.Distance(crossTransform.position, ((Component)((Behaviour)__instance).Npc).transform.position) <= 2f; return false; } return true; } } [HarmonyPatch(typeof(NPCMovement), "CanGetTo", new Type[] { typeof(ITransitEntity), typeof(float) })] public static class Patch_NPCMovement_CanGetTo { public static bool Prefix(NPCMovement __instance, ref bool __result, ITransitEntity entity) { Packager val = ((Il2CppObjectBase)__instance.npc).TryCast<Packager>(); if ((Object)(object)val == (Object)null) { return true; } BuildableItem val2 = ((Il2CppObjectBase)entity).TryCast<BuildableItem>(); if ((Object)(object)val2 == (Object)null) { return true; } if ((Object)(object)((Employee)val).AssignedProperty == (Object)(object)val2.ParentProperty) { return true; } __result = true; return false; } } [HarmonyPatch(typeof(ObjectSelector), "Open")] public static class Patch_ObjectSelector_Open { public static void Postfix(ObjectSelector __instance) { if (__instance.selectionTitle != null) { string text = __instance.selectionTitle.ToLower(); if (text.Contains("source") || text.Contains("destination")) { __instance.selectionTitle += "<br><br>Use UP/DOWN arrow key<br>to teleport to other properties"; __instance.UpdateInstructions(); CrossPropertyTransport.OpenManagementUI(); } } } } [HarmonyPatch(typeof(ObjectSelector), "Close")] public static class Patch_ObjectSelector_Close { public static void Prefix() { CrossPropertyTransport.CloseManagementUI(); } } [HarmonyPatch(typeof(TransitEntitySelector), "Open")] public static class Patch_TransitEntitySelector_Open { public static void Postfix(TransitEntitySelector __instance) { __instance.selectionTitle += "<br><br>Use UP/DOWN arrow key<br>to teleport to other properties"; __instance.UpdateInstructions(); CrossPropertyTransport.OpenManagementUI(); } } [HarmonyPatch(typeof(TransitEntitySelector), "Close")] public static class Patch_TransitEntitySelector_Close { public static void Prefix() { CrossPropertyTransport.CloseManagementUI(); } } [HarmonyPatch(typeof(HUD), "ShowTopScreenText")] public static class Patch_HUD_ShowTopScreenText { internal static bool Prefix(HUD __instance, string t) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)__instance.topScreenText).text = t; __instance.topScreenText_Background.sizeDelta = new Vector2(((TMP_Text)__instance.topScreenText).preferredWidth + 30f, ((TMP_Text)__instance.topScreenText).preferredHeight + 30f); ((Component)__instance.topScreenText_Background).gameObject.SetActive(true); return false; } } }