Decompiled source of HazardousWorld v1.5.0

HazardousWorld.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using EquinoxsModUtils;
using EquinoxsModUtils.Additions;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TechtonicaFramework.API;
using TechtonicaFramework.Environment;
using TechtonicaFramework.TechTree;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HazardousWorld")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d58d7663369b0deb70cadacd0818eee7d5f2dc5d")]
[assembly: AssemblyProduct("HazardousWorld")]
[assembly: AssemblyTitle("HazardousWorld")]
[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 HazardousWorld
{
	[BepInPlugin("com.certifired.HazardousWorld", "HazardousWorld", "1.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class HazardousWorldPlugin : BaseUnityPlugin
	{
		public const string MyGUID = "com.certifired.HazardousWorld";

		public const string PluginName = "HazardousWorld";

		public const string VersionString = "1.5.0";

		private static readonly Harmony Harmony = new Harmony("com.certifired.HazardousWorld");

		public static ManualLogSource Log;

		public static HazardousWorldPlugin Instance;

		public static ConfigEntry<bool> EnableToxicZones;

		public static ConfigEntry<bool> EnableRadiationZones;

		public static ConfigEntry<bool> EnableHostileFlora;

		public static ConfigEntry<float> ToxicDamageRate;

		public static ConfigEntry<float> RadiationDamageRate;

		public static ConfigEntry<float> FloraDamageRate;

		public static ConfigEntry<bool> EnableReactorRadiation;

		public static ConfigEntry<float> ReactorRadiationRadius;

		public static ConfigEntry<bool> DebugMode;

		public const string HazmatSuitName = "Hazmat Suit";

		public const string RadShieldName = "Radiation Shield";

		public const string HazmatUnlock = "Hazard Protection";

		private static Dictionary<string, HazardZoneData> activeZones = new Dictionary<string, HazardZoneData>();

		private bool zonesInitialized = false;

		private static List<SporePlantController> activeSporePlants = new List<SporePlantController>();

		private float sporePlantSpawnTimer = 0f;

		private const float SPORE_SPAWN_INTERVAL = 120f;

		private static List<VenomousThornController> activeVenomousThorns = new List<VenomousThornController>();

		private static List<AcidSpitterController> activeAcidSpitters = new List<AcidSpitterController>();

		private static List<GraspingVineController> activeGraspingVines = new List<GraspingVineController>();

		private float hostileFloraSpawnTimer = 0f;

		private const float HOSTILE_FLORA_SPAWN_INTERVAL = 90f;

		public static ConfigEntry<bool> EnableSporePlants;

		public static ConfigEntry<float> SporePlantDamage;

		public static ConfigEntry<float> SporePlantRadius;

		public static ConfigEntry<int> MaxSporePlants;

		public static ConfigEntry<KeyCode> SporeSpawnKey;

		public static ConfigEntry<bool> EnableVenomousThorns;

		public static ConfigEntry<float> ThornDamage;

		public static ConfigEntry<int> MaxThorns;

		public static ConfigEntry<bool> EnableAcidSpitters;

		public static ConfigEntry<float> AcidDamage;

		public static ConfigEntry<float> AcidRange;

		public static ConfigEntry<int> MaxSpitters;

		public static ConfigEntry<bool> EnableGraspingVines;

		public static ConfigEntry<float> VineSlowAmount;

		public static ConfigEntry<float> VineGrabDuration;

		public static ConfigEntry<int> MaxVines;

		public static ConfigEntry<int> MaxTotalHostileFlora;

		public static ConfigEntry<KeyCode> FloraSpawnKey;

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"HazardousWorld v1.5.0 loading...");
			InitializeConfig();
			Harmony.PatchAll();
			RegisterProtectiveEquipment();
			Events.GameDefinesLoaded += OnGameDefinesLoaded;
			Events.GameLoaded += OnGameLoaded;
			Events.TechTreeStateLoaded += OnTechTreeStateLoaded;
			Log.LogInfo((object)"HazardousWorld v1.5.0 loaded!");
		}

		private void OnTechTreeStateLoaded()
		{
			ConfigureUnlock("Hazard Protection", "Iron Frame", (ResearchTier)64, 70);
			Log.LogInfo((object)"Configured HazardousWorld unlock tiers in VICTOR");
		}

		private void ConfigureUnlock(string unlockName, string spriteSourceName, ResearchTier tier, int position)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Unlock unlockByName = Unlocks.GetUnlockByName(unlockName, false);
				if ((Object)(object)unlockByName == (Object)null)
				{
					LogDebug("Unlock '" + unlockName + "' not found");
					return;
				}
				unlockByName.requiredTier = tier;
				unlockByName.treePosition = position;
				if ((Object)(object)unlockByName.sprite == (Object)null)
				{
					ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(spriteSourceName, false);
					if ((Object)(object)resourceInfoByName != (Object)null && (Object)(object)resourceInfoByName.sprite != (Object)null)
					{
						unlockByName.sprite = resourceInfoByName.sprite;
					}
					else
					{
						Unlock unlockByName2 = Unlocks.GetUnlockByName(spriteSourceName, false);
						if ((Object)(object)unlockByName2 != (Object)null && (Object)(object)unlockByName2.sprite != (Object)null)
						{
							unlockByName.sprite = unlockByName2.sprite;
						}
					}
				}
				LogDebug($"Configured unlock '{unlockName}': tier={tier}, position={position}");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to configure unlock " + unlockName + ": " + ex.Message));
			}
		}

		private void InitializeConfig()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Expected O, but got Unknown
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Expected O, but got Unknown
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Expected O, but got Unknown
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Expected O, but got Unknown
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Expected O, but got Unknown
			EnableToxicZones = ((BaseUnityPlugin)this).Config.Bind<bool>("Toxic Zones", "Enable Toxic Zones", true, "Enable toxic gas zones in certain areas");
			ToxicDamageRate = ((BaseUnityPlugin)this).Config.Bind<float>("Toxic Zones", "Toxic Damage Per Second", 5f, new ConfigDescription("Damage per second in toxic zones", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 50f), Array.Empty<object>()));
			EnableRadiationZones = ((BaseUnityPlugin)this).Config.Bind<bool>("Radiation", "Enable Radiation Zones", true, "Enable radiation hazard zones");
			RadiationDamageRate = ((BaseUnityPlugin)this).Config.Bind<float>("Radiation", "Radiation Damage Per Second", 8f, new ConfigDescription("Damage per second in radiation zones", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 50f), Array.Empty<object>()));
			EnableReactorRadiation = ((BaseUnityPlugin)this).Config.Bind<bool>("Radiation", "Reactors Emit Radiation", true, "Power generators emit a small radiation field");
			ReactorRadiationRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radiation", "Reactor Radiation Radius", 5f, new ConfigDescription("Radius of reactor radiation zone", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>()));
			EnableHostileFlora = ((BaseUnityPlugin)this).Config.Bind<bool>("Flora", "Enable Hostile Flora", true, "Some plants can damage the player on contact");
			FloraDamageRate = ((BaseUnityPlugin)this).Config.Bind<float>("Flora", "Flora Damage Per Second", 3f, new ConfigDescription("Damage per second from hostile flora", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>()));
			EnableSporePlants = ((BaseUnityPlugin)this).Config.Bind<bool>("Spore Plants", "Enable Spore Plants", true, "Spawn hostile spore plants that create toxic clouds");
			SporePlantDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Spore Plants", "Spore Damage Per Second", 8f, new ConfigDescription("Damage per second from spore cloud", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>()));
			SporePlantRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Spore Plants", "Spore Cloud Radius", 6f, new ConfigDescription("Radius of spore cloud damage zone", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 15f), Array.Empty<object>()));
			MaxSporePlants = ((BaseUnityPlugin)this).Config.Bind<int>("Spore Plants", "Max Spore Plants", 10, new ConfigDescription("Maximum number of spore plants in world", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
			SporeSpawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Debug", "Spawn Spore Plant Key", (KeyCode)291, "Press to spawn a spore plant near player (debug)");
			EnableVenomousThorns = ((BaseUnityPlugin)this).Config.Bind<bool>("Venomous Thorns", "Enable Venomous Thorns", true, "Spawn dangerous thorn bushes that damage on contact");
			ThornDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Venomous Thorns", "Thorn Damage Per Hit", 15f, new ConfigDescription("Damage dealt when touching thorns", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>()));
			MaxThorns = ((BaseUnityPlugin)this).Config.Bind<int>("Venomous Thorns", "Max Thorn Bushes", 15, new ConfigDescription("Maximum thorn bushes in world", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
			EnableAcidSpitters = ((BaseUnityPlugin)this).Config.Bind<bool>("Acid Spitters", "Enable Acid Spitters", true, "Spawn plants that spit acid projectiles at nearby players");
			AcidDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Acid Spitters", "Acid Damage Per Hit", 12f, new ConfigDescription("Damage from acid projectiles", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 40f), Array.Empty<object>()));
			AcidRange = ((BaseUnityPlugin)this).Config.Bind<float>("Acid Spitters", "Acid Spit Range", 12f, new ConfigDescription("Range at which acid spitters attack", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 25f), Array.Empty<object>()));
			MaxSpitters = ((BaseUnityPlugin)this).Config.Bind<int>("Acid Spitters", "Max Acid Spitters", 8, new ConfigDescription("Maximum acid spitters in world", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 30), Array.Empty<object>()));
			EnableGraspingVines = ((BaseUnityPlugin)this).Config.Bind<bool>("Grasping Vines", "Enable Grasping Vines", true, "Spawn vine plants that slow and trap players");
			VineSlowAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Grasping Vines", "Vine Slow Percentage", 0.5f, new ConfigDescription("Movement speed reduction (0.5 = 50% slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.9f), Array.Empty<object>()));
			VineGrabDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Grasping Vines", "Grab Duration", 2f, new ConfigDescription("How long vines hold the player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 5f), Array.Empty<object>()));
			MaxVines = ((BaseUnityPlugin)this).Config.Bind<int>("Grasping Vines", "Max Vine Patches", 12, new ConfigDescription("Maximum vine patches in world", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 40), Array.Empty<object>()));
			MaxTotalHostileFlora = ((BaseUnityPlugin)this).Config.Bind<int>("Hostile Flora", "Max Total Flora", 50, new ConfigDescription("Maximum total hostile flora entities", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 200), Array.Empty<object>()));
			FloraSpawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Debug", "Spawn Random Flora Key", (KeyCode)292, "Press to spawn random hostile flora near player (debug)");
			DebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debug Mode", false, "Enable debug logging");
		}

		private void RegisterProtectiveEquipment()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004b: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Expected O, but got Unknown
			EMUAdditions.AddNewUnlock(new NewUnlockDetails
			{
				category = ModdedTabModule.ModdedCategory,
				coreTypeNeeded = (CoreType)1,
				coreCountNeeded = 100,
				description = "Research protective equipment to survive hazardous environments.",
				displayName = "Hazard Protection",
				requiredTier = (ResearchTier)1,
				treePosition = 0
			}, false);
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Hazmat Suit",
				description = "Protective suit that reduces toxic damage by 80%. Essential for exploring contaminated areas.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 1,
				sortPriority = 110,
				unlockName = "Hazard Protection",
				parentName = "Iron Frame"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.HazardousWorld_hazmat",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 20f,
				unlockName = "Hazard Protection",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Plantmatter Fiber", 20),
					new RecipeResourceInfo("Biobrick", 10),
					new RecipeResourceInfo("Iron Frame", 5)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Hazmat Suit", 1)
				},
				sortPriority = 110
			}, false);
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Radiation Shield",
				description = "Lead-lined shield that reduces radiation damage by 90%. Critical for working near reactors.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 1,
				sortPriority = 111,
				unlockName = "Hazard Protection",
				parentName = "Steel Frame"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.HazardousWorld_radshield",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 30f,
				unlockName = "Hazard Protection",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Steel Frame", 10),
					new RecipeResourceInfo("Copper Ingot", 20),
					new RecipeResourceInfo("Iron Components", 10)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Radiation Shield", 1)
				},
				sortPriority = 111
			}, false);
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Antidote",
				description = "Instantly removes toxic status effects. Crafted from Shiverthorn.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 20,
				sortPriority = 120,
				unlockName = "Hazard Protection",
				parentName = "Kindlevine Extract"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.HazardousWorld_antidote",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 5f,
				unlockName = "Hazard Protection",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Shiverthorn", 5),
					new RecipeResourceInfo("Plantmatter", 10)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Antidote", 3)
				},
				sortPriority = 120
			}, false);
			LogDebug("Protective equipment registered");
		}

		private void OnGameDefinesLoaded()
		{
			LinkUnlockToResource("Hazmat Suit", "Hazard Protection");
			LinkUnlockToResource("Radiation Shield", "Hazard Protection");
			LinkUnlockToResource("Antidote", "Hazard Protection");
			Log.LogInfo((object)"Linked HazardousWorld unlocks to resources");
		}

		private void LinkUnlockToResource(string resourceName, string unlockName)
		{
			try
			{
				ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(resourceName, false);
				if ((Object)(object)resourceInfoByName != (Object)null)
				{
					resourceInfoByName.unlock = Unlocks.GetUnlockByName(unlockName, false);
					LogDebug("Linked " + resourceName + " to unlock " + unlockName);
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to link " + resourceName + " to " + unlockName + ": " + ex.Message));
			}
		}

		private void OnGameLoaded()
		{
			Log.LogInfo((object)"HazardousWorld: Game loaded (hazard zones disabled in stub mode)");
		}

		private void InitializeHazardZones()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			LogDebug("Initializing hazard zones...");
			if (EnableToxicZones.Value)
			{
				CreateHazardZone("toxic_cave_1", new Vector3(100f, -50f, 200f), 15f, (HazardType)1, ToxicDamageRate.Value);
				CreateHazardZone("toxic_cave_2", new Vector3(-150f, -80f, 300f), 20f, (HazardType)1, ToxicDamageRate.Value);
				CreateHazardZone("toxic_swamp_1", new Vector3(250f, -30f, -100f), 25f, (HazardType)1, ToxicDamageRate.Value * 0.5f);
			}
			if (EnableRadiationZones.Value)
			{
				CreateHazardZone("rad_deposit_1", new Vector3(-200f, -100f, 150f), 10f, (HazardType)2, RadiationDamageRate.Value);
				CreateHazardZone("rad_core_1", new Vector3(0f, -150f, 0f), 30f, (HazardType)2, RadiationDamageRate.Value * 1.5f);
			}
			LogDebug($"Created {activeZones.Count} hazard zones");
		}

		private void CreateHazardZone(string id, Vector3 position, float radius, HazardType type, float dps)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			FrameworkAPI.CreateHazardZone(id, position, radius, type, dps);
			activeZones[id] = new HazardZoneData
			{
				Id = id,
				Position = position,
				Radius = radius,
				Type = type,
				DamagePerSecond = dps
			};
			LogDebug($"Created hazard zone: {id} ({type}) at {position} with radius {radius}");
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(SporeSpawnKey.Value))
			{
				SpawnSporePlantNearPlayer();
			}
			if (Input.GetKeyDown(FloraSpawnKey.Value))
			{
				SpawnRandomHostileFloraTypeNearPlayer();
			}
			if (EnableReactorRadiation.Value)
			{
				UpdateReactorRadiationZones();
			}
			if (EnableHostileFlora.Value)
			{
				CheckHostileFlora();
			}
			if (EnableSporePlants.Value)
			{
				UpdateSporePlantSystem();
			}
			UpdateHostileFloraSpawning();
			activeSporePlants.RemoveAll((SporePlantController sp) => (Object)(object)sp == (Object)null);
			activeVenomousThorns.RemoveAll((VenomousThornController t) => (Object)(object)t == (Object)null);
			activeAcidSpitters.RemoveAll((AcidSpitterController s) => (Object)(object)s == (Object)null);
			activeGraspingVines.RemoveAll((GraspingVineController v) => (Object)(object)v == (Object)null);
		}

		private void UpdateHostileFloraSpawning()
		{
			hostileFloraSpawnTimer += Time.deltaTime;
			if (hostileFloraSpawnTimer < 90f)
			{
				return;
			}
			hostileFloraSpawnTimer = 0f;
			int num = activeSporePlants.Count + activeVenomousThorns.Count + activeAcidSpitters.Count + activeGraspingVines.Count;
			if (num >= MaxTotalHostileFlora.Value)
			{
				return;
			}
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float value = Random.value;
				if (EnableVenomousThorns.Value && activeVenomousThorns.Count < MaxThorns.Value && value < 0.4f)
				{
					TrySpawnFloraAtRandomLocation<VenomousThornController>((Func<Vector3, GameObject>)SpawnVenomousThorn);
				}
				else if (EnableAcidSpitters.Value && activeAcidSpitters.Count < MaxSpitters.Value && value < 0.6f)
				{
					TrySpawnFloraAtRandomLocation<AcidSpitterController>((Func<Vector3, GameObject>)SpawnAcidSpitter);
				}
				else if (EnableGraspingVines.Value && activeGraspingVines.Count < MaxVines.Value && value < 0.8f)
				{
					TrySpawnFloraAtRandomLocation<GraspingVineController>((Func<Vector3, GameObject>)SpawnGraspingVine);
				}
			}
		}

		private void TrySpawnFloraAtRandomLocation<T>(Func<Vector3, GameObject> spawnFunc) where T : Component
		{
			//IL_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				float num2 = Random.Range(25f, 70f);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2);
				Vector3 val2 = ((Component)instance).transform.position + val;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(val2 + Vector3.up * 50f, Vector3.down, ref val3, 100f))
				{
					spawnFunc(((RaycastHit)(ref val3)).point);
				}
			}
		}

		private void SpawnRandomHostileFloraTypeNearPlayer()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				Vector3 val = ((Component)instance).transform.position + ((Component)instance).transform.forward * 8f;
				switch (Random.Range(0, 3))
				{
				case 0:
					SpawnVenomousThorn(val);
					Log.LogInfo((object)$"DEBUG: Spawned Venomous Thorn at {val}");
					break;
				case 1:
					SpawnAcidSpitter(val);
					Log.LogInfo((object)$"DEBUG: Spawned Acid Spitter at {val}");
					break;
				case 2:
					SpawnGraspingVine(val);
					Log.LogInfo((object)$"DEBUG: Spawned Grasping Vine at {val}");
					break;
				}
			}
		}

		private void UpdateSporePlantSystem()
		{
			sporePlantSpawnTimer += Time.deltaTime;
			if (sporePlantSpawnTimer >= 120f && activeSporePlants.Count < MaxSporePlants.Value)
			{
				sporePlantSpawnTimer = 0f;
				TrySpawnRandomSporePlant();
			}
		}

		private void TrySpawnRandomSporePlant()
		{
			//IL_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				float num2 = Random.Range(30f, 80f);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2);
				Vector3 val2 = ((Component)instance).transform.position + val;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(val2 + Vector3.up * 50f, Vector3.down, ref val3, 100f))
				{
					SpawnSporePlant(((RaycastHit)(ref val3)).point);
				}
			}
		}

		private void SpawnSporePlantNearPlayer()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				Vector3 val = ((Component)instance).transform.position + ((Component)instance).transform.forward * 8f;
				SpawnSporePlant(val);
				Log.LogInfo((object)$"DEBUG: Spawned spore plant at {val}");
			}
		}

		public static GameObject SpawnSporePlant(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SporePlant");
			val.transform.position = position;
			GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)2);
			val2.transform.SetParent(val.transform);
			val2.transform.localPosition = Vector3.up * 0.5f;
			val2.transform.localScale = new Vector3(0.3f, 1f, 0.3f);
			Renderer component = val2.GetComponent<Renderer>();
			component.material.color = new Color(0.3f, 0.5f, 0.2f);
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			val3.transform.SetParent(val.transform);
			val3.transform.localPosition = Vector3.up * 1.5f;
			val3.transform.localScale = new Vector3(1.2f, 0.8f, 1.2f);
			Renderer component2 = val3.GetComponent<Renderer>();
			component2.material.color = new Color(0.6f, 0.2f, 0.4f);
			for (int i = 0; i < 6; i++)
			{
				GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0);
				val4.transform.SetParent(val3.transform);
				float num = (float)i / 6f * (float)Math.PI * 2f;
				val4.transform.localPosition = new Vector3(Mathf.Cos(num) * 0.4f, 0.2f, Mathf.Sin(num) * 0.4f);
				val4.transform.localScale = Vector3.one * 0.3f;
				Renderer component3 = val4.GetComponent<Renderer>();
				component3.material.color = new Color(0.8f, 0.6f, 0.2f, 0.7f);
				Object.Destroy((Object)(object)val4.GetComponent<Collider>());
			}
			SporePlantController sporePlantController = val.AddComponent<SporePlantController>();
			sporePlantController.sporeRadius = SporePlantRadius.Value;
			sporePlantController.sporeDamagePerSecond = SporePlantDamage.Value;
			activeSporePlants.Add(sporePlantController);
			LogDebug($"Spawned spore plant at {position}, total: {activeSporePlants.Count}");
			return val;
		}

		public static GameObject SpawnVenomousThorn(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("VenomousThorn");
			val.transform.position = position;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.3f, 0.15f, 0.1f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.6f, 0.1f, 0.2f);
			GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)2);
			val4.transform.SetParent(val.transform);
			val4.transform.localPosition = Vector3.up * 0.2f;
			val4.transform.localScale = new Vector3(0.6f, 0.4f, 0.6f);
			val4.GetComponent<Renderer>().material.color = val2;
			Object.Destroy((Object)(object)val4.GetComponent<Collider>());
			for (int i = 0; i < 8; i++)
			{
				float num = (float)i / 8f * (float)Math.PI * 2f;
				float num2 = Random.Range(0.3f, 0.8f);
				GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)1);
				val5.transform.SetParent(val.transform);
				val5.transform.localPosition = new Vector3(Mathf.Cos(num) * 0.3f, num2, Mathf.Sin(num) * 0.3f);
				val5.transform.localRotation = Quaternion.Euler(Random.Range(30f, 60f), num * 57.29578f, 0f);
				val5.transform.localScale = new Vector3(0.08f, 0.4f, 0.08f);
				val5.GetComponent<Renderer>().material.color = Color.Lerp(val2, val3, 0.5f);
				Object.Destroy((Object)(object)val5.GetComponent<Collider>());
			}
			VenomousThornController venomousThornController = val.AddComponent<VenomousThornController>();
			venomousThornController.damageOnContact = ThornDamage.Value;
			activeVenomousThorns.Add(venomousThornController);
			LogDebug($"Spawned venomous thorn at {position}, total: {activeVenomousThorns.Count}");
			return val;
		}

		public static GameObject SpawnAcidSpitter(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("AcidSpitter");
			val.transform.position = position;
			Color color = default(Color);
			((Color)(ref color))..ctor(0.2f, 0.4f, 0.1f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.5f, 0.8f, 0.2f);
			Color color3 = default(Color);
			((Color)(ref color3))..ctor(0.7f, 0.9f, 0.1f);
			GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)2);
			val2.transform.SetParent(val.transform);
			val2.transform.localPosition = Vector3.up * 0.5f;
			val2.transform.localScale = new Vector3(0.25f, 1f, 0.25f);
			val2.GetComponent<Renderer>().material.color = color;
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)1);
			val3.transform.SetParent(val.transform);
			val3.transform.localPosition = Vector3.up * 1.5f;
			val3.transform.localScale = new Vector3(0.6f, 0.5f, 0.6f);
			val3.transform.localRotation = Quaternion.Euler(15f, 0f, 0f);
			val3.GetComponent<Renderer>().material.color = color2;
			Object.Destroy((Object)(object)val3.GetComponent<Collider>());
			GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0);
			val4.transform.SetParent(val3.transform);
			val4.transform.localPosition = Vector3.forward * 0.2f;
			val4.transform.localScale = new Vector3(0.6f, 0.5f, 0.4f);
			val4.GetComponent<Renderer>().material.color = color3;
			Object.Destroy((Object)(object)val4.GetComponent<Collider>());
			AcidSpitterController acidSpitterController = val.AddComponent<AcidSpitterController>();
			acidSpitterController.damage = AcidDamage.Value;
			acidSpitterController.attackRange = AcidRange.Value;
			activeAcidSpitters.Add(acidSpitterController);
			LogDebug($"Spawned acid spitter at {position}, total: {activeAcidSpitters.Count}");
			return val;
		}

		public static GameObject SpawnGraspingVine(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GraspingVine");
			val.transform.position = position;
			Color color = default(Color);
			((Color)(ref color))..ctor(0.15f, 0.3f, 0.1f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.3f, 0.2f, 0.1f);
			for (int i = 0; i < 5; i++)
			{
				float num = (float)i / 5f * (float)Math.PI * 2f;
				float num2 = Random.Range(0.3f, 0.8f);
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)1);
				val2.transform.SetParent(val.transform);
				val2.transform.localPosition = new Vector3(Mathf.Cos(num) * num2, 0.5f, Mathf.Sin(num) * num2);
				val2.transform.localScale = new Vector3(0.15f, 1f, 0.15f);
				val2.transform.localRotation = Quaternion.Euler(Random.Range(-20f, 20f), Random.Range(0f, 360f), Random.Range(-20f, 20f));
				val2.GetComponent<Renderer>().material.color = color;
				Object.Destroy((Object)(object)val2.GetComponent<Collider>());
			}
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			val3.transform.SetParent(val.transform);
			val3.transform.localPosition = Vector3.up * 0.15f;
			val3.transform.localScale = new Vector3(1.5f, 0.4f, 1.5f);
			val3.GetComponent<Renderer>().material.color = color2;
			Object.Destroy((Object)(object)val3.GetComponent<Collider>());
			GraspingVineController graspingVineController = val.AddComponent<GraspingVineController>();
			graspingVineController.slowAmount = VineSlowAmount.Value;
			graspingVineController.grabDuration = VineGrabDuration.Value;
			activeGraspingVines.Add(graspingVineController);
			LogDebug($"Spawned grasping vine at {position}, total: {activeGraspingVines.Count}");
			return val;
		}

		private void UpdateReactorRadiationZones()
		{
		}

		private void CheckHostileFlora()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				Vector3 position = ((Component)instance).transform.position;
			}
		}

		private void OnZoneEntered(string zoneId, Vector3 position)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (activeZones.TryGetValue(zoneId, out var value))
			{
				Log.LogWarning((object)$"DANGER: Entered {value.Type} zone!");
				if (CheckProtection(value.Type))
				{
					Log.LogInfo((object)"Protective equipment is reducing damage.");
				}
			}
		}

		private void OnZoneExited(string zoneId, Vector3 position)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (activeZones.TryGetValue(zoneId, out var value))
			{
				Log.LogInfo((object)$"Left {value.Type} zone - status effects will fade.");
			}
		}

		private bool CheckProtection(HazardType type)
		{
			Player instance = Player.instance;
			PlayerInventory val = ((instance != null) ? instance.inventory : null);
			if (val == null)
			{
				return false;
			}
			return false;
		}

		public static void CreateTemporaryHazard(Vector3 position, HazardType type, float radius, float duration, float dps)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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)
			string text = $"temp_{type}_{Random.Range(0, 10000)}";
			FrameworkAPI.CreateHazardZone(text, position, radius, type, dps);
			activeZones[text] = new HazardZoneData
			{
				Id = text,
				Position = position,
				Radius = radius,
				Type = type,
				DamagePerSecond = dps,
				IsTemporary = true,
				ExpirationTime = Time.time + duration
			};
			((MonoBehaviour)Instance).StartCoroutine(RemoveZoneAfterDelay(text, duration));
		}

		private static IEnumerator RemoveZoneAfterDelay(string id, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			FrameworkAPI.RemoveHazardZone(id);
			activeZones.Remove(id);
			LogDebug("Temporary hazard zone " + id + " expired");
		}

		public static void LogDebug(string message)
		{
			if (DebugMode != null && DebugMode.Value)
			{
				Log.LogInfo((object)("[DEBUG] " + message));
			}
		}
	}
	public class HazardZoneData
	{
		public string Id;

		public Vector3 Position;

		public float Radius;

		public HazardType Type;

		public float DamagePerSecond;

		public bool IsTemporary;

		public float ExpirationTime;
	}
	[HarmonyPatch]
	public static class HazardVisualPatches
	{
		private static readonly Color ToxicColor = new Color(0.2f, 0.8f, 0.2f, 0.3f);

		private static readonly Color RadiationColor = new Color(0.8f, 0.8f, 0.2f, 0.3f);

		private static readonly Color FireColor = new Color(1f, 0.4f, 0.1f, 0.5f);

		private static readonly Color FrostColor = new Color(0.3f, 0.6f, 1f, 0.4f);

		public static void ApplyHazardVisualEffect(HazardType type, float intensity)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			Color val = (Color)((type - 1) switch
			{
				0 => ToxicColor, 
				1 => RadiationColor, 
				2 => FireColor, 
				3 => FrostColor, 
				_ => Color.clear, 
			});
			if (1 == 0)
			{
			}
			Color val2 = val;
		}
	}
	public class SporePlantController : MonoBehaviour
	{
		public float sporeRadius = 6f;

		public float sporeDamagePerSecond = 8f;

		public float sporePulseInterval = 3f;

		public float health = 50f;

		public float maxHealth = 50f;

		private float lastPulseTime;

		private float lastDamageTime;

		private Transform sporeCloud;

		private bool isPlayerInRange = false;

		private ParticleSystem sporeParticles;

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			sporeCloud = new GameObject("SporeCloud").transform;
			sporeCloud.SetParent(((Component)this).transform);
			sporeCloud.localPosition = Vector3.up * 1.5f;
			CreateSporeParticles();
			SphereCollider val = ((Component)this).gameObject.AddComponent<SphereCollider>();
			val.radius = sporeRadius;
			((Collider)val).isTrigger = true;
			Rigidbody val2 = ((Component)this).gameObject.AddComponent<Rigidbody>();
			val2.isKinematic = true;
			val2.useGravity = false;
		}

		private void CreateSporeParticles()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			GameObject val = new GameObject("SporeParticles");
			val.transform.SetParent(sporeCloud);
			val.transform.localPosition = Vector3.zero;
			sporeParticles = val.AddComponent<ParticleSystem>();
			MainModule main = sporeParticles.main;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(4f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.5f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.5f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.6f, 0.8f, 0.2f, 0.4f));
			((MainModule)(ref main)).maxParticles = 100;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			EmissionModule emission = sporeParticles.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(15f);
			ShapeModule shape = sporeParticles.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = sporeRadius * 0.8f;
			ColorOverLifetimeModule colorOverLifetime = sporeParticles.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(new Color(0.6f, 0.8f, 0.2f), 0f),
				new GradientColorKey(new Color(0.4f, 0.6f, 0.1f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.5f, 0.3f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2);
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).material = new Material(Shader.Find("Particles/Standard Unlit"));
		}

		private void Update()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time - lastPulseTime >= sporePulseInterval)
			{
				lastPulseTime = Time.time;
				PulseSpores();
			}
			Player instance = Player.instance;
			if (!((Object)(object)instance != (Object)null))
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position);
			if (num <= sporeRadius)
			{
				if (Time.time - lastDamageTime >= 1f)
				{
					lastDamageTime = Time.time;
					DamagePlayer();
				}
				isPlayerInRange = true;
			}
			else
			{
				isPlayerInRange = false;
			}
		}

		private void PulseSpores()
		{
			if ((Object)(object)sporeParticles != (Object)null)
			{
				sporeParticles.Emit(20);
			}
			((MonoBehaviour)this).StartCoroutine(BulbPulseAnimation());
		}

		private IEnumerator BulbPulseAnimation()
		{
			Transform bulb = ((Component)this).transform.Find("Sphere");
			if (!((Object)(object)bulb == (Object)null))
			{
				Vector3 originalScale = bulb.localScale;
				Vector3 pulsedScale = originalScale * 1.2f;
				float duration = 0.3f;
				float elapsed2 = 0f;
				while (elapsed2 < duration)
				{
					elapsed2 += Time.deltaTime;
					bulb.localScale = Vector3.Lerp(originalScale, pulsedScale, elapsed2 / duration);
					yield return null;
				}
				elapsed2 = 0f;
				while (elapsed2 < duration)
				{
					elapsed2 += Time.deltaTime;
					bulb.localScale = Vector3.Lerp(pulsedScale, originalScale, elapsed2 / duration);
					yield return null;
				}
				bulb.localScale = originalScale;
			}
		}

		private void DamagePlayer()
		{
			bool flag = false;
			float num = sporeDamagePerSecond;
			if (flag)
			{
				num *= 0.2f;
			}
			HazardousWorldPlugin.Log.LogWarning((object)$"Spore plant damages player for {num:F1} (protection: {flag})");
		}

		public void TakeDamage(float damage)
		{
			health -= damage;
			HazardousWorldPlugin.LogDebug($"Spore plant took {damage} damage, health: {health}/{maxHealth}");
			((MonoBehaviour)this).StartCoroutine(DamageFlash());
			if (health <= 0f)
			{
				Die();
			}
		}

		private IEnumerator DamageFlash()
		{
			Renderer[] renderers = ((Component)this).GetComponentsInChildren<Renderer>();
			List<Color> originalColors = new List<Color>();
			Renderer[] array = renderers;
			foreach (Renderer r in array)
			{
				if ((Object)(object)r.material != (Object)null)
				{
					originalColors.Add(r.material.color);
					r.material.color = Color.red;
				}
			}
			yield return (object)new WaitForSeconds(0.15f);
			int i = 0;
			Renderer[] array2 = renderers;
			foreach (Renderer r2 in array2)
			{
				if ((Object)(object)r2.material != (Object)null && i < originalColors.Count)
				{
					r2.material.color = originalColors[i];
					i++;
				}
			}
		}

		private void Die()
		{
			HazardousWorldPlugin.Log.LogInfo((object)"Spore plant destroyed!");
			if ((Object)(object)sporeParticles != (Object)null)
			{
				((Component)sporeParticles).transform.SetParent((Transform)null);
				sporeParticles.Emit(50);
				Object.Destroy((Object)(object)((Component)sporeParticles).gameObject, 5f);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void OnTriggerEnter(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				HazardousWorldPlugin.Log.LogWarning((object)"Entering spore cloud zone!");
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				HazardousWorldPlugin.Log.LogInfo((object)"Leaving spore cloud zone");
			}
		}
	}
	public class VenomousThornController : MonoBehaviour
	{
		public float damageOnContact = 15f;

		public float damageCooldown = 0.5f;

		public float health = 30f;

		public float maxHealth = 30f;

		public float damageRadius = 1.5f;

		private float lastDamageTime;

		private void Start()
		{
			SphereCollider val = ((Component)this).gameObject.AddComponent<SphereCollider>();
			val.radius = damageRadius;
			((Collider)val).isTrigger = true;
			Rigidbody val2 = ((Component)this).gameObject.AddComponent<Rigidbody>();
			val2.isKinematic = true;
			val2.useGravity = false;
		}

		private void Update()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position);
				if (num <= damageRadius && Time.time - lastDamageTime >= damageCooldown)
				{
					lastDamageTime = Time.time;
					DamagePlayer();
				}
			}
		}

		private void DamagePlayer()
		{
			HazardousWorldPlugin.Log.LogWarning((object)$"Venomous thorn damages player for {damageOnContact}!");
			((MonoBehaviour)this).StartCoroutine(ShakeAnimation());
		}

		private IEnumerator ShakeAnimation()
		{
			Vector3 originalPos = ((Component)this).transform.position;
			float duration = 0.2f;
			float elapsed = 0f;
			while (elapsed < duration)
			{
				elapsed += Time.deltaTime;
				float shake = Mathf.Sin(elapsed * 50f) * 0.1f * (1f - elapsed / duration);
				((Component)this).transform.position = originalPos + new Vector3(shake, 0f, shake);
				yield return null;
			}
			((Component)this).transform.position = originalPos;
		}

		public void TakeDamage(float damage)
		{
			health -= damage;
			HazardousWorldPlugin.LogDebug($"Venomous thorn took {damage} damage, health: {health}/{maxHealth}");
			if (health <= 0f)
			{
				Die();
			}
		}

		private void Die()
		{
			HazardousWorldPlugin.Log.LogInfo((object)"Venomous thorn destroyed!");
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class AcidSpitterController : MonoBehaviour
	{
		public float damage = 12f;

		public float attackRange = 12f;

		public float attackCooldown = 3f;

		public float projectileSpeed = 15f;

		public float health = 40f;

		public float maxHealth = 40f;

		private float lastAttackTime;

		private Transform head;

		private void Start()
		{
			head = ((Component)this).transform.Find("Capsule");
			lastAttackTime = Time.time - attackCooldown;
		}

		private void Update()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position);
				if (num <= attackRange * 1.5f && (Object)(object)head != (Object)null)
				{
					Vector3 val = ((Component)instance).transform.position - head.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					Quaternion val2 = Quaternion.LookRotation(normalized) * Quaternion.Euler(90f, 0f, 0f);
					head.rotation = Quaternion.Slerp(head.rotation, val2, Time.deltaTime * 3f);
				}
				if (num <= attackRange && Time.time - lastAttackTime >= attackCooldown)
				{
					lastAttackTime = Time.time;
					((MonoBehaviour)this).StartCoroutine(SpitAcid(((Component)instance).transform));
				}
			}
		}

		private IEnumerator SpitAcid(Transform target)
		{
			Vector3 originalScale = (((Object)(object)head != (Object)null) ? head.localScale : Vector3.one);
			if ((Object)(object)head != (Object)null)
			{
				head.localScale = originalScale * 1.3f;
				yield return (object)new WaitForSeconds(0.3f);
				head.localScale = originalScale;
			}
			GameObject acidBlob = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)acidBlob).name = "AcidProjectile";
			acidBlob.transform.position = ((Component)this).transform.position + Vector3.up * 1.5f;
			acidBlob.transform.localScale = Vector3.one * 0.3f;
			acidBlob.GetComponent<Renderer>().material.color = new Color(0.7f, 0.9f, 0.1f);
			Object.Destroy((Object)(object)acidBlob.GetComponent<Collider>());
			Vector3 startPos = acidBlob.transform.position;
			Vector3 targetPos = target.position + Vector3.up;
			float flightTime = Vector3.Distance(startPos, targetPos) / projectileSpeed;
			float elapsed = 0f;
			while (elapsed < flightTime && (Object)(object)acidBlob != (Object)null)
			{
				elapsed += Time.deltaTime;
				float t = elapsed / flightTime;
				Vector3 currentPos = Vector3.Lerp(startPos, targetPos, t);
				currentPos.y += Mathf.Sin(t * (float)Math.PI) * 2f;
				acidBlob.transform.position = currentPos;
				yield return null;
			}
			if ((Object)(object)acidBlob != (Object)null)
			{
				float hitDistance = Vector3.Distance(acidBlob.transform.position, target.position);
				if (hitDistance < 2f)
				{
					HazardousWorldPlugin.Log.LogWarning((object)$"Acid spit hits player for {damage}!");
				}
				CreateAcidSplash(acidBlob.transform.position);
				Object.Destroy((Object)(object)acidBlob);
			}
		}

		private void CreateAcidSplash(Vector3 position)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			Vector3 velocity = default(Vector3);
			for (int i = 0; i < 5; i++)
			{
				GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
				val.transform.position = position;
				val.transform.localScale = Vector3.one * 0.15f;
				val.GetComponent<Renderer>().material.color = new Color(0.7f, 0.9f, 0.1f, 0.7f);
				Object.Destroy((Object)(object)val.GetComponent<Collider>());
				((Vector3)(ref velocity))..ctor(Random.Range(-2f, 2f), Random.Range(1f, 3f), Random.Range(-2f, 2f));
				((MonoBehaviour)this).StartCoroutine(AnimateSplash(val, velocity));
			}
		}

		private IEnumerator AnimateSplash(GameObject splash, Vector3 velocity)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float lifetime = 0.5f;
			float elapsed = 0f;
			while (elapsed < lifetime && (Object)(object)splash != (Object)null)
			{
				elapsed += Time.deltaTime;
				velocity.y -= 10f * Time.deltaTime;
				Transform transform = splash.transform;
				transform.position += velocity * Time.deltaTime;
				splash.transform.localScale = Vector3.one * 0.15f * (1f - elapsed / lifetime);
				yield return null;
			}
			if ((Object)(object)splash != (Object)null)
			{
				Object.Destroy((Object)(object)splash);
			}
		}

		public void TakeDamage(float damage)
		{
			health -= damage;
			HazardousWorldPlugin.LogDebug($"Acid spitter took {damage} damage, health: {health}/{maxHealth}");
			if (health <= 0f)
			{
				Die();
			}
		}

		private void Die()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			HazardousWorldPlugin.Log.LogInfo((object)"Acid spitter destroyed!");
			CreateAcidSplash(((Component)this).transform.position + Vector3.up);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class GraspingVineController : MonoBehaviour
	{
		public float slowAmount = 0.5f;

		public float grabDuration = 2f;

		public float grabRadius = 2f;

		public float health = 25f;

		public float maxHealth = 25f;

		private bool isPlayerGrabbed = false;

		private float grabEndTime;

		private List<Transform> tendrils = new List<Transform>();

		private void Start()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			SphereCollider val = ((Component)this).gameObject.AddComponent<SphereCollider>();
			val.radius = grabRadius;
			((Collider)val).isTrigger = true;
			Rigidbody val2 = ((Component)this).gameObject.AddComponent<Rigidbody>();
			val2.isKinematic = true;
			val2.useGravity = false;
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val3 = item;
				if (((Object)val3).name.Contains("Capsule"))
				{
					tendrils.Add(val3);
				}
			}
		}

		private void Update()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position);
			if (num <= grabRadius)
			{
				if (!isPlayerGrabbed)
				{
					GrabPlayer();
				}
			}
			else if (isPlayerGrabbed)
			{
				ReleasePlayer();
			}
			if (isPlayerGrabbed && Time.time >= grabEndTime)
			{
				ReleasePlayer();
			}
			if (isPlayerGrabbed)
			{
				AnimateTendrils();
			}
		}

		private void GrabPlayer()
		{
			isPlayerGrabbed = true;
			grabEndTime = Time.time + grabDuration;
			HazardousWorldPlugin.Log.LogWarning((object)$"Grasping vines grab player! Speed reduced by {slowAmount * 100f}% for {grabDuration}s");
			((MonoBehaviour)this).StartCoroutine(GrabAnimation());
		}

		private void ReleasePlayer()
		{
			if (isPlayerGrabbed)
			{
				isPlayerGrabbed = false;
				HazardousWorldPlugin.Log.LogInfo((object)"Vines release player");
			}
		}

		private IEnumerator GrabAnimation()
		{
			foreach (Transform tendril2 in tendrils)
			{
				if ((Object)(object)tendril2 != (Object)null)
				{
					Vector3 original = tendril2.localScale;
					tendril2.localScale = new Vector3(original.x, original.y * 1.5f, original.z);
				}
			}
			yield return (object)new WaitForSeconds(grabDuration);
			foreach (Transform tendril in tendrils)
			{
				if ((Object)(object)tendril != (Object)null)
				{
					Vector3 current = tendril.localScale;
					tendril.localScale = new Vector3(current.x, current.y / 1.5f, current.z);
				}
			}
		}

		private void AnimateTendrils()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(Time.time * 5f) * 0.1f;
			foreach (Transform tendril in tendrils)
			{
				if ((Object)(object)tendril != (Object)null)
				{
					Vector3 localEulerAngles = tendril.localEulerAngles;
					localEulerAngles.z = num * 20f;
					tendril.localEulerAngles = localEulerAngles;
				}
			}
		}

		public void TakeDamage(float damage)
		{
			health -= damage;
			HazardousWorldPlugin.LogDebug($"Grasping vine took {damage} damage, health: {health}/{maxHealth}");
			if (health <= 0f)
			{
				if (isPlayerGrabbed)
				{
					ReleasePlayer();
				}
				Die();
			}
		}

		private void Die()
		{
			HazardousWorldPlugin.Log.LogInfo((object)"Grasping vine destroyed!");
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void OnTriggerEnter(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				HazardousWorldPlugin.Log.LogWarning((object)"Entering vine trap zone!");
			}
		}
	}
}