Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TemporalStorm v0.1.8
BepInEx/plugins/TemporalStormWeather.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BasedItemSaving.API; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BrutalCompanyMinus; using BrutalCompanyMinus.Minus; using BrutalCompanyMinus.Minus.Handlers.Modded; using Coroner; using CullFactory; using CullFactory.Extenders; using Dawn; using Dawn.Internal; using Dawn.Utils; using DigitalRuby.ThunderAndLightning; using FacilityMeltdown.API; using GameNetcodeStuff; using HarmonyLib; using HatLib; using HatLib.Tools; using Microsoft.CodeAnalysis; using ModelReplacement; using Newtonsoft.Json.Linq; using PathfindingLib.API.SmartPathfinding; using PathfindingLib.Utilities; using ScandalLib.Interfaces; using ScandalLib.Scripts; using TMPro; using TemporalStormWeather.API; using TemporalStormWeather.Compat; using TemporalStormWeather.Compat.BCMERCompat; using TemporalStormWeather.Compat.BCMERCompat.Events.LocustSwarm; using TemporalStormWeather.Compat.BCMERCompat.Events.RusticAllItems; using TemporalStormWeather.Compat.BCMERCompat.Events.TemporalAllItems; using TemporalStormWeather.Compat.BCMERCompat.Events.WorldOfRust; using TemporalStormWeather.Enemies; using TemporalStormWeather.Hazards; using TemporalStormWeather.Items; using TemporalStormWeather.NetcodePatcher; using TemporalStormWeather.Patches; using TemporalStormWeather.ScriptableObjects; using TemporalStormWeather.TemporalStormManagers; using TemporalStormWeather.TemporalStormManagers.Helpers; using TemporalStormWeather.TemporalStormManagers.Runtime; using TemporalStormWeather.TemporalStormManagers.RustLightning; using TemporalStormWeather.Unlockables; using TemporalStormWeather.Utils; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; using UnityEngine.Events; using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TemporalStormWeather")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.8.0")] [assembly: AssemblyInformationalVersion("0.1.8")] [assembly: AssemblyProduct("TemporalStormWeather")] [assembly: AssemblyTitle("TemporalStormWeather")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 TemporalStormWeather { internal enum LightningPalette { Classic, Vibrant } internal readonly struct LightningPaletteColors { internal Color RustBaseColor { get; } internal Color RustEmissionColor { get; } internal Color RoarCoreColor { get; } internal Color RoarBoltColor { get; } internal Color RoarGlowColor { get; } internal Color RoarLightColor { get; } public LightningPaletteColors(Color rustBaseColor, Color rustEmissionColor, Color roarCoreColor, Color roarBoltColor, Color roarGlowColor, Color roarLightColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0026: 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) RustBaseColor = rustBaseColor; RustEmissionColor = rustEmissionColor; RoarCoreColor = roarCoreColor; RoarBoltColor = roarBoltColor; RoarGlowColor = roarGlowColor; RoarLightColor = roarLightColor; } } internal static class ConfigManager { private static readonly DuskConfigInjector DuskConfig = new DuskConfigInjector("MrHat.TemporalStormWeather"); private static readonly LightningPaletteColors ClassicLightningColors = new LightningPaletteColors(new Color(0.28f, 0.09f, 0.025f, 1f), new Color(0.21698111f, 0.07058923f, 0.013305452f, 1f), new Color(1f, 0.8784314f, 0.6980392f, 1f), new Color(46f / 51f, 0.4666667f, 0.1960784f, 1f), new Color(0.5607843f, 0.1764706f, 0.0470588f, 1f), new Color(1f, 0.6039216f, 0.2705882f, 1f)); private static readonly LightningPaletteColors VibrantLightningColors = new LightningPaletteColors(new Color(1f, 0.75f, 0.35f, 1f), new Color(1f, 0.35f, 0.05f, 1f), new Color(1f, 0.95f, 0.8f, 1f), new Color(1f, 0.65f, 0.12f, 1f), new Color(1f, 0.25f, 0.01f, 1f), new Color(1f, 0.75f, 0.3f, 1f)); internal static ConfigEntry<bool> TemporalRiftSkipDisabledEnemies { get; private set; } = null; internal static ConfigEntry<bool> TemporalRiftRespectEnemyMaxCount { get; private set; } = null; internal static ConfigEntry<bool> TemporalRiftUseCurrentMoonEnemyList { get; private set; } = null; internal static ConfigEntry<bool> TemporalRiftUnrestrictEnemySpawns { get; private set; } = null; internal static ConfigEntry<float> TemporalRiftLocustSwarmChance { get; private set; } = null; internal static ConfigEntry<int> TemporalRiftMinimumLocustWaveSize { get; private set; } = null; internal static ConfigEntry<int> TemporalRiftMaximumLocustWaveSize { get; private set; } = null; internal static ConfigEntry<float> TemporalRiftMinimumEnemyPowerBudget { get; private set; } = null; internal static ConfigEntry<float> TemporalRiftMaximumEnemyPowerBudget { get; private set; } = null; internal static ConfigEntry<string> TemporalRiftInsideEnemyBlacklist { get; private set; } = null; internal static ConfigEntry<string> TemporalRiftOutsideEnemyBlacklist { get; private set; } = null; internal static ConfigEntry<bool> EntityGlitchEnabled { get; private set; } = null; internal static ConfigEntry<bool> EntityGlitchPlayerModels { get; private set; } = null; internal static ConfigEntry<string> EntityGlitchEnemyBlacklist { get; private set; } = null; internal static ConfigEntry<LightningPalette> LightningPaletteSetting { get; private set; } = null; internal static ConfigEntry<bool> MoonTimeInstabilityEnabled { get; private set; } = null; internal static ConfigEntry<float> MoonTimeInstabilityAmount { get; private set; } = null; internal static ConfigEntry<float> DaysPassedInstabilityAmount { get; private set; } = null; internal static ConfigEntry<int> DaysPassedInstabilityDays { get; private set; } = null; internal static ConfigEntry<bool> ApparatusInstabilityEnabled { get; private set; } = null; internal static ConfigEntry<float> ApparatusInstabilityAmount { get; private set; } = null; internal static ConfigEntry<bool> PlayerFacilityInstabilityEnabled { get; private set; } = null; internal static ConfigEntry<float> FacilityInstabilityBasePerSecond { get; private set; } = null; internal static ConfigEntry<float> FacilityInstabilityPerPlayerPerSecond { get; private set; } = null; internal static ConfigEntry<bool> PlayerInsanityInstabilityEnabled { get; private set; } = null; internal static ConfigEntry<float> PlayerInsanityThreshold { get; private set; } = null; internal static ConfigEntry<float> PlayerInsanityInstabilityPerSecond { get; private set; } = null; internal static ConfigEntry<bool> AudioPitchingEnabled { get; private set; } = null; internal static ConfigEntry<bool> TemporalStormStingerEnabled { get; private set; } = null; internal static ConfigEntry<float> MaxBackgroundAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxTuningCylinderAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxApproachingWarningAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxImminentWarningAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxLowStabilityAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxWaningAudioVolume { get; private set; } = null; internal static ConfigEntry<float> MaxWarningBellAudioVolume { get; private set; } = null; internal static ConfigEntry<bool> LandingHudWarningEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarTimeBreakEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarLandminesEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarTurretsEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarSteamValvesEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarLightFlickerEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarLightningEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarShockwaveEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarApparatusEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarEnemyStunEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarLostSignalEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarShipLightsEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarItemEffectsEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarManeaterTransformationEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarEarthLeviathanEmergenceEnabled { get; private set; } = null; internal static ConfigEntry<bool> ThunderlordRoarFacilityMeltdownEnabled { get; private set; } = null; internal static ConfigEntry<bool> DebugLogsEnabled { get; private set; } = null; internal static LightningPaletteColors LightningColors { get { LightningPalette value = LightningPaletteSetting.Value; if (value == LightningPalette.Vibrant) { return VibrantLightningColors; } return ClassicLightningColors; } } internal static void BindConfigs() { TemporalRiftSkipDisabledEnemies = DuskConfig.Bind<bool>("Temporal Rift Options", "Skip disabled enemies", true, "If true, temporal rifts will not spawn enemies marked as spawning disabled"); TemporalRiftRespectEnemyMaxCount = DuskConfig.Bind<bool>("Temporal Rift Options", "Respect enemy max count", false, "If true, temporal rifts will not spawn an enemy after its max count allowed on the moon is reached"); TemporalRiftUseCurrentMoonEnemyList = DuskConfig.Bind<bool>("Temporal Rift Options", "Use current moon enemy list", true, "If true, temporal rifts can only spawn enemies from the current moon's spawnable enemy lists. This option respects 'Inside/Outside enemy blacklists'"); TemporalRiftUnrestrictEnemySpawns = DuskConfig.Bind<bool>("Temporal Rift Options", "Unrestrict enemy spawns", false, "If true and StarlancerAIFix is installed, temporal rifts ignore inside/outside enemy location restrictions. This option respects 'Use current moon enemy list' and 'Inside/Outside enemy blacklists'"); TemporalRiftLocustSwarmChance = DuskConfig.Bind<float>("Temporal Rift Options", "Locust only rift chance", 0.85f, "Chance that a rift becomes a locust swarm when its first enemy wave begins, e.g. 0.85 = 85%"); TemporalRiftMinimumLocustWaveSize = DuskConfig.Bind<int>("Temporal Rift Options", "Min locust spawn count", 1, "Minimum number of locusts released in each wave from a locust swarm rift"); TemporalRiftMaximumLocustWaveSize = DuskConfig.Bind<int>("Temporal Rift Options", "Max locust spawn count", 3, "Maximum number of locusts released in each wave from a locust swarm rift"); TemporalRiftMinimumEnemyPowerBudget = DuskConfig.Bind<float>("Temporal Rift Options", "Minimum enemy power budget", 2f, "Minimum enemy power budget assigned to a temporal rift"); TemporalRiftMaximumEnemyPowerBudget = DuskConfig.Bind<float>("Temporal Rift Options", "Maximum enemy power budget", 4f, "Maximum enemy power budget assigned to a temporal rift"); TemporalRiftInsideEnemyBlacklist = DuskConfig.Bind<string>("Temporal Rift Options", "Inside enemy blacklist", "lethal_company:butler_bees,lethal_company:girl", "DawnLib enemy namespaced keys that inside temporal rifts cannot spawn, separated by commas"); TemporalRiftOutsideEnemyBlacklist = DuskConfig.Bind<string>("Temporal Rift Options", "Outside enemy blacklist", "lethal_company:red_locust_bees,lethal_company:manticoil,lethal_company:docile_locust_bees,lethal_company:feiopar,lethal_company:giantkiwi,lethal_company:bush_wolf,lethallib:sparktower,code_rebirth:tornado,code_rebirth:guardsman", "DawnLib enemy namespaced keys that outside temporal rifts cannot spawn, separated by commas"); EntityGlitchEnabled = DuskConfig.Bind<bool>("Temporal Storm Visual Options", "Entity Glitch Enabled", true, "If true, temporal instability can apply glitch materials to entities"); EntityGlitchPlayerModels = DuskConfig.Bind<bool>("Temporal Storm Visual Options", "Player models glitch", true, "If true, temporal instability can apply glitch materials to other player models"); EntityGlitchEnemyBlacklist = DuskConfig.Bind<string>("Temporal Storm Visual Options", "Enemy Blacklist", "lethal_company:girl,lethal_company:blob,lethal_company:clay_surgeon,surfaced:mantis_shrimp,surfaced:urchin,surfaced:horse,surfaced:scary,lethallib:shrimp,lethallib:sparktower,lethallib:tourist,lethallib:tour_bus,code_rebirth:tornado,code_rebirth:mistress,espira:phantom_bracken", "DawnLib enemy namespaced keys that cannot receive temporal glitch effects, separated by commas"); LightningPaletteSetting = DuskConfig.Bind<LightningPalette>("Temporal Storm Visual Options", "Lightning Palette", LightningPalette.Classic, "The colour palette used by rust lightning and Thunderlord roar lightning"); LandingHudWarningEnabled = DuskConfig.Bind<bool>("Temporal Storm Options", "Landing Warning Enabled", false, "If true, the Temporal Storm landing warning is displayed"); DaysPassedInstabilityAmount = DuskConfig.Bind<float>("Temporal Instability Options", "Days Passed Instability Increase Amount", 25f, "The maximum temporal instability added by days passed", 0f, 100f); DaysPassedInstabilityDays = DuskConfig.Bind<int>("Temporal Instability Options", "Days Passed Maximum Days Allowed", 50, "The day amount required to reach the maximum days passed temporal instability", 1, 1000); MoonTimeInstabilityEnabled = DuskConfig.Bind<bool>("Temporal Instability Options", "Moon Time Instability Enabled", true, "If true, moon time adds temporal instability during a storm"); MoonTimeInstabilityAmount = DuskConfig.Bind<float>("Temporal Instability Options", "Moon Time Instability Amount", 60f, "The total temporal instability added by moon time during a storm", 0f, 100f); ApparatusInstabilityEnabled = DuskConfig.Bind<bool>("Temporal Instability Options", "Apparatus Instability Enabled", true, "If true, removing the apparatus adds temporal instability"); ApparatusInstabilityAmount = DuskConfig.Bind<float>("Temporal Instability Options", "Apparatus Instability Amount", 20f, "The temporal instability added when the apparatus is removed", 0f, 100f); PlayerFacilityInstabilityEnabled = DuskConfig.Bind<bool>("Temporal Instability Options", "Player Facility Instability Enabled", true, "If true, players inside the facility add temporal instability over time"); FacilityInstabilityBasePerSecond = DuskConfig.Bind<float>("Temporal Instability Options", "Facility Instability Base Per Second", 0.08f, "The base temporal instability added per second while players are inside the facility", 0f, 1f); FacilityInstabilityPerPlayerPerSecond = DuskConfig.Bind<float>("Temporal Instability Options", "Facility Instability Per Player Per Second", 0.01f, "The additional temporal instability added per second for each player inside the facility", 0f, 1f); PlayerInsanityInstabilityEnabled = DuskConfig.Bind<bool>("Temporal Instability Options", "Player Insanity Instability Enabled", true, "If true, player insanity adds temporal instability over time"); PlayerInsanityThreshold = DuskConfig.Bind<float>("Temporal Instability Options", "Player Insanity Threshold", 40f, "The insanity level at which a player starts adding temporal instability", 0f, 50f); PlayerInsanityInstabilityPerSecond = DuskConfig.Bind<float>("Temporal Instability Options", "Player Insanity Instability Per Second", 0.01f, "The temporal instability added per second by each player above the insanity threshold", 0f, 1f); AudioPitchingEnabled = DuskConfig.Bind<bool>("Temporal Storm Audio Options", "Audio Pitching Enabled", true, "If true, temporal instability can pitch and filter active audio sources"); TemporalStormStingerEnabled = DuskConfig.Bind<bool>("Temporal Storm Audio Options", "Landing Stinger Enabled", true, "If true, a stinger plays when a Temporal Storm day starts"); MaxBackgroundAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Background Audio Volume", 0.7f, "The maximum volume level for background audio during Temporal Storms, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxTuningCylinderAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Tuning Cylinder Audio Volume", 0.85f, "The maximum volume level for tuning cylinder music, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxApproachingWarningAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Approaching Warning Audio Volume", 0.95f, "The maximum volume level for the first warning audio, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxImminentWarningAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Imminent Warning Audio Volume", 0.7f, "The maximum volume level for the second warning audio, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxLowStabilityAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Low Stability Warning Audio Volume", 0.9f, "The maximum volume level for third warning audio, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxWaningAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Waning Audio Volume", 0.9f, "The maximum volume level for bell audio that plays when the storm wanes, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); MaxWarningBellAudioVolume = DuskConfig.Bind<float>("Temporal Storm Audio Options", "Maximum Warning Bell Audio Volume", 0.9f, "The maximum volume level for bell audio that plays at each warning, e.g. 1 = 100% volume, 0.5 = 50% volume, etc."); ThunderlordRoarTimeBreakEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Time Break Enabled", true, "If true, the roar disrupts the current time"); ThunderlordRoarLandminesEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Landmine Detonation Enabled", true, "If true, the roar detonates active landmines"); ThunderlordRoarTurretsEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Turret Berserk Enabled", true, "If true, the roar sets active turrets to berserk mode"); ThunderlordRoarSteamValvesEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Steam Valve Cracking Enabled", true, "If true, the roar cracks active steam valves"); ThunderlordRoarLightFlickerEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Light Flicker Enabled", true, "If true, the roar flickers powered lights, flashlights and helmet lights"); ThunderlordRoarLightningEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Lightning Enabled", true, "If true, the roar fires its lightning barrage"); ThunderlordRoarShockwaveEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Shockwave Enabled", true, "If true, the roar creates its destructive shockwave"); ThunderlordRoarApparatusEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Apparatus Removal Enabled", true, "If true, the roar removes the apparatus"); ThunderlordRoarFacilityMeltdownEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Facility Meltdown Enabled", true, "If true and Facility Meltdown is installed, the roar starts a facility meltdown"); ThunderlordRoarEnemyStunEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Enemy Stun Enabled", true, "If true, the roar stuns active enemies"); ThunderlordRoarLostSignalEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "No Signal Enabled", true, "If true, the roar interrupts the ship monitor map"); ThunderlordRoarShipLightsEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Ship Lights Enabled", true, "If true, the roar turns off the ship lights"); ThunderlordRoarItemEffectsEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Outdoor Item Effects Enabled", true, "If true, the shockwave affects outdoor items"); ThunderlordRoarManeaterTransformationEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Baby Maneater Transformation Enabled", true, "If true, the roar transforms active baby Maneaters"); ThunderlordRoarEarthLeviathanEmergenceEnabled = DuskConfig.Bind<bool>("Thunderlord Roar Options", "Earth Leviathan Emergence Enabled", true, "If true, the roar causes underground Earth Leviathans to emerge"); DebugLogsEnabled = DuskConfig.Bind<bool>("Internal", "Enable Debug Logging", false, "If true, enables debug logging"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MrHat.TemporalStormWeather.Internals", "TemporalStormWeather", "0.1.8")] internal class Plugin : BaseUnityPlugin { private const string DawnLibGUID = "com.github.teamxiaolan.dawnlib"; private const string DuskGUID = "com.github.teamxiaolan.dawnlib.dusk"; private const string PathfindingLibGUID = "Zaggy1024.PathfindingLib"; private const string HatLibGUID = "MrHat.Lib"; private const string BasedItemSavingGUID = "MrHat.BasedItemSaving"; private const string CullFactoryGUID = "com.fumiko.CullFactory"; private const string BrutalCompanyMinusExtraRebornGUID = "SoftDiamond.BrutalCompanyMinusExtraReborn"; private const string StarlancerAIFixGUID = "AudioKnight.StarlancerAIFix"; private const string CoronerGUID = "com.elitemastereric.coroner"; private const string FacilityMeltdownGUID = "me.loaforc.facilitymeltdown"; private const string ModelReplacementAPIGUID = "meow.ModelReplacementAPI"; private const string ScandalLibGUID = "scandal.scandallib"; private const string FirstPersonViewGUID = "com.seeya.firstpersonview"; private const string CameraOverhaulGUID = "com.seeya.cameraoverhaul"; internal const string modGUID = "MrHat.TemporalStormWeather.Internals"; internal const string modName = "TemporalStormWeather"; internal const string modVersion = "0.1.8"; internal static ManualLogSource? mls; internal static bool hasBasedItemSaving; internal static bool hasCullFactory; internal static bool hasBCMER; internal static bool hasStarlancerAIFix; internal static bool hasCoroner; internal static bool hasFacilityMeltdown; internal static bool hasModelReplacementAPI; internal static bool hasScandalLib; private readonly Harmony _harmony = new Harmony("MrHat.TemporalStormWeather.Internals"); internal static Plugin Instance { get; private set; } private void Awake() { Instance = this; mls = Logger.CreateLogSource("MrHat.TemporalStormWeather.Internals"); Log.Info(" +++ +++"); Log.Info(" ++ ++++ ++++ ++"); Log.Info(" +++++ +++++++++++++++ +++++"); Log.Info(" +++++++++++++++++++++++++"); Log.Info(" ++++++++++++++++++++++++++++++++++++++"); Log.Info(" +++++++++++++++++++++++++++++++++++++"); Log.Info(" +++++++++++ ++++ +++++++++++"); Log.Info(" ++++++++++++++ ++++ ++++++++++++++"); Log.Info(" +++++++++++++ ++++ +++++++++++++"); Log.Info(" +++++++++++++ ++++++++ +++++++++++++"); Log.Info(" ++++++++ ++++++++++++++++++++++++ ++++++++"); Log.Info("+++++++++++ +++++++ ++++++ +++++++++++"); Log.Info("+++++++++++ ++++ ++++ +++++++++++"); Log.Info(" +++++++ ++++ ++++ +++++++"); Log.Info(" +++++++ ++++++ ++++++ +++++++"); Log.Info("++++++++++++ ++++++++++++++++++++++++ ++++++++++++"); Log.Info(" ++++++++++++++++ ++++++++ ++++++++++++++++"); Log.Info(" +++++++++ ++++ +++++++++"); Log.Info(" +++++++++++ ++++ ++++++++++"); Log.Info(" +++++++++++++++ ++++ +++++++++++++++"); Log.Info(" +++ ++++++++++++++++++++++++++++++++ +++"); Log.Info(" ++++++++++++++++++++++++++++++"); Log.Info(" ++++++++++++++++++++++++++++++++"); Log.Info(" ++ ++++++++++++++++++ ++"); Log.Info(" ++++ ++++ ++++"); Log.Info(" ++ ++++ ++"); hasBasedItemSaving = Chainloader.PluginInfos.ContainsKey("MrHat.BasedItemSaving"); hasCullFactory = Chainloader.PluginInfos.ContainsKey("com.fumiko.CullFactory"); hasBCMER = Chainloader.PluginInfos.ContainsKey("SoftDiamond.BrutalCompanyMinusExtraReborn"); hasStarlancerAIFix = Chainloader.PluginInfos.ContainsKey("AudioKnight.StarlancerAIFix"); hasCoroner = Chainloader.PluginInfos.ContainsKey("com.elitemastereric.coroner"); hasFacilityMeltdown = Chainloader.PluginInfos.ContainsKey("me.loaforc.facilitymeltdown"); hasModelReplacementAPI = Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI"); hasScandalLib = Chainloader.PluginInfos.ContainsKey("scandal.scandallib"); if (Chainloader.PluginInfos.ContainsKey("com.seeya.firstpersonview")) { Log.Warn("First Person View is incompatible with Temporal Storm camera shake"); } TemporalStormAssets.Load(); DawnLib.RegisterNetworkPrefab(TemporalStormAssets.temporalInstabilityNetworkPrefab); ConfigManager.BindConfigs(); DawnSaveManager.InitItemEffectSave(); StartOfRoundEvents.Register(); InitialiseNetworkSerialisation(); Log.Info("TemporalStormWeather 0.1.8 loaded"); _harmony.PatchAll(typeof(AudioSourcePatches)); _harmony.PatchAll(typeof(AutoParentToShipPatches)); _harmony.PatchAll(typeof(EnemyAIPatches)); _harmony.PatchAll(typeof(FlashlightItemPatches)); _harmony.PatchAll(typeof(GameNetworkManagerPatches)); _harmony.PatchAll(typeof(GrabbableObjectPatches)); _harmony.PatchAll(typeof(HUDManagerPatches)); _harmony.PatchAll(typeof(LungPropPatches)); _harmony.PatchAll(typeof(ManualCameraRendererPatches)); _harmony.PatchAll(typeof(MeteorShowersPatches)); _harmony.PatchAll(typeof(PlayAudioAnimationEventPatches)); _harmony.PatchAll(typeof(PlayerControllerBPatches)); _harmony.PatchAll(typeof(SoundManagerPatches)); _harmony.PatchAll(typeof(ShipBuildModeManagerPatches)); _harmony.PatchAll(typeof(StartOfRoundPatches)); _harmony.PatchAll(typeof(RoundManagerPatches)); _harmony.PatchAll(typeof(TimeOfDayPatches)); _harmony.PatchAll(typeof(StartMatchLeverPatches)); _harmony.PatchAll(typeof(VehicleControllerPatches)); if (hasBasedItemSaving) { Log.Debug("Running BasedItemSaving compatibility"); BasedItemSavingCompat.RegisterSurfaceExtensions(); Log.Info("BasedItemSaving compatibility enabled"); } if (hasCullFactory) { Log.Debug("Running CullFactory compatibility"); _harmony.PatchAll(typeof(CullFactoryCompat)); Log.Info("CullFactory compatibility enabled"); } if (hasBCMER) { Log.Debug("Running Brutal Company Minus Extra Reborn compatibility"); BCMERCompatibility.RegisterEvents(); Log.Info("Brutal Company Minus Extra Reborn compatibility enabled"); } if (hasCoroner) { Log.Debug("Running Coroner compatibility"); CoronerCompat.Register(); Log.Info("Coroner compatibility enabled"); } if (hasFacilityMeltdown) { Log.Info("Facility Meltdown compatibility enabled"); } if (hasModelReplacementAPI) { _harmony.PatchAll(typeof(ModelReplacementAPICompat)); Log.Info("ModelReplacementAPI compatibility enabled"); } if (hasScandalLib) { Log.Info("ScandalLib (ScanVan/Hauler/v55 Cruiser) compatibility enabled"); } } private static void InitialiseNetworkSerialisation() { MethodInfo methodInfo = typeof(Plugin).Assembly.GetType("__GEN.NetworkVariableSerializationHelper")?.GetMethod("InitializeSerialization", BindingFlags.Static | BindingFlags.NonPublic); if (methodInfo == null) { Log.Fatal("Netcode serialization method was not found"); } else { methodInfo.Invoke(null, null); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TemporalStormWeather"; public const string PLUGIN_NAME = "TemporalStormWeather"; public const string PLUGIN_VERSION = "0.1.8"; } } namespace TemporalStormWeather.Utils { internal static class Keys { public const string DuskGUID = "MrHat.TemporalStormWeather"; public const string AssetBundleName = "temporalstormotherassets"; public const string ThunderlordRoarAuraPath = "Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/VFX/ThunderlordRoarAura/ThunderlordRoarAura.vfx"; public const string AirborneRustParticlesPath = "Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/VFX/AirborneRustParticles/AirborneRustParticles.vfx"; public const string TemporalInstabilityNetworkPrefabPath = "Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/TemporalInstabilityNetwork.prefab"; public const string Namespace = "temporalstorm"; public const string TemporalStorm = "temporal_storm"; public const string ItemEffects = "item_effects"; public const string ResonatorCylinder = "resonator_cylinder"; public const string ScalesOfJustice = "scales_of_justice"; public const string TemporalGear = "temporal_gear"; public const string MadnessGear = "madness_gear"; public const string LocustEnemy = "locustenemy"; public const string SawbladeLocustEnemy = "sawbladelocustenemy"; public const string CorruptLocustEnemy = "corruptlocustenemy"; public static readonly NamespacedKey<DawnWeatherEffectInfo> TemporalStormWeather = NamespacedKey<DawnWeatherEffectInfo>.From("temporalstorm", "temporal_storm"); public static readonly NamespacedKey ItemEffectsSaveData = NamespacedKey.From("temporalstorm", "item_effects"); public static readonly NamespacedKey ResonatorCylinderSaveData = NamespacedKey.From("temporalstorm", "resonator_cylinder"); public static readonly NamespacedKey ScalesOfJusticeSaveData = NamespacedKey.From("temporalstorm", "scales_of_justice"); public static readonly NamespacedKey<DawnItemInfo> TemporalGearItem = NamespacedKey<DawnItemInfo>.From("temporalstorm", "temporal_gear"); public static readonly NamespacedKey<DawnItemInfo> MadnessGearItem = NamespacedKey<DawnItemInfo>.From("temporalstorm", "madness_gear"); public static readonly NamespacedKey<DawnEnemyInfo> LocustEnemyInfo = NamespacedKey<DawnEnemyInfo>.From("temporalstorm", "locustenemy"); public static readonly NamespacedKey<DawnEnemyInfo> SawbladeLocustEnemyInfo = NamespacedKey<DawnEnemyInfo>.From("temporalstorm", "sawbladelocustenemy"); public static readonly NamespacedKey<DawnEnemyInfo> CorruptLocustEnemyInfo = NamespacedKey<DawnEnemyInfo>.From("temporalstorm", "corruptlocustenemy"); } internal static class Log { public static void Debug(string message) { if (ConfigManager.DebugLogsEnabled.Value) { Write((LogLevel)32, message); } } public static void Info(string message) { Write((LogLevel)16, message); } public static void Warn(string message) { Write((LogLevel)4, message); } public static void Error(string message) { Write((LogLevel)2, message); } public static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } internal static class TemporalStormAssets { private static AssetBundle assetBundle; private static VisualEffectAsset thunderlordRoarAura; private static VisualEffectAsset airborneRustParticles; internal static GameObject temporalInstabilityNetworkPrefab; internal static VisualEffectAsset ThunderlordRoarAura => thunderlordRoarAura; internal static VisualEffectAsset AirborneRustParticles => airborneRustParticles; internal static void Load() { if (!((Object)(object)assetBundle != (Object)null)) { string directoryName = Path.GetDirectoryName(typeof(TemporalStormAssets).Assembly.Location); string text = Path.Combine(directoryName, "Assets", "temporalstormotherassets"); assetBundle = AssetBundle.LoadFromFile(text); thunderlordRoarAura = assetBundle.LoadAsset<VisualEffectAsset>("Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/VFX/ThunderlordRoarAura/ThunderlordRoarAura.vfx"); airborneRustParticles = assetBundle.LoadAsset<VisualEffectAsset>("Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/VFX/AirborneRustParticles/AirborneRustParticles.vfx"); temporalInstabilityNetworkPrefab = assetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/TemporalStormWeather/Content/Temporal Storm/TemporalInstabilityNetwork.prefab"); if ((Object)(object)thunderlordRoarAura == (Object)null) { Log.Error("Could not load the Thunderlord roar aura visual effect"); } if ((Object)(object)airborneRustParticles == (Object)null) { Log.Error("Could not load the Airborne Rust Particles visual effect"); } } } } internal static class Utility { public static void BindPositionConstraint(PositionConstraint positionConstraint, Transform sourceTransform) { //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_002c: Unknown result type (might be due to invalid IL or missing references) if (positionConstraint.sourceCount > 0) { ConstraintSource source = positionConstraint.GetSource(0); if (!((Object)(object)((ConstraintSource)(ref source)).sourceTransform == (Object)(object)sourceTransform)) { ((ConstraintSource)(ref source)).sourceTransform = sourceTransform; positionConstraint.SetSource(0, source); } } } public static float ClampInstability(float value) { return Mathf.Clamp(value, 0f, 100f); } public static float InstabilityProgress(float temporalInstabilityLevel, float startLevel, float fullLevel) { return Mathf.InverseLerp(startLevel, fullLevel, temporalInstabilityLevel); } public static Camera? PlayerCamera() { GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.localPlayerController == (Object)null) { return null; } PlayerControllerB localPlayerController = instance.localPlayerController; StartOfRound instance2 = StartOfRound.Instance; if (!localPlayerController.isPlayerDead || !((Object)(object)instance2 != (Object)null) || !((Object)(object)instance2.spectateCamera != (Object)null)) { return localPlayerController.gameplayCamera; } return instance2.spectateCamera; } public static bool IsInsideFactory() { GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.localPlayerController == (Object)null) { return false; } PlayerControllerB localPlayerController = instance.localPlayerController; if (!localPlayerController.isPlayerDead || !((Object)(object)localPlayerController.spectatedPlayerScript != (Object)null)) { return localPlayerController.isInsideFactory; } return localPlayerController.spectatedPlayerScript.isInsideFactory; } public static float RandomRange(Random random, float minimum, float maximum) { return Mathf.Lerp(minimum, maximum, (float)random.NextDouble()); } } internal readonly struct OriginalMaterialPropertyIds { public readonly int Texture; public readonly int Color; public readonly int AlphaClipThreshold; public readonly int NormalTexture; public readonly int NormalScale; public readonly int Smoothness; public readonly int Metallic; public OriginalMaterialPropertyIds(int texture, int color, int alphaClipThreshold, int normalTexture, int normalScale, int smoothness, int metallic = -1) { Texture = texture; Color = color; AlphaClipThreshold = alphaClipThreshold; NormalTexture = normalTexture; NormalScale = normalScale; Smoothness = smoothness; Metallic = metallic; } } internal readonly struct EffectMaterialPropertyIds { public readonly int BaseTexture; public readonly int BaseColorTint; public readonly int AlphaClipThreshold; public readonly int NormalTexture; public readonly int NormalScale; public readonly int Smoothness; public readonly int Metallic; public EffectMaterialPropertyIds(int baseTexture, int baseColorTint, int alphaClipThreshold, int normalTexture, int normalScale, int smoothness, int metallic = -1) { BaseTexture = baseTexture; BaseColorTint = baseColorTint; AlphaClipThreshold = alphaClipThreshold; NormalTexture = normalTexture; NormalScale = normalScale; Smoothness = smoothness; Metallic = metallic; } } internal enum MaterialPropertyCopyKind { Float, Color, Texture } internal static class MaterialUtils { private static readonly int alphaCutoffEnablePropertyId = Shader.PropertyToID("_AlphaCutoffEnable"); private static readonly int[] copiedFloatPropertyIds = new int[40] { Shader.PropertyToID("_SurfaceType"), Shader.PropertyToID("_BlendMode"), Shader.PropertyToID("_AlphaSrcBlend"), Shader.PropertyToID("_AlphaDstBlend"), Shader.PropertyToID("_SrcBlend"), Shader.PropertyToID("_DstBlend"), Shader.PropertyToID("_ZWrite"), Shader.PropertyToID("_TransparentZWrite"), Shader.PropertyToID("_ZTest"), Shader.PropertyToID("_ZTestDepthEqualForOpaque"), Shader.PropertyToID("_ZTestGBuffer"), Shader.PropertyToID("_ZTestTransparent"), Shader.PropertyToID("_CullMode"), Shader.PropertyToID("_CullModeForward"), Shader.PropertyToID("_TransparentCullMode"), Shader.PropertyToID("_AlphaCutoffEnable"), Shader.PropertyToID("_DoubleSidedEnable"), Shader.PropertyToID("_DoubleSidedNormalMode"), Shader.PropertyToID("_TransparentBackfaceEnable"), Shader.PropertyToID("_TransparentDepthPrepassEnable"), Shader.PropertyToID("_TransparentDepthPostpassEnable"), Shader.PropertyToID("_TransparentWritingMotionVec"), Shader.PropertyToID("_EnableFogOnTransparent"), Shader.PropertyToID("_ReceivesSSR"), Shader.PropertyToID("_ReceivesSSRTransparent"), Shader.PropertyToID("_TransparentSortPriority"), Shader.PropertyToID("_EnableBlendModePreserveSpecularLighting"), Shader.PropertyToID("_SpecularOcclusionMode"), Shader.PropertyToID("_ReceivesDecals"), Shader.PropertyToID("_GeometricSpecularAA"), Shader.PropertyToID("_UseShadowThreshold"), Shader.PropertyToID("_EmissiveIntensity"), Shader.PropertyToID("_EmissiveExposureWeight"), Shader.PropertyToID("_AlbedoAffectEmissive"), Shader.PropertyToID("_MetallicRemapMin"), Shader.PropertyToID("_MetallicRemapMax"), Shader.PropertyToID("_SmoothnessRemapMin"), Shader.PropertyToID("_SmoothnessRemapMax"), Shader.PropertyToID("_AORemapMin"), Shader.PropertyToID("_AORemapMax") }; private static readonly int[] copiedColorPropertyIds = new int[2] { Shader.PropertyToID("_DoubleSidedConstants"), Shader.PropertyToID("_EmissiveColor") }; private static readonly int[] copiedTexturePropertyIds = new int[6] { Shader.PropertyToID("_MaskMap"), Shader.PropertyToID("_BentNormalMap"), Shader.PropertyToID("_CoatMaskMap"), Shader.PropertyToID("_DetailMap"), Shader.PropertyToID("_EmissiveColorMap"), Shader.PropertyToID("_EmissionMap") }; private static readonly string[] copiedMaterialKeywords = new string[12] { "_ALPHATEST_ON", "_SURFACE_TYPE_TRANSPARENT", "_BLENDMODE_ALPHA", "_BLENDMODE_ADD", "_BLENDMODE_PRE_MULTIPLY", "_BLENDMODE_PRESERVE_SPECULAR_LIGHTING", "_ENABLE_FOG_ON_TRANSPARENT", "_ENABLE_SSR_TRANSPARENT", "_DOUBLESIDED_ON", "_NORMALMAP_TANGENT_SPACE", "_EMISSION", "_EMISSIVE_COLOR_MAP" }; public static bool IsCreatedEffectMaterial(Material? material, Material[]? originalMaterials, int materialIndex) { if ((Object)(object)material != (Object)null) { if (originalMaterials != null && materialIndex < originalMaterials.Length) { return (Object)(object)material != (Object)(object)originalMaterials[materialIndex]; } return true; } return false; } public static float CopyOriginalMaterialProperties(Material originalMaterial, Material effectMaterial, OriginalMaterialPropertyIds originalIds, EffectMaterialPropertyIds effectIds, float defaultAlphaClipThreshold) { //IL_0007: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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) effectMaterial.SetColor(effectIds.BaseColorTint, Color.white); float num = defaultAlphaClipThreshold; if ((Object)(object)originalMaterial == (Object)null) { return num; } effectMaterial.renderQueue = originalMaterial.renderQueue; effectMaterial.doubleSidedGI = originalMaterial.doubleSidedGI; effectMaterial.globalIlluminationFlags = originalMaterial.globalIlluminationFlags; effectMaterial.enableInstancing = originalMaterial.enableInstancing; string tag = originalMaterial.GetTag("RenderType", false, string.Empty); if (!string.IsNullOrEmpty(tag)) { effectMaterial.SetOverrideTag("RenderType", tag); } string tag2 = originalMaterial.GetTag("Queue", false, string.Empty); if (!string.IsNullOrEmpty(tag2)) { effectMaterial.SetOverrideTag("Queue", tag2); } for (int i = 0; i < copiedMaterialKeywords.Length; i++) { string text = copiedMaterialKeywords[i]; if (originalMaterial.IsKeywordEnabled(text)) { effectMaterial.EnableKeyword(text); } else { effectMaterial.DisableKeyword(text); } } CopyMatchingProperties(originalMaterial, effectMaterial, copiedFloatPropertyIds, MaterialPropertyCopyKind.Float); CopyMatchingProperties(originalMaterial, effectMaterial, copiedColorPropertyIds, MaterialPropertyCopyKind.Color); CopyMatchingProperties(originalMaterial, effectMaterial, copiedTexturePropertyIds, MaterialPropertyCopyKind.Texture); effectMaterial.SetShaderPassEnabled("TransparentBackface", originalMaterial.GetShaderPassEnabled("TransparentBackface")); CopyTextureProperties(originalMaterial, effectMaterial, originalIds.Texture, effectIds.BaseTexture, (Texture?)(object)Texture2D.whiteTexture); bool flag = (originalMaterial.HasProperty(alphaCutoffEnablePropertyId) && originalMaterial.GetFloat(alphaCutoffEnablePropertyId) > 0.5f) || originalMaterial.IsKeywordEnabled("_ALPHATEST_ON"); Color val = (originalMaterial.HasProperty(originalIds.Color) ? originalMaterial.GetColor(originalIds.Color) : Color.white); effectMaterial.SetColor(effectIds.BaseColorTint, val); if (originalMaterial.HasProperty(originalIds.AlphaClipThreshold) && effectMaterial.HasProperty(effectIds.AlphaClipThreshold)) { num = (flag ? originalMaterial.GetFloat(originalIds.AlphaClipThreshold) : 0f); effectMaterial.SetFloat(effectIds.AlphaClipThreshold, num); } else if (effectMaterial.HasProperty(effectIds.AlphaClipThreshold)) { num = (flag ? defaultAlphaClipThreshold : 0f); effectMaterial.SetFloat(effectIds.AlphaClipThreshold, num); } if (!flag) { SetFloatIfPresent(effectMaterial, alphaCutoffEnablePropertyId, 0f); effectMaterial.DisableKeyword("_ALPHATEST_ON"); } CopyTextureProperties(originalMaterial, effectMaterial, originalIds.NormalTexture, effectIds.NormalTexture); if (originalMaterial.HasProperty(originalIds.NormalScale) && effectMaterial.HasProperty(effectIds.NormalScale)) { effectMaterial.SetFloat(effectIds.NormalScale, originalMaterial.GetFloat(originalIds.NormalScale)); } if (originalMaterial.HasProperty(originalIds.Smoothness) && effectMaterial.HasProperty(effectIds.Smoothness)) { effectMaterial.SetFloat(effectIds.Smoothness, originalMaterial.GetFloat(originalIds.Smoothness)); } if (originalIds.Metallic >= 0 && effectIds.Metallic >= 0 && originalMaterial.HasProperty(originalIds.Metallic) && effectMaterial.HasProperty(effectIds.Metallic)) { effectMaterial.SetFloat(effectIds.Metallic, originalMaterial.GetFloat(originalIds.Metallic)); } return num; } public static void DestroyMaterials(Material[]? materials, Material[]? originalMaterials = null) { if (materials == null) { return; } for (int i = 0; i < materials.Length; i++) { Material val = materials[i]; if (IsCreatedEffectMaterial(val, originalMaterials, i)) { Object.Destroy((Object)(object)val); } } } public static void SetFloatOnCreatedMaterials(Material[]? materials, Material[]? originalMaterials, int propertyId, float value) { if (materials == null) { return; } for (int i = 0; i < materials.Length; i++) { Material val = materials[i]; if (IsCreatedEffectMaterial(val, originalMaterials, i)) { val.SetFloat(propertyId, value); } } } public static void CopyFromFirstProperty(Material? sourceMaterial, Material targetMaterial, int[] sourcePropertyIds, int targetPropertyId, MaterialPropertyCopyKind propertyKind, Texture? defaultTexture = null) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) if (!targetMaterial.HasProperty(targetPropertyId)) { return; } if ((Object)(object)sourceMaterial != (Object)null) { foreach (int num in sourcePropertyIds) { if (!sourceMaterial.HasProperty(num)) { continue; } switch (propertyKind) { case MaterialPropertyCopyKind.Float: targetMaterial.SetFloat(targetPropertyId, sourceMaterial.GetFloat(num)); return; case MaterialPropertyCopyKind.Color: targetMaterial.SetColor(targetPropertyId, sourceMaterial.GetColor(num)); return; case MaterialPropertyCopyKind.Texture: { Texture texture = sourceMaterial.GetTexture(num); if (!((Object)(object)texture == (Object)null)) { targetMaterial.SetTexture(targetPropertyId, texture); targetMaterial.SetTextureScale(targetPropertyId, sourceMaterial.GetTextureScale(num)); targetMaterial.SetTextureOffset(targetPropertyId, sourceMaterial.GetTextureOffset(num)); return; } break; } } } } if (propertyKind == MaterialPropertyCopyKind.Texture && (Object)(object)defaultTexture != (Object)null) { targetMaterial.SetTexture(targetPropertyId, defaultTexture); } } private static void CopyTextureProperties(Material originalMaterial, Material effectMaterial, int originalPropertyId, int effectPropertyId, Texture? defaultTexture = null) { //IL_005c: 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) if (!effectMaterial.HasProperty(effectPropertyId)) { return; } Texture val = (originalMaterial.HasProperty(originalPropertyId) ? originalMaterial.GetTexture(originalPropertyId) : null); if (!((Object)(object)val == (Object)null) || !((Object)(object)defaultTexture == (Object)null)) { if ((Object)(object)val != (Object)null) { effectMaterial.SetTexture(effectPropertyId, val); } else { effectMaterial.SetTexture(effectPropertyId, defaultTexture); } if (originalMaterial.HasProperty(originalPropertyId)) { effectMaterial.SetTextureScale(effectPropertyId, originalMaterial.GetTextureScale(originalPropertyId)); effectMaterial.SetTextureOffset(effectPropertyId, originalMaterial.GetTextureOffset(originalPropertyId)); } } } private static void SetFloatIfPresent(Material material, int propertyId, float value) { if (material.HasProperty(propertyId)) { material.SetFloat(propertyId, value); } } private static void CopyMatchingProperties(Material originalMaterial, Material effectMaterial, int[] propertyIds, MaterialPropertyCopyKind propertyKind) { //IL_0045: 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_007c: Unknown result type (might be due to invalid IL or missing references) foreach (int num in propertyIds) { if (!originalMaterial.HasProperty(num) || !effectMaterial.HasProperty(num)) { continue; } switch (propertyKind) { case MaterialPropertyCopyKind.Float: effectMaterial.SetFloat(num, originalMaterial.GetFloat(num)); break; case MaterialPropertyCopyKind.Color: effectMaterial.SetColor(num, originalMaterial.GetColor(num)); break; case MaterialPropertyCopyKind.Texture: { Texture texture = originalMaterial.GetTexture(num); if (!((Object)(object)texture == (Object)null)) { effectMaterial.SetTexture(num, texture); effectMaterial.SetTextureScale(num, originalMaterial.GetTextureScale(num)); effectMaterial.SetTextureOffset(num, originalMaterial.GetTextureOffset(num)); } break; } } } } } internal enum DawnItemPersistenceMode { PersistShip, Restore } internal static class DawnConfigUtils { public static HashSet<NamespacedKey<TInfo>> ParseNamespacedKeySet<TInfo>(string configuredKeys) where TInfo : INamespaced { HashSet<NamespacedKey<TInfo>> hashSet = new HashSet<NamespacedKey<TInfo>>(); if (string.IsNullOrWhiteSpace(configuredKeys)) { return hashSet; } string[] array = configuredKeys.Split(new char[4] { ',', ';', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); NamespacedKey val = default(NamespacedKey); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (NamespacedKey.TryParse(text, ref val)) { hashSet.Add(val.AsTyped<TInfo>()); } } return hashSet; } public static bool CanUseDawnItem(GrabbableObject item, bool includeNonConductive, DawnItemPersistenceMode persistenceMode) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item.itemProperties != (Object)null && (item.itemProperties.isConductiveMetal || includeNonConductive) && (Object)(object)((Component)item).GetComponent<TemporalGearItem>() == (Object)null && ItemExtensions.GetDawnInfo(item.itemProperties) != null && (persistenceMode != DawnItemPersistenceMode.PersistShip || item.isInShipRoom || ShipBoundsRegistry.Contains(((Component)item).transform.position)) && !item.isHeld && (Object)(object)item.playerHeldBy == (Object)null) { return !item.isHeldByEnemy; } return false; } } internal static class ItemUtils { public static uint Mix(uint value) { value ^= value >> 16; value *= 2246822519u; value ^= value >> 13; value *= 3266489917u; value ^= value >> 16; return value; } } internal static class TemporalMaterialUtils { public static void SetTemporalState(Renderer renderer, MaterialPropertyBlock propertyBlock, float glowStrength, float rustAmount) { renderer.GetPropertyBlock(propertyBlock); propertyBlock.SetFloat("_TemporalGlowStrength", glowStrength); propertyBlock.SetFloat("_TemporalRustAmount", rustAmount); renderer.SetPropertyBlock(propertyBlock); } } } namespace TemporalStormWeather.Unlockables { public class ResonatorSurface : PlaceableObjectsSurface { private const float RestoreSearchRadius = 12f; private const float PlaceTimeoutSeconds = 6f; private const string AnimationBoolName = "isPlaying"; private const float AnimationSpeedTransitionSeconds = 1f; private const float MinimumAudioReactiveScale = 1f; private const float MaximumAudioReactiveScale = 1.05f; private const float AudioReactiveStrength = 10f; private const float AudioReactiveSmoothingSeconds = 0.8f; private const float TemporalInstabilityStopThreshold = 80f; private const float TemporalInstabilityStopSeconds = 3f; private static readonly string ItemExtraDataKey = ((object)Keys.ResonatorCylinderSaveData).ToString(); [Header("Cylinder")] [SerializeField] private Transform cylinderPlacement; [SerializeField] private ScanNodeProperties scanNodeProperties; [SerializeField] private BoxCollider playingInteractCollider; [Header("Hover")] [SerializeField] private InteractTrigger resonatorStartInteractTrigger; private const string NoTuningCylinderHoverTip = "[No Tuning Cylinder inserted]"; private const string ResonatorActiveHoverTip = "[Resonator already active]"; private const string TemporalInstabilityShutdownHoverTip = "[Temporal Instability too high]"; [Header("Animation")] [SerializeField] private Animator resonatorAnimator; [Header("Audio")] [SerializeField] private AudioSource resonatorAudioSource; [SerializeField] private AudioClip cylinderPlacedClip; [SerializeField] private AudioClip cylinderRemovedClip; [SerializeField] private AudioClip resonatorStartedClip; [Header("Audio Reaction")] [SerializeField] private Transform audioReactiveScaleTarget; private TuningCylinderItem? storedCylinder; private TuningCylinderItem? pendingCylinder; private TuningCylinderItem? pendingSavedCylinder; private DawnSaveSync? cylinderSync; private string storedCylinderKey = string.Empty; private Coroutine? temporalInstabilityStopCoroutine; private BoxCollider placementCollider; private bool resonatorPlaying; private bool songStartPending; private bool animationSpeedChanging; private bool stopAnimationWhenFinished; private float pendingCylinderTimeout; private float songStartTime; private float animationStartSpeed; private float animationTargetSpeed; private float animationElapsedSeconds; private Vector3 audioReactiveBaseScale; private readonly float[] audioSamples = new float[64]; private float audioReactiveCurrentScale; private void Awake() { DawnItemSaveEvents.OnCollectExtraSaveData += CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData += LoadItemSaveData; cylinderSync = DawnSaveSync.Bind(Keys.ResonatorCylinderSaveData, (Func<string>)WriteStoredCylinderData, (Action<string>)RestoreStoredCylinder, false); } private void Start() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) placementCollider = ((Component)base.triggerScript).GetComponent<BoxCollider>(); resonatorAnimator.speed = 0f; resonatorAnimator.SetBool("isPlaying", false); audioReactiveBaseScale = audioReactiveScaleTarget.localScale; audioReactiveCurrentScale = 1f; RefreshStartInteractTrigger(); } private void LateUpdate() { //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pendingSavedCylinder != (Object)null) { TuningCylinderItem tuningCylinderItem = pendingSavedCylinder; pendingSavedCylinder = null; if (!HasStoredCylinder() && !((GrabbableObject)tuningCylinderItem).isHeld && (Object)(object)((GrabbableObject)tuningCylinderItem).playerHeldBy == (Object)null && !((GrabbableObject)tuningCylinderItem).isHeldByEnemy) { AttachCylinder(tuningCylinderItem, playPlacedSound: false); Log.Debug("Resonator cylinder restored from Dawn item data"); } } if ((Object)(object)pendingCylinder != (Object)null) { if (Time.realtimeSinceStartup >= pendingCylinderTimeout) { pendingCylinder = null; } else if (!((GrabbableObject)pendingCylinder).isHeld && (Object)(object)((GrabbableObject)pendingCylinder).playerHeldBy == (Object)null && !((GrabbableObject)pendingCylinder).isHeldByEnemy) { TuningCylinderItem cylinder = pendingCylinder; pendingCylinder = null; AttachCylinder(cylinder, playPlacedSound: true); } } if ((Object)(object)storedCylinder == (Object)null) { if (!((Collider)placementCollider).enabled) { storedCylinderKey = string.Empty; StopTemporalInstabilityShutdown(); StopResonatorAnimation(); StopAudioReaction(); scanNodeProperties.subText = string.Empty; RefreshStartInteractTrigger(); ((Collider)placementCollider).enabled = true; } } else { TuningCylinderItem tuningCylinderItem2 = storedCylinder; if (((GrabbableObject)tuningCylinderItem2).isHeld || (Object)(object)((GrabbableObject)tuningCylinderItem2).playerHeldBy != (Object)null || ((GrabbableObject)tuningCylinderItem2).isHeldByEnemy) { DetachCylinder(tuningCylinderItem2); } else { ApplyCylinderTransform(tuningCylinderItem2); } } if (songStartPending && Time.time >= songStartTime) { songStartPending = false; TuningCylinderItem tuningCylinderItem3 = storedCylinder; if (resonatorPlaying && (Object)(object)tuningCylinderItem3 != (Object)null && HasStoredCylinder()) { if (TemporalInstabilityAPI.GetServerInstabilityLevel(out var temporalInstabilityLevel) && temporalInstabilityLevel >= 80f) { StopResonatorAnimation(); } else { tuningCylinderItem3.PlaySong(); scanNodeProperties.subText = tuningCylinderItem3.SongDisplayName; } } } if (animationSpeedChanging) { animationElapsedSeconds += Time.deltaTime; float num = Mathf.Clamp01(animationElapsedSeconds / 1f); resonatorAnimator.speed = Mathf.Lerp(animationStartSpeed, animationTargetSpeed, num); if (num >= 1f) { animationSpeedChanging = false; if (stopAnimationWhenFinished) { resonatorAnimator.SetBool("isPlaying", false); if (temporalInstabilityStopCoroutine == null) { ((Collider)playingInteractCollider).enabled = true; } RefreshStartInteractTrigger(); } } } if (!resonatorPlaying || songStartPending) { return; } TuningCylinderItem tuningCylinderItem4 = storedCylinder; if ((Object)(object)tuningCylinderItem4 == (Object)null) { StopAudioReaction(); return; } AudioSource songAudioSource = tuningCylinderItem4.SongAudioSource; if (!songAudioSource.isPlaying) { StopAudioReaction(); return; } if (TemporalInstabilityAPI.GetServerInstabilityLevel(out var temporalInstabilityLevel2) && temporalInstabilityLevel2 >= 80f) { CoroutineTools.Restart((MonoBehaviour)(object)this, ref temporalInstabilityStopCoroutine, StopForTemporalInstability(tuningCylinderItem4)); return; } songAudioSource.GetOutputData(audioSamples, 0); float num2 = 0f; for (int i = 0; i < audioSamples.Length; i++) { num2 += Mathf.Abs(audioSamples[i]); } float num3 = Mathf.Clamp01(num2 / (float)audioSamples.Length * 10f); float num4 = Mathf.Lerp(1f, 1.05f, num3); float num5 = 1f - Mathf.Exp((0f - Time.deltaTime) / Mathf.Max(0.001f, 0.8f)); audioReactiveCurrentScale = Mathf.Lerp(audioReactiveCurrentScale, num4, num5); audioReactiveScaleTarget.localScale = audioReactiveBaseScale * audioReactiveCurrentScale; } public override void OnDestroy() { DawnItemSaveEvents.OnCollectExtraSaveData -= CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData -= LoadItemSaveData; pendingSavedCylinder = null; if ((Object)(object)storedCylinder != (Object)null && Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Allow((GrabbableObject)(object)storedCylinder); } DawnSaveSync? obj = cylinderSync; if (obj != null) { obj.Disable(); } ((NetworkBehaviour)this).OnDestroy(); } public void StartResonator() { if (HasStoredCylinder() && !resonatorPlaying && (!TemporalInstabilityAPI.GetServerInstabilityLevel(out var temporalInstabilityLevel) || !(temporalInstabilityLevel >= 80f))) { RequestStartResonatorRpc(); } } [Rpc(/*Could not decode attribute arguments.*/)] private void RequestStartResonatorRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4145759038u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4145759038u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (HasStoredCylinder() && !resonatorPlaying && (!TemporalInstabilityAPI.GetServerInstabilityLevel(out var temporalInstabilityLevel) || !(temporalInstabilityLevel >= 80f))) { ConfirmStartResonatorRpc(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void ConfirmStartResonatorRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(858130537u, val3, val, (SendTo)7, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 858130537u, val3, val, (SendTo)7, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (HasStoredCylinder() && !resonatorPlaying && (!TemporalInstabilityAPI.GetServerInstabilityLevel(out var temporalInstabilityLevel) || !(temporalInstabilityLevel >= 80f))) { resonatorPlaying = true; RefreshStartInteractTrigger(); ((Collider)playingInteractCollider).enabled = false; resonatorAnimator.SetBool("isPlaying", true); AudioTools.PlayOneShot(resonatorAudioSource, resonatorStartedClip); songStartTime = Time.time + resonatorStartedClip.length; songStartPending = true; RampAnimatorSpeed(1f, stopAnimation: false); } } } public void PlaceObject(PlayerControllerB playerWhoTriggered) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) TuningCylinderItem tuningCylinderItem = default(TuningCylinderItem); if (playerWhoTriggered.isHoldingObject && !playerWhoTriggered.isGrabbingObjectAnimation && !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null) && ((Component)playerWhoTriggered.currentlyHeldObjectServer).TryGetComponent<TuningCylinderItem>(ref tuningCylinderItem) && !HasStoredCylinder()) { RequestPlaceRpc((int)playerWhoTriggered.playerClientId, new NetworkObjectReference(((NetworkBehaviour)tuningCylinderItem).NetworkObject)); } } internal bool TryGetDisabledHoverTip(PlayerControllerB player, InteractTrigger trigger, out string disabledHoverTip) { TuningCylinderItem tuningCylinderItem = default(TuningCylinderItem); if ((Object)(object)trigger == (Object)(object)base.triggerScript && (HasStoredCylinder() || !player.isHoldingObject || player.isGrabbingObjectAnimation || (Object)(object)player.currentlyHeldObjectServer == (Object)null || !((Component)player.currentlyHeldObjectServer).TryGetComponent<TuningCylinderItem>(ref tuningCylinderItem))) { disabledHoverTip = trigger.disabledHoverTip; return true; } disabledHoverTip = string.Empty; return false; } [Rpc(/*Could not decode attribute arguments.*/)] private void RequestPlaceRpc(int playerWhoTriggered, NetworkObjectReference cylinderReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_0095: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2248419768u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerWhoTriggered); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref cylinderReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2248419768u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (base.parentTo.IsSpawned && !HasStoredCylinder()) { PlaceableShipObject componentInChildren = ((Component)base.parentTo).gameObject.GetComponentInChildren<PlaceableShipObject>(); componentInChildren.lastTimeScrapWasPlaced = Time.realtimeSinceStartup; ConfirmPlaceRpc(playerWhoTriggered, cylinderReference); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void ConfirmPlaceRpc(int playerId, NetworkObjectReference cylinderReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: 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) //IL_0064: 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_0081: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3887734062u, val3, val, (SendTo)7, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref cylinderReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3887734062u, val3, val, (SendTo)7, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && (int)localPlayerController.playerClientId == playerId && localPlayerController.isHoldingObject && !localPlayerController.isGrabbingObjectAnimation && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null) { Vector3 val4 = ((Component)base.parentTo).transform.InverseTransformPoint(cylinderPlacement.position); localPlayerController.DiscardHeldObject(true, base.parentTo, val4, false); } pendingCylinderTimeout = Time.realtimeSinceStartup + 6f; NetworkRefs.WhenReady<TuningCylinderItem>((MonoBehaviour)(object)this, cylinderReference, (Action<TuningCylinderItem>)delegate(TuningCylinderItem cylinder) { pendingCylinder = cylinder; }, 6f, 0); } } private void AttachCylinder(TuningCylinderItem cylinder, bool playPlacedSound) { storedCylinder = cylinder; pendingCylinder = null; NamespacedKey<DawnItemInfo> val = FindItems.DawnKey((GrabbableObject)(object)cylinder); if (val != null) { storedCylinderKey = ((object)val).ToString(); } if (Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Ignore((GrabbableObject)(object)cylinder); } cylinder.LoadSong(); ApplyCylinderTransform(cylinder); scanNodeProperties.subText = string.Empty; ((Collider)placementCollider).enabled = false; if (playPlacedSound) { AudioTools.PlayOneShot(resonatorAudioSource, cylinderPlacedClip); } RefreshStartInteractTrigger(); } private void DetachCylinder(TuningCylinderItem cylinder) { if (Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Allow((GrabbableObject)(object)cylinder); } cylinder.StopSong(); cylinder.UnloadSong(); AudioTools.PlayOneShot(resonatorAudioSource, cylinderRemovedClip); StopTemporalInstabilityShutdown(); StopResonatorAnimation(); StopAudioReaction(); scanNodeProperties.subText = string.Empty; if ((Object)(object)storedCylinder == (Object)(object)cylinder) { storedCylinder = null; storedCylinderKey = string.Empty; } ((Collider)placementCollider).enabled = true; RefreshStartInteractTrigger(); } private string WriteStoredCylinderData() { return storedCylinderKey; } private void CollectItemSaveData(GrabbableObject item, JObject extraData) { if ((Object)(object)storedCylinder == (Object)(object)item) { extraData[ItemExtraDataKey] = JToken.op_Implicit(true); } } private void LoadItemSaveData(GrabbableObject item, JObject extraData) { if (item is TuningCylinderItem tuningCylinderItem) { JToken obj = extraData[ItemExtraDataKey]; if (obj != null && obj.ToObject<bool>()) { pendingSavedCylinder = tuningCylinderItem; } } } private void RestoreStoredCylinder(string rawItemKey) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (HasStoredCylinder() || (Object)(object)pendingSavedCylinder != (Object)null) { return; } storedCylinderKey = rawItemKey; if (!string.IsNullOrWhiteSpace(rawItemKey)) { GrabbableObject val = FindItems.ClosestTo(cylinderPlacement.position, 12f, (Func<GrabbableObject, bool>)((GrabbableObject item) => item is TuningCylinderItem && ((object)FindItems.DawnKey(item))?.ToString() == rawItemKey && !item.isHeld && (Object)(object)item.playerHeldBy == (Object)null && !item.isHeldByEnemy && (!Plugin.hasBasedItemSaving || !BasedItemSavingCompat.IsIgnored(item)))); if (val is TuningCylinderItem cylinder) { AttachCylinder(cylinder, playPlacedSound: false); Log.Debug("Resonator cylinder restored"); } } } private bool HasStoredCylinder() { if ((Object)(object)storedCylinder != (Object)null && !((GrabbableObject)storedCylinder).isHeld && (Object)(object)((GrabbableObject)storedCylinder).playerHeldBy == (Object)null) { return !((GrabbableObject)storedCylinder).isHeldByEnemy; } return false; } private void RefreshStartInteractTrigger() { bool flag = HasStoredCylinder(); float temporalInstabilityLevel; bool flag2 = TemporalInstabilityAPI.GetServerInstabilityLevel(out temporalInstabilityLevel) && temporalInstabilityLevel >= 80f; bool flag3 = flag && !resonatorPlaying && !flag2; resonatorStartInteractTrigger.interactable = flag3; if (!flag3) { resonatorStartInteractTrigger.disabledHoverTip = ((!flag) ? "[No Tuning Cylinder inserted]" : (resonatorPlaying ? "[Resonator already active]" : (flag2 ? "[Temporal Instability too high]" : "[No Tuning Cylinder inserted]"))); } } private void ApplyCylinderTransform(TuningCylinderItem cylinder) { //IL_0012: 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) GrabbablePlacement.Place((GrabbableObject)(object)cylinder, ((Component)base.parentTo).transform, cylinderPlacement.position, cylinderPlacement.rotation); } private void StopResonatorAnimation() { resonatorPlaying = false; songStartPending = false; RampAnimatorSpeed(0f, stopAnimation: true); } private void RampAnimatorSpeed(float targetSpeed, bool stopAnimation) { animationStartSpeed = resonatorAnimator.speed; animationTargetSpeed = targetSpeed; animationElapsedSeconds = 0f; animationSpeedChanging = true; stopAnimationWhenFinished = stopAnimation; } private IEnumerator StopForTemporalInstability(TuningCylinderItem cylinder) { StopResonatorAnimation(); scanNodeProperties.subText = string.Empty; yield return cylinder.StopSong(3f); StopAudioReaction(); ((Collider)playingInteractCollider).enabled = true; temporalInstabilityStopCoroutine = null; } private void StopTemporalInstabilityShutdown() { if (temporalInstabilityStopCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(temporalInstabilityStopCoroutine); temporalInstabilityStopCoroutine = null; } } private void StopAudioReaction() { //IL_0007: 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) audioReactiveScaleTarget.localScale = audioReactiveBaseScale * 1f; audioReactiveCurrentScale = 1f; } protected override void __initializeVariables() { ((PlaceableObjectsSurface)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4145759038u, new RpcReceiveHandler(__rpc_handler_4145759038), "RequestStartResonatorRpc"); ((NetworkBehaviour)this).__registerRpc(858130537u, new RpcReceiveHandler(__rpc_handler_858130537), "ConfirmStartResonatorRpc"); ((NetworkBehaviour)this).__registerRpc(2248419768u, new RpcReceiveHandler(__rpc_handler_2248419768), "RequestPlaceRpc"); ((NetworkBehaviour)this).__registerRpc(3887734062u, new RpcReceiveHandler(__rpc_handler_3887734062), "ConfirmPlaceRpc"); ((PlaceableObjectsSurface)this).__initializeRpcs(); } private static void __rpc_handler_4145759038(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ResonatorSurface)(object)target).RequestStartResonatorRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_858130537(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ResonatorSurface)(object)target).ConfirmStartResonatorRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2248419768(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerWhoTriggered = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoTriggered); NetworkObjectReference cylinderReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref cylinderReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ResonatorSurface)(object)target).RequestPlaceRpc(playerWhoTriggered, cylinderReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3887734062(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); NetworkObjectReference cylinderReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref cylinderReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ResonatorSurface)(object)target).ConfirmPlaceRpc(playerId, cylinderReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ResonatorSurface"; } } public class ScalesOfJustice : PlaceableObjectsSurface { private struct PendingSavedItem { public GrabbableObject Item; public bool PlaceOnLeft; } [Serializable] private class SavedItem { public string ItemKey = string.Empty; public Vector3 TranformPosition; } [Serializable] private class SaveData { public SavedItem Left = new SavedItem(); public SavedItem Right = new SavedItem(); } private const float MaximumBalanceAngle = 10f; private const float BalanceSpeed = 90f; private const float RestoreSearchRadius = 12f; private static readonly string ItemExtraDataKey = ((object)Keys.ScalesOfJusticeSaveData).ToString(); [Header("Placement")] [SerializeField] private Transform leftItemTransform; [SerializeField] private Transform rightItemTransform; [SerializeField] private InteractTrigger leftPlacementTrigger; [SerializeField] private InteractTrigger rightPlacementTrigger; [Header("Balance")] [SerializeField] private Transform balanceBeam; [SerializeField] private Transform pivotLeftSuspension; [SerializeField] private Transform pivotRightSuspension; [Header("Audio")] [SerializeField] private AudioSource weightAudioSource; [FormerlySerializedAs("weightLoweredClip")] [SerializeField] private AudioClip scaleLoweredClip; [FormerlySerializedAs("weightLessenedClip")] [SerializeField] private AudioClip scaleUnloweredClip; private readonly NetworkVariable<NetworkObjectReference> leftItemReference = new NetworkVariable<NetworkObjectReference>(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<NetworkObjectReference> rightItemReference = new NetworkVariable<NetworkObjectReference>(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly List<PendingSavedItem> pendingSavedItems = new List<PendingSavedItem>(); private GrabbableObject leftItem; private GrabbableObject rightItem; private DawnSaveSync? scalesSync; private Collider leftPlacementCollider; private Collider rightPlacementCollider; private Quaternion balanceRestRotation; private Quaternion leftSuspensionRestRotation; private Quaternion rightSuspensionRestRotation; private bool leftItemAttached; private bool rightItemAttached; private bool LeftPanOccupied { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) NetworkObjectReference value = leftItemReference.Value; return !((NetworkObjectReference)(ref value)).Equals(default(NetworkObjectReference)); } } private bool RightPanOccupied { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) NetworkObjectReference value = rightItemReference.Value; return !((NetworkObjectReference)(ref value)).Equals(default(NetworkObjectReference)); } } private void Awake() { DawnItemSaveEvents.OnCollectExtraSaveData += CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData += LoadItemSaveData; base.triggerScript = leftPlacementTrigger; scalesSync = DawnSaveSync.Bind(Keys.ScalesOfJusticeSaveData, (Func<string>)WriteSaveData, (Action<string>)RestoreItems, false); } private void Start() { //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_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_0029: 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) balanceRestRotation = balanceBeam.localRotation; leftSuspensionRestRotation = pivotLeftSuspension.localRotation; rightSuspensionRestRotation = pivotRightSuspension.localRotation; leftPlacementCollider = ((Component)leftPlacementTrigger).GetComponent<Collider>(); rightPlacementCollider = ((Component)rightPlacementTrigger).GetComponent<Collider>(); ((UnityEvent<PlayerControllerB>)(object)leftPlacementTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)PlaceLeftItem); ((UnityEvent<PlayerControllerB>)(object)rightPlacementTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)PlaceRightItem); } public override void OnNetworkSpawn() { //IL_0051: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0078: Unknown result type (might be due to invalid IL or missing references) NetworkVariable<NetworkObjectReference> obj = leftItemReference; obj.OnValueChanged = (OnValueChangedDelegate<NetworkObjectReference>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<NetworkObjectReference>(OnLeftItemReferenceChanged)); NetworkVariable<NetworkObjectReference> obj2 = rightItemReference; obj2.OnValueChanged = (OnValueChangedDelegate<NetworkObjectReference>)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<NetworkObjectReference>(OnRightItemReferenceChanged)); OnLeftItemReferenceChanged(default(NetworkObjectReference), leftItemReference.Value); OnRightItemReferenceChanged(default(NetworkObjectReference), rightItemReference.Value); } public override void OnNetworkDespawn() { NetworkVariable<NetworkObjectReference> obj = leftItemReference; obj.OnValueChanged = (OnValueChangedDelegate<NetworkObjectReference>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<NetworkObjectReference>(OnLeftItemReferenceChanged)); NetworkVariable<NetworkObjectReference> obj2 = rightItemReference; obj2.OnValueChanged = (OnValueChangedDelegate<NetworkObjectReference>)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<NetworkObjectReference>(OnRightItemReferenceChanged)); } private void Update() { GameNetworkManager instance = GameNetworkManager.Instance; bool flag = (Object)(object)instance != (Object)null && (Object)(object)instance.localPlayerController != (Object)null && instance.localPlayerController.isHoldingObject; leftPlacementTrigger.interactable = flag && !LeftPanOccupied; rightPlacementTrigger.interactable = flag && !RightPanOccupied; } private void LateUpdate() { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0159: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01b8: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) RestoreItemSaveData(); if (((NetworkBehaviour)this).IsServer && (Object)(object)leftItem != (Object)null && leftItemAttached && IsNoLongerOnScale(leftItem)) { RemoveLeftItem(); } if (((NetworkBehaviour)this).IsServer && (Object)(object)rightItem != (Object)null && rightItemAttached && IsNoLongerOnScale(rightItem)) { RemoveRightItem(); } if ((Object)(object)leftItem != (Object)null) { leftItemAttached = KeepItemOnScale(leftItem, leftItemTransform) || leftItemAttached; } if ((Object)(object)rightItem != (Object)null) { rightItemAttached = KeepItemOnScale(rightItem, rightItemTransform) || rightItemAttached; } leftPlacementCollider.enabled = !LeftPanOccupied; rightPlacementCollider.enabled = !RightPanOccupied; float num = ItemWeight(leftItem); float num2 = ItemWeight(rightItem); float num3 = Mathf.Max(num, num2); float num4 = ((num3 <= 0f) ? 0f : ((num2 - num) / num3)); float num5 = num4 * 10f; Quaternion val = balanceRestRotation * Quaternion.AngleAxis(num5, Vector3.forward); Quaternion val2 = leftSuspensionRestRotation * Quaternion.AngleAxis(0f - num5, Vector3.forward); Quaternion val3 = rightSuspensionRestRotation * Quaternion.AngleAxis(0f - num5, Vector3.forward); balanceBeam.localRotation = Quaternion.RotateTowards(balanceBeam.localRotation, val, 90f * Time.deltaTime); pivotLeftSuspension.localRotation = Quaternion.RotateTowards(pivotLeftSuspension.localRotation, val2, 90f * Time.deltaTime); pivotRightSuspension.localRotation = Quaternion.RotateTowards(pivotRightSuspension.localRotation, val3, 90f * Time.deltaTime); } public override void OnDestroy() { DawnItemSaveEvents.OnCollectExtraSaveData -= CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData -= LoadItemSaveData; pendingSavedItems.Clear(); ((UnityEvent<PlayerControllerB>)(object)leftPlacementTrigger.onInteract).RemoveListener((UnityAction<PlayerControllerB>)PlaceLeftItem); ((UnityEvent<PlayerControllerB>)(object)rightPlacementTrigger.onInteract).RemoveListener((UnityAction<PlayerControllerB>)PlaceRightItem); if (Plugin.hasBasedItemSaving) { if ((Object)(object)leftItem != (Object)null) { BasedItemSavingCompat.Allow(leftItem); } if ((Object)(object)rightItem != (Object)null) { BasedItemSavingCompat.Allow(rightItem); } } DawnSaveSync? obj = scalesSync; if (obj != null) { obj.Disable(); } ((NetworkBehaviour)this).OnDestroy(); } private void PlaceLeftItem(PlayerControllerB player) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!LeftPanOccupied && player.isHoldingObject && !player.isGrabbingObjectAnimation && !((Object)(object)player.currentlyHeldObjectServer == (Object)null)) { RequestItemPlacementRpc((int)player.playerClientId, new NetworkObjectReference(((NetworkBehaviour)player.currentlyHeldObjectServer).NetworkObject), placeOnLeft: true); } } private void PlaceRightItem(PlayerControllerB player) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!RightPanOccupied && player.isHoldingObject && !player.isGrabbingObjectAnimation && !((Object)(object)player.currentlyHeldObjectServer == (Object)null)) { RequestItemPlacementRpc((int)player.playerClientId, new NetworkObjectReference(((NetworkBehaviour)player.currentlyHeldObjectServer).NetworkObject), placeOnLeft: false); } } [Rpc(/*Could not decode attribute arguments.*/)] private void RequestItemPlacementRpc(int playerId, NetworkObjectReference itemReference, bool placeOnLeft) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_0095: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage !