Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ASTRA228b/Gorilla-Time-V2/llms.txt

Use this file to discover all available pages before exploring further.

Gorilla Time V2 is a focused BepInEx plugin with a deliberately small footprint. The source is organized into three namespaces that map directly to the three concerns of any BepInEx plugin: the entry point, the runtime logic, and the infrastructure. Understanding where each piece lives makes it straightforward to navigate the codebase and know exactly which file to touch for any given change.

Directory tree

Gorilla-Time-V2/
├── ASTRAS BASIC ROOM JOINER.sln
└── ASTRAS BASIC ROOM JOINER/
    ├── Gorilla Time V2.csproj
    ├── Plugin.cs
    ├── Core/
    │   └── Main.cs
    └── Safe/
        ├── Constants.cs
        └── Patcher.cs

File roles

Plugin.cs — BepInEx entry point

Plugin.cs is the file BepInEx discovers and loads. The plugin class extends BaseUnityPlugin and is decorated with the [BepInPlugin] attribute, which registers the plugin’s GUID, display name, and version with the BepInEx framework. Awake() runs first and creates the persistent Main MonoBehaviour GameObject; DontDestroyOnLoad keeps it alive across scene transitions. Start() runs immediately after and calls Pacther.Apply() to initialize HarmonyX patching.
namespace Gorilla_Time.Plugin;

[BepInPlugin(Constantss.GUID, Constantss.Name, Constantss.Version)]
public class plugin : BaseUnityPlugin
{
    private void Start()
    {
        Pacther.Apply();
    }

    private void Awake()
    {
        GameObject TIME = new GameObject(Constantss.Name);
        TIME.AddComponent<Main>();
        DontDestroyOnLoad(TIME);
    }
}

Core/Main.cs — gameplay logic

Main.cs contains all runtime behavior. It is a MonoBehaviour attached to the persistent GameObject created in Plugin.cs. This file owns:
  • Time control — a TimeSettings enum (Morning, TenAM, Day, Evning, Night) and a SystemSwitch() method called from FixedUpdate() that maps each setting to a BetterDayNightManager.SetTimeOfDay() integer value.
  • Weather controlStartRain() and StopRain() methods that iterate over BetterDayNightManager.instance.weatherCycle and set each slot to WeatherType 1 (rain) or 0 (clear).
  • GUI rendering — an OnGUI() method that draws a draggable GUILayout.Window with toggle buttons for each time setting and buttons for weather. Styles are lazy-initialized on the first OnGUI call via INIT().
  • Input handlingUpdate() listens for the T key via Unity.InputSystem to toggle the GUI open or closed.

Safe/Constants.cs — plugin metadata

Constants.cs holds the three string constants that identify the plugin to BepInEx and HarmonyX. Centralizing them here means the GUID, display name, and version are never duplicated across files.
namespace Gorilla_Time.Safe;

internal class Constantss
{
    public const string GUID = "Astra.Mods.Gorilla.TimeV2";
    public const string Name = "Gorilla.TimeV2";
    public const string Version = "2.0";
}

Safe/Patcher.cs — HarmonyX bootstrap

Patcher.cs exposes a single static Apply() method. It instantiates a Harmony object keyed to the plugin GUID and calls PatchAll(), which scans the assembly for any [HarmonyPatch]-annotated classes and applies them automatically. At present the plugin uses no manual patches, but this infrastructure is in place for future use.

Namespace structure

NamespaceFile(s)Purpose
Gorilla_Time.PluginPlugin.csBepInEx entry point and Unity lifecycle hooks
Gorilla_Time.CoreCore/Main.csAll gameplay logic — GUI, time, weather
Gorilla_Time.SafeSafe/Constants.cs, Safe/Patcher.csShared metadata and HarmonyX bootstrap

Plugin lifecycle

The sequence of execution from game launch to the running plugin:
  1. BepInEx loads the plugin DLL from BepInEx/plugins/MO/ and discovers the [BepInPlugin] attribute on plugin.
  2. Awake() is called — a new GameObject named Gorilla.TimeV2 is created, the Main MonoBehaviour component is attached, and DontDestroyOnLoad ensures it persists across map changes.
  3. Start() is called — Pacther.Apply() creates a Harmony instance and runs PatchAll() to register any Harmony patches in the assembly.
  4. Game loop begins — Unity calls OnGUI() every frame for GUI rendering, Update() every frame for input polling, and FixedUpdate() on a fixed timestep to apply the selected time-of-day setting via BetterDayNightManager.

Build docs developers (and LLMs) love