using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("BetterPlantSky")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("2026")]
[assembly: AssemblyDescription("Improved roof calculations to allow planting at house walls with overhanging roofs.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("Better Plant Sky")]
[assembly: AssemblyTitle("BetterPlantSky")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 BetterPlantSky
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BetterPlantSky";
public const string PLUGIN_NAME = "Better Plant Sky";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace ReducedPlantHeight
{
[BepInPlugin("lu.mai.betterPlantSky", "Better open sky for plants!", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private const string pluginGUID = "lu.mai.betterPlantSky";
private const string pluginName = "Better open sky for plants!";
private const string pluginVersion = "1.1.0";
internal static ManualLogSource Logger;
private readonly Harmony HarmonyInstance = new Harmony("lu.mai.betterPlantSky");
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin lu.mai.betterPlantSky is loaded!");
HarmonyInstance.PatchAll();
}
}
[HarmonyPatch(typeof(Plant))]
[HarmonyPatch("HaveRoof")]
internal class Plant_HaveRoof_Patch
{
private static bool Prefix(ref bool __result, ref Plant __instance)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if (Plant.m_roofMask == 0)
{
Plant.m_roofMask = LayerMask.GetMask(new string[3] { "Default", "static_solid", "piece" });
}
if (!Physics.Raycast(((Component)__instance).transform.position, Vector3.up, 100f, Plant.m_roofMask))
{
__result = false;
return false;
}
float[] array = new float[8] { 0.78539f, 1.57079f, 2.35619f, 3.14159f, 3.92699f, 4.71238f, 5.49778f, 6.28318f };
int num = 0;
for (int i = 0; i < 8; i++)
{
if (Physics.Raycast(((Component)__instance).transform.position, new Vector3(Mathf.Sin(array[i]), 1f, Mathf.Cos(array[i])), 50f, Plant.m_roofMask))
{
num++;
}
}
if (num < 6)
{
__result = false;
}
else
{
__result = true;
}
return false;
}
}
}