diff --git a/BuildingTools/BuildingTools.cs b/BuildingTools/BuildingTools.cs
index dda2e65..aac6bce 100644
--- a/BuildingTools/BuildingTools.cs
+++ b/BuildingTools/BuildingTools.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using DataLoader;
+using HarmonyLib;
using TechbloxModdingAPI;
using TechbloxModdingAPI.Blocks;
using TechbloxModdingAPI.Commands;
@@ -237,6 +239,14 @@ namespace BuildingTools
ScalingPermission.NonUniform;
Logging.CommandLog("Free scaling enabled for " + blockID + " until the game is restarted.");
}).Build();
+ var noGarage = new NoGarageCommand();
+ CommandBuilder.Builder("noGarage", "Disables the environment switching and allows building on the track.")
+ .Action(() =>
+ {
+ noGarage.Toggle();
+ }).Build();
+
+ new Harmony("BuildTools").PatchAll(Assembly.GetExecutingAssembly());
}
private string GetBlockInfo()
diff --git a/BuildingTools/BuildingTools.csproj b/BuildingTools/BuildingTools.csproj
index 913627a..491d59d 100644
--- a/BuildingTools/BuildingTools.csproj
+++ b/BuildingTools/BuildingTools.csproj
@@ -37,6 +37,10 @@
..\ref\Plugins\TechbloxModdingAPI.dll
..\..\ref\Plugins\TechbloxModdingAPI.dll
+
+ ..\ref\Plugins\0Harmony.dll
+ ..\..\ref\Plugins\0Harmony.dll
+
..\ref\TechbloxPreview_Data\Managed\IllusionInjector.dll
..\..\ref\TechbloxPreview_Data\Managed\IllusionInjector.dll
diff --git a/BuildingTools/NoGarageCommand.cs b/BuildingTools/NoGarageCommand.cs
new file mode 100644
index 0000000..a0bd29e
--- /dev/null
+++ b/BuildingTools/NoGarageCommand.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Reflection;
+using HarmonyLib;
+using UnityEngine;
+
+namespace BuildingTools
+{
+ public class NoGarageCommand
+ {
+ private static bool _enabled;
+
+ public void Toggle()
+ {
+ Console.WriteLine("Toggling no garage");
+ if(_enabled = !_enabled)
+ Enable();
+ Console.WriteLine($"{(_enabled ? "Enabled" : "Disabled")} no garage");
+ }
+
+ private void Enable()
+ {
+ var type = AccessTools.TypeByName("Techblox.Environment.Temporary.EnvironmentSwitchEngine");
+ var simObj = (GameObject)AccessTools.Field(type,
+ "THIS_IS_TEMPORARY_CODE_IT_IS_GOING_TO_BE_DELETED_ONCE_WE_HAVE_THE_FINAL_WORLD_SWITCHING_sim_go")
+ .GetValue(null);
+ /*var buildObjField = AccessTools.Field(type,
+ "THIS_IS_TEMPORARY_CODE_IT_IS_GOING_TO_BE_DELETED_ONCE_WE_HAVE_THE_FINAL_WORLD_SWITCHING_build_go");
+ var buildObj = (GameObject) buildObjField.GetValue(null);
+ Console.WriteLine($"obj: {simObj}");*/
+ var componentType = AccessTools.TypeByName("Techblox.Garage.GarageMachineBoundaryImplementor");
+ //var component = buildObj.GetComponent(componentType);
+ //var newBuildObj = Object.Instantiate(simObj);
+ simObj.AddComponent(componentType);
+ var component = simObj.GetComponent(componentType);
+ AccessTools.Field(componentType, "_bounds")
+ .SetValue(component, new Bounds(default, new Vector3(50, 2, 50)));
+ AccessTools.Field(componentType, "_padding")
+ .SetValue(component, 1f);
+ AccessTools.Field(componentType, "_cameraLookPointDistance")
+ .SetValue(component, 1f);
+ //buildObjField.SetValue(null, newBuildObj);
+ }
+
+ [HarmonyPatch]
+ private static class EnvironmentPatch
+ {
+ public static bool Prefix(object __instance)
+ {
+ if (!_enabled) return true;
+ Console.WriteLine("Got a time stopped init event");
+ AccessTools.Method("Techblox.Environment.Temporary.EnvironmentSwitchEngine:OnTimeRunningInitializationComplete")
+ .Invoke(__instance, Array.Empty