Decompiled source of ScienceBird Tweaks v4.0.0
ScienceBird.ScienceBirdTweaks.dll
Decompiled 11 hours 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.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DigitalRuby.ThunderAndLightning; using Dissonance.Config; using GameNetcodeStuff; using HarmonyLib; using JLLItemsModule.Components; using LethalLevelLoader; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using ScienceBird.ScienceBirdTweaks.NetcodePatcher; using ScienceBirdTweaks.ModPatches; using ScienceBirdTweaks.Patches; using ScienceBirdTweaks.Scripts; using SelfSortingStorage.Cupboard; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; using WesleyMoonScripts.Components; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScienceBird.ScienceBirdTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0+2a4be21ceebbb8b4f8786b3fee0e3834e991603a")] [assembly: AssemblyProduct("ScienceBirdTweaks")] [assembly: AssemblyTitle("ScienceBird.ScienceBirdTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ScienceBirdTweaks { public class LobbyCompatibility { public static void RegisterCompatibility() { if (ScienceBirdTweaks.ClientsideMode.Value) { PluginHelper.RegisterPlugin("ScienceBird.ScienceBirdTweaks", Version.Parse("4.0.0"), (CompatibilityLevel)0, (VersionStrictness)0); } else { PluginHelper.RegisterPlugin("ScienceBird.ScienceBirdTweaks", Version.Parse("4.0.0"), (CompatibilityLevel)2, (VersionStrictness)0); } } } public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } public static event Action<string> LevelEvent; public override void OnNetworkSpawn() { NetworkHandler.LevelEvent = null; if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null) { GameObject gameObject = ((Component)Instance).gameObject; if (gameObject != null) { NetworkObject component = gameObject.GetComponent<NetworkObject>(); if (component != null) { component.Despawn(true); } } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ClientRpc] public void EventClientRpc(string eventName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3412331623u, val, (RpcDelivery)0); bool flag = eventName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3412331623u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkHandler.LevelEvent?.Invoke(eventName); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkHandler() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3412331623u, new RpcReceiveHandler(__rpc_handler_3412331623)); } private static void __rpc_handler_3412331623(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string eventName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).EventClientRpc(eventName); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkHandler"; } } [HarmonyPatch] public class NetworkObjectManager { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (!((Object)(object)networkPrefab != (Object)null) && !ScienceBirdTweaks.ClientsideMode.Value) { networkPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("SBTweaksNetworkHandler"); networkPrefab.AddComponent<NetworkHandler>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !ScienceBirdTweaks.ClientsideMode.Value) { GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } } [BepInPlugin("ScienceBird.ScienceBirdTweaks", "ScienceBirdTweaks", "4.0.0")] [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.*/)] public class ScienceBirdTweaks : BaseUnityPlugin { public static AssetBundle TweaksAssets; public static ConfigEntry<bool> ClientsideMode; public static ConfigEntry<bool> FixedShipObjects; public static ConfigEntry<bool> OnlyFixDefault; public static ConfigEntry<bool> AlternateFixLogic; public static ConfigEntry<bool> FixedSuitRack; public static ConfigEntry<bool> ConsistentCatwalkCollision; public static ConfigEntry<bool> TinyTeleporterCollision; public static ConfigEntry<bool> BegoneBottomCollision; public static ConfigEntry<bool> LargerLeverCollision; public static ConfigEntry<bool> FloodlightRotation; public static ConfigEntry<int> FloodLightIntensity; public static ConfigEntry<int> FloodLightAngle; public static ConfigEntry<int> FloodLightRange; public static ConfigEntry<float> FloodLightRotationSpeed; public static ConfigEntry<bool> RemoveClipboard; public static ConfigEntry<bool> RemoveStickyNote; public static ConfigEntry<bool> RemoveTeleporterCord; public static ConfigEntry<bool> RemoveLongTube; public static ConfigEntry<bool> RemoveGenerator; public static ConfigEntry<bool> RemoveHelmet; public static ConfigEntry<bool> RemoveOxygenTanks; public static ConfigEntry<bool> RemoveBoots; public static ConfigEntry<bool> RemoveAirFilter; public static ConfigEntry<bool> RemoveBatteries; public static ConfigEntry<float> TinyTeleporterSizeX; public static ConfigEntry<float> TinyTeleporterSizeY; public static ConfigEntry<float> TinyTeleporterSizeZ; public static ConfigEntry<float> LargerLeverSizeX; public static ConfigEntry<float> LargerLeverSizeY; public static ConfigEntry<float> LargerLeverSizeZ; public static ConfigEntry<bool> BigScrew; public static ConfigEntry<bool> ClientShipItems; public static ConfigEntry<bool> PauseMenuFlickerFix; public static ConfigEntry<bool> FallingRotationFix; public static ConfigEntry<bool> OldHalloweenElevatorMusic; public static ConfigEntry<bool> MineDisableAnimation; public static ConfigEntry<bool> SpikeTrapDisableAnimation; public static ConfigEntry<string> ZapGunTutorialMode; public static ConfigEntry<bool> ZapGunTutorialRevamp; public static ConfigEntry<int> ZapGunTutorialCount; public static ConfigEntry<bool> ZapGunRework; public static ConfigEntry<string> ZapScanPriority; public static ConfigEntry<float> ZapGunBattery; public static ConfigEntry<bool> ZappableTurrets; public static ConfigEntry<float> TurretZapBaseCooldown; public static ConfigEntry<bool> ZappableMines; public static ConfigEntry<float> MineZapBaseCooldown; public static ConfigEntry<bool> ZappableSpikeTraps; public static ConfigEntry<float> SpikeTrapBaseCooldown; public static ConfigEntry<float> ZapScalingFactor; public static ConfigEntry<bool> ZappableBigDoors; public static ConfigEntry<bool> PlayerLethalBigDoors; public static ConfigEntry<bool> EnemyLethalBigDoors; public static ConfigEntry<bool> ShotgunMasterDisable; public static ConfigEntry<bool> ShowAmmo; public static ConfigEntry<string> SafetyOnString; public static ConfigEntry<string> SafetyOffString; public static ConfigEntry<bool> UnloadShells; public static ConfigEntry<bool> PickUpGunOrbit; public static ConfigEntry<bool> PickUpShellsOrbit; public static ConfigEntry<bool> DustSpaceClouds; public static ConfigEntry<bool> ThickDustClouds; public static ConfigEntry<float> DustCloudsThickness; public static ConfigEntry<bool> DustCloudsNoise; public static ConfigEntry<bool> PreventWorthlessDespawn; public static ConfigEntry<bool> UsePreventDespawnList; public static ConfigEntry<string> PreventedDespawnList; public static ConfigEntry<bool> ZeroDespawnPreventedItems; public static ConfigEntry<string> CustomWorthlessDisplayText; public static ConfigEntry<string> WorthlessDisplayTextBlacklist; public static ConfigEntry<bool> TrueBlackout; public static ConfigEntry<int> BlackoutFloodLightIntensity; public static ConfigEntry<int> BlackoutFloodLightAngle; public static ConfigEntry<int> BlackoutFloodLightRange; public static ConfigEntry<string> TrueBlackoutNameBlacklist; public static ConfigEntry<string> TrueBlackoutHierarchyBlacklist; public static ConfigEntry<string> CentipedeMode; public static ConfigEntry<float> CentipedeFixedDamage; public static ConfigEntry<int> CentipedeSecondChanceThreshold; public static ConfigEntry<bool> BlackoutOnApparatusRemoval; public static ConfigEntry<bool> DisableTrapsOnApparatusRemoval; public static ConfigEntry<bool> DropMasks; public static ConfigEntry<int> MaskScrapValue; public static ConfigEntry<bool> JLLNoisemakerFix; public static ConfigEntry<bool> LLLUnlockSyncing; public static ConfigEntry<bool> VideoTapeInsertFix; public static ConfigEntry<bool> VideoTapeSkip; public static ConfigEntry<bool> SSSTerminalStock; public static ConfigEntry<bool> DiversityComputerBegone; public static ConfigEntry<bool> MrovWeatherTweaksAnnouncement; public static ConfigEntry<bool> DebugMode; public static ConfigEntry<bool> ExtraLogs; public static bool doLobbyCompat; public static bool mrovPresent1; public static bool mrovPresent2; public static bool mrovPresent3; public static bool mrovPresent4; public static bool zigzagPresent; public static bool wesleyPresent; public static bool jacobPresent; public static bool batbyPresent; public static Vector3 ConfigTeleporterSize; public static Vector3 ConfigLeverSize; public static ScienceBirdTweaks Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Expected O, but got Unknown //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Expected O, but got Unknown //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Expected O, but got Unknown //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Expected O, but got Unknown //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Expected O, but got Unknown //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Expected O, but got Unknown //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Expected O, but got Unknown //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Expected O, but got Unknown //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Expected O, but got Unknown //IL_0b67: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Expected O, but got Unknown //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) //IL_0baa: Expected O, but got Unknown //IL_0bf1: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Expected O, but got Unknown //IL_0c2e: Unknown result type (might be due to invalid IL or missing references) //IL_0c38: Expected O, but got Unknown //IL_0c61: Unknown result type (might be due to invalid IL or missing references) //IL_0c6b: Expected O, but got Unknown //IL_0cb7: Unknown result type (might be due to invalid IL or missing references) //IL_0cc1: Expected O, but got Unknown //IL_0e04: Unknown result type (might be due to invalid IL or missing references) //IL_0e09: Unknown result type (might be due to invalid IL or missing references) //IL_0e2c: Unknown result type (might be due to invalid IL or missing references) //IL_0e31: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Instance = this; ClientsideMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Clientside", "Client-side Mode", false, "EXPERIMENTAL - Enable this if you want to use the mod client-side (i.e. if other players don't have the mod)."); FixedShipObjects = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Fixed Ship Objects", true, "Stops all furniture/unlockable hitboxes from drifting/jittering players on takeoff and landing by properly parenting them to the ship (including teleporter button, welcome mat, etc.)."); OnlyFixDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Only Fix Vanilla Objects", true, "Only applies the ship object parenting to fix to all the vanilla furniture it's relevant to. You can disable this if you want all furniture to be fixed, but doing so may cause some errors in the console and a bit of lag when loading in."); AlternateFixLogic = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Alternate Fix Logic", false, "EXPERIMENTAL - Simplifies parenting fix code. Try this if you're having any unexpected issues with ship objects/furniture (this is automatically used when in client-side mode)."); FixedSuitRack = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Fixed Suit Rack", true, "Stops suits' hitboxes from drifting on takeoff and landing by properly parenting them to the ship."); ConsistentCatwalkCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Consistent Catwalk Collision", true, "Ship catwalk has consistent collision outside its railing, so you can always jump and stand on the edge of the catwalk (not compatible with Wider Ship Mod)."); TinyTeleporterCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Tiny Teleporter Collision", true, "Shrinks the teleporter and inverse teleporter placement colliders (i.e. just their hitboxes) so they can be put next to all walls and in small nooks of the ship (customizable in Collider Sizes config section)."); BegoneBottomCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Begone Bottom Collision", false, "Removes collision from components underneath the ship, making it easier to get underneath if you need to (still depending on the moon)."); LargerLeverCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Larger Lever Collision", false, "Makes the ship's start lever hitbox larger and thus easier to pull (customizable in Collider Sizes config section)."); FloodlightRotation = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks", "Rotating Floodlight", false, "The ship's top-mounted floodlight will rotate while landed."); FloodLightRotationSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks", "Ship Floodlight Rotation Speed", 45f, new ConfigDescription("Rotation speed of the ship's floodlights", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>())); FloodLightIntensity = ((BaseUnityPlugin)this).Config.Bind<int>("Ship Tweaks", "Ship Floodlight Intensity", 2275, new ConfigDescription("Lumen value of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 60000), Array.Empty<object>())); FloodLightAngle = ((BaseUnityPlugin)this).Config.Bind<int>("Ship Tweaks", "Ship Floodlight Angle", 115, new ConfigDescription("Light angle (degrees) of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 180), Array.Empty<object>())); FloodLightRange = ((BaseUnityPlugin)this).Config.Bind<int>("Ship Tweaks", "Ship Floodlight Range", 45, new ConfigDescription("Light range (meters) of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>())); RemoveClipboard = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Clipboard", false, "Removes the service manual clipboard."); RemoveStickyNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Sticky Note", false, "Removes the 'ACCESS FILE: SIGURD' hint sticky note."); RemoveTeleporterCord = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Teleporter Cord", false, "Removes the cord trailing off the teleporter button (which won't connect to the teleporter if you move it)."); RemoveLongTube = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Long Tube", false, "Removes the long tube trailing off the generator and across the floor of the ship."); RemoveGenerator = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Generator", false, "Removes the generator next to the door."); RemoveHelmet = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Helmet", false, "Removes the helmet on the counter by the main monitor."); RemoveOxygenTanks = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Oxygen Tanks", false, "Removes the oxygen tanks leaning against the wall."); RemoveBoots = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Boots", false, "Removes the boots by the suit rack."); RemoveAirFilter = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Air Filter", false, "Removes the air filter in the corner by the monitors."); RemoveBatteries = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship Tweaks Removals", "Batteries", false, "Removes the batteries strewn across the desk by the monitors."); TinyTeleporterSizeX = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Tiny Teleporter Size X", 1.5f, "Vanilla: 2.48"); TinyTeleporterSizeY = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Tiny Teleporter Size Y", 4f, "(Height) Vanilla: 6"); TinyTeleporterSizeZ = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Tiny Teleporter Size Z", 1.6f, "Vanilla: 2.6"); LargerLeverSizeX = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Larger Lever Size X", 1.25f, "(Length, e.g. from lever to monitor screen) Vanilla: 1"); LargerLeverSizeY = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Larger Lever Size Y", 1.75f, "(Height) Vanilla: 1"); LargerLeverSizeZ = ((BaseUnityPlugin)this).Config.Bind<float>("Ship Tweaks Collider Sizes", "Larger Lever Size Z", 1.65f, "(Width, e.g. left to right edge of monitor) Vanilla: 1"); BigScrew = ((BaseUnityPlugin)this).Config.Bind<bool>("General Tweaks", "Big Screw", true, "'Big bolt' is accurately renamed to 'Big screw'."); ClientShipItems = ((BaseUnityPlugin)this).Config.Bind<bool>("General Tweaks", "Joining Client Items Fix", true, "When clients join, items aren't normally registered as being inside the ship (meaning you'll see a 'collected' pop-up if you grab them). This fixes that."); FallingRotationFix = ((BaseUnityPlugin)this).Config.Bind<bool>("General Tweaks", "Falling Rotation Fix", false, "Normally, if you ever drop an object from really high up, its rotation takes so long to change that it's still rotating when it hits the ground. This tweak properly scales the rotation so objects land normally."); PauseMenuFlickerFix = ((BaseUnityPlugin)this).Config.Bind<bool>("General Tweaks", "Pause Menu Flicker Fix", false, "'Fixes' the resume button flickering when pausing the game by making the currently selected option always highlighted (will look slightly strange)."); OldHalloweenElevatorMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("General Tweaks", "Old Halloween Elevator Music", false, "Restores mineshaft elevator to its old Halloween behaviour, playing a random selection of groovy tracks (disabled if ButteryStancakes' HalloweenElevator is installed)."); MineDisableAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Mine Cooldown Animation", false, "Changes mine lights and sound effects to reflect that it's been disabled (by terminal or otherwise). This is automatically enabled if using the zap gun rework."); SpikeTrapDisableAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Spike Trap Cooldown Animation", false, "Changes spike trap lights to reflect that it's been disabled (by terminal or otherwise). This is automatically enabled if using the zap gun rework."); ZapGunTutorialMode = ((BaseUnityPlugin)this).Config.Bind<string>("Zap Gun & Hazards", "Zap Gun Tutorial Mode", "Only First Time", new ConfigDescription("'Only First Time': All players will see the tutorial arrow their first few times using the zap gun and never again (I assume this is what's supposed to happen in vanilla). - 'Every Session': All players will see the tutorial arrow the first few times using the zap gun every time they restart the game. - 'Always': All players will always see the tutorial arrow whenever they use the zap gun. - 'Vanilla': Some players (generally the host) always see the tutorial arrow, while others never see it.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "Only First Time", "Every Session", "Always", "Vanilla" }), Array.Empty<object>())); ZapGunTutorialCount = ((BaseUnityPlugin)this).Config.Bind<int>("Zap Gun & Hazards", "Zap Gun Tutorial Count", 2, new ConfigDescription("How many times the tutorial arrow should be displayed (if using 'Only First Time' or 'Every Session' in above config. Vanilla is 2.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 15), Array.Empty<object>())); ZapGunTutorialRevamp = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zap Gun Tutorial Revamp", false, "Changes the mouse graphic in the tutorial to be positioned relative to how much you need to correct the beam (instead of fixed swipes across the arrow)."); ZapGunRework = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zap Gun Rework", false, "Activates all of the following config options below, which allow the zap gun to temporarily disable various traps the same way the terminal does (depending on how long you zap them)"); ZapScanPriority = ((BaseUnityPlugin)this).Config.Bind<string>("Zap Gun & Hazards", "Zap Target Priority", "Doors, Enemies, Traps, Players", "Replaces vanilla scan logic to prioritize certain entities in the order specified by this list (if you want to edit the list, use the exact same set of words, not case-sensitive)."); ZapGunBattery = ((BaseUnityPlugin)this).Config.Bind<float>("Zap Gun & Hazards", "Zap Gun Battery", 22f, new ConfigDescription("The battery life of the zap gun (vanilla is 22, pro-flashlight battery is 300 for reference)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 150f), Array.Empty<object>())); ZappableTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zappable Turrets", true, "Allows you to disable turrets with the zap gun."); TurretZapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Zap Gun & Hazards", "Zapped Turret Cooldown", 7f, new ConfigDescription("Base cooldown of the turret when zapped (will be more or less than this depending how long it's zapped for). Default value is the vanilla value for being disabled by the terminal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); ZappableMines = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zappable Mines", true, "Allows you to disable mines with the zap gun."); MineZapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Zap Gun & Hazards", "Zapped Mine Cooldown", 3.2f, new ConfigDescription("Base cooldown of the mine when zapped (will be more or less than this depending how long it's zapped for). Default value is the vanilla value for being disabled by the terminal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); ZappableSpikeTraps = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zappable Spike Traps", true, "Allows you to disable spike traps with the zap gun."); SpikeTrapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Zap Gun & Hazards", "Zapped Spike Trap Cooldown", 7f, new ConfigDescription("Base cooldown of the spike trap when zapped (will be more or less than this depending how long it's zapped for). Default value is the vanilla value for being disabled by the terminal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); ZapScalingFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Zap Gun & Hazards", "Zap Stun Scaling Factor", 0.25f, new ConfigDescription("This is multiplied by the amount of time spent zapping to make the multiplier for the stun time. Decrease this to make stuns shorter, increase this to make them longer", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.03f, 3f), Array.Empty<object>())); ZappableBigDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Zappable Facility Doors", true, "Allows you to hold open the big airlock/pressure doors in the facility interior while zapping them."); PlayerLethalBigDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Deadly Facility Doors", true, "Players will be killed by the big facility doors when they close (this usually includes if you try to walk through them while zapping them)."); EnemyLethalBigDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap Gun & Hazards", "Facility Doors Deadly To Enemies", true, "Enemies are also killed if they happen to be caught in the facility doors (only if they are normally killable)."); DustSpaceClouds = ((BaseUnityPlugin)this).Config.Bind<bool>("Better Dust Clouds", "Dust Space Clouds", true, "Adds a space to the 'DustClouds' weather whenever it's displayed, making it 'Dust Clouds' (note this weather is unused in vanilla, will only be present with certain modded content)."); ThickDustClouds = ((BaseUnityPlugin)this).Config.Bind<bool>("Better Dust Clouds", "Thick Dust Clouds", false, "Makes Dust Clouds visually thicker and more obscuring, in addition to various other internal changes to how the weather is handled, completely replacing vanilla behaviour (note this weather is unused in vanilla, will only be present with certain modded content)."); DustCloudsThickness = ((BaseUnityPlugin)this).Config.Bind<float>("Better Dust Clouds", "Dust Clouds Thickness", 8f, new ConfigDescription("How far you should be able to see in Dust Clouds (lower means thicker clouds). Vanilla value is 17.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 40f), Array.Empty<object>())); DustCloudsNoise = ((BaseUnityPlugin)this).Config.Bind<bool>("Better Dust Clouds", "Dust Clouds Noise", false, "Adds howling wind noise during Dust Clouds weather, the same you hear on blizzard moons like Rend and Dine (note this weather is unused in vanilla, will only be present with certain modded content)."); PreventWorthlessDespawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Selective Scrap Keeping", "Keep Worthless Scrap", true, "You won't lose scrap with zero value after your full crew dies."); UsePreventDespawnList = ((BaseUnityPlugin)this).Config.Bind<bool>("Selective Scrap Keeping", "Keep Specific Scrap", false, "You won't lose scrap from the list in the following config option."); PreventedDespawnList = ((BaseUnityPlugin)this).Config.Bind<string>("Selective Scrap Keeping", "Scrap To Keep", "Shotgun", "Comma separated list of items that should be kept even if everybody dies (e.g. 'Shotgun, Frieren')."); ZeroDespawnPreventedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Selective Scrap Keeping", "Zero Kept Scrap", true, "When a piece of scrap from the prior config list is kept, its scrap value is set to zero."); CustomWorthlessDisplayText = ((BaseUnityPlugin)this).Config.Bind<string>("Selective Scrap Keeping", "Worthless Display Text", "Value: Priceless", "Custom scan text to display for scrap items with zero value when it's brought back to the ship (set to empty to skip)"); WorthlessDisplayTextBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Selective Scrap Keeping", "Worthless Display Text Blacklist", "Shotgun", "Comma separated list of scrap items that will not have their scan text changed."); ShotgunMasterDisable = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun QOL", "Master Disable", false, "Reject all changes made by this mod to shotguns, leaving vanilla behaviour untouched (turn this on to disable all shotgun changes)."); ShowAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun QOL", "Show Loaded Shells", false, "Shows how many shells your shotgun has left in the top-right tooltips."); SafetyOnString = ((BaseUnityPlugin)this).Config.Bind<string>("Shotgun QOL", "Shotgun Safety On Tip", "The safety is on : [Q]", "Customize the tooltip for the shotgun safety toggle (vanilla: 'Turn safety off: [Q]')."); SafetyOffString = ((BaseUnityPlugin)this).Config.Bind<string>("Shotgun QOL", "Shotgun Safety Off Tip", "The safety is off : [Q]", "Customize the tooltip for the shotgun safety toggle (vanilla: 'Turn safety on: [Q]')."); UnloadShells = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun QOL", "Unload Shells", false, "Allows you to eject shells already in the shotgun by pressing the reload button (E) while you have no shells to load in your inventory. Top-right tooltips are dynamically adjusted accordingly."); PickUpGunOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun QOL", "Pick Up Gun In Orbit", false, "Allows you to pick up the gun while the ship is in orbit."); PickUpShellsOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun QOL", "Pick Up Shells In Orbit", true, "Allows you to pick up shells while the ship is in orbit (enabled for ease of use with 'Unload Shells')."); BlackoutOnApparatusRemoval = ((BaseUnityPlugin)this).Config.Bind<bool>("Blackout", "Apparatus True Blackout", false, "Triggers a more comprehensive blackout on apparatus removal, affecting all lights inside and out, along with any emissive materials (does not affects sun)."); DisableTrapsOnApparatusRemoval = ((BaseUnityPlugin)this).Config.Bind<bool>("Blackout", "Apparatus Hazard Blackout", false, "Also disables all traps/hazards on the map after removing the apparatus."); TrueBlackout = ((BaseUnityPlugin)this).Config.Bind<bool>("Blackout", "MrovWeathers True Blackout", true, "Revamps MrovWeathers' blackout so emissive materials are also darkened (no white spots left over), more lights are included, and problematic ones are excluded (like map hazards and outdoor apparatuses)."); TrueBlackoutNameBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Blackout", "MrovWeathers True Blackout Name Blacklist", "GunBarrelPos, BulletParticleFlare, LightSphere, Landmine, AnimContainer, BlackoutIgnore, ItemShip, ThrusterContainer", "A blacklist of object names to leave untouched during a blackout. If a light object's parent has the same name as one of these names, it will be skipped. This must be a comma-separated list and is case-sensitive. It is highly recommended you do not remove any of the default values unless you really know what you're doing."); TrueBlackoutHierarchyBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Blackout", "MrovWeathers True Blackout Hierarchy Blacklist", "", "A blacklist of objects to leave untouched during a blackout. If a light object is found anywhere underneath these names in the hierarchy, it will be skipped. This must be a comma-separated list and is case-sensitive. It is recommended to use Name Blacklist whenever possible for performance reasons."); BlackoutFloodLightIntensity = ((BaseUnityPlugin)this).Config.Bind<int>("Blackout", "Ship Floodlight Intensity in Lumen", 30000, new ConfigDescription("Lumen value of the ship's floodlights during MrovWeathers' blackout, (vanilla is 2275 Lumens). Set to 0 to disable floodlights during blackouts.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 60000), Array.Empty<object>())); BlackoutFloodLightAngle = ((BaseUnityPlugin)this).Config.Bind<int>("Blackout", "Ship Floodlight Angle in degrees", 80, new ConfigDescription("Light angle (degrees) of the ship's floodlights during MrovWeathers' blackout, (vanilla is 115 degrees).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 180), Array.Empty<object>())); BlackoutFloodLightRange = ((BaseUnityPlugin)this).Config.Bind<int>("Blackout", "Ship Floodlight Range", 600, new ConfigDescription("Light range (meters) of the ship's floodlights during MrovWeathers' blackout, (vanilla is 44m)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>())); CentipedeMode = ((BaseUnityPlugin)this).Config.Bind<string>("Gameplay Tweaks", "Snare Flea Mode", "Vanilla", new ConfigDescription("'Vanilla': Unchanged. - 'Second Chance': Implements the singleplayer 'second chance' mechanic in multiplayer, giving each player a chance to escape once it damages them to low HP. - 'Fixed Damage': Will damage a player for an exact proportion of their maximum health (at the same speed as vanilla).", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Vanilla", "Second Chance", "Fixed Damage" }), Array.Empty<object>())); CentipedeFixedDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay Tweaks", "Snare Flea Fixed Damage", 0.5f, new ConfigDescription("The proportion of a player's maximum health to take if using the 'Fixed Damage' mode. When set to 50% or above, this effectively gives the player a second chance only if they're above half health (the lower this is set, the more chances).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); CentipedeSecondChanceThreshold = ((BaseUnityPlugin)this).Config.Bind<int>("Gameplay Tweaks", "Snare Flea Second Chance Threshold", 15, new ConfigDescription("At what threshold of health should the snare flea drop off the player if it's using the 'Second Chance' mode (vanilla value in singleplayer is 15 HP).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); DropMasks = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay Tweaks", "Gimme That Mask", false, "Allows you to grab the masks off of dead masked enemies and sell them (will not work if you have any mod which removes the masks from masked enemies)"); MaskScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Gameplay Tweaks", "Dropped Mask Scrap Value", 25, new ConfigDescription("The average scrap value of masks recovered from masked enemies (will vary slightly below and above this).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>())); JLLNoisemakerFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "JLL Noisemaker Fix", true, "Fixes an inconsistent issue where JLL spawners wouldn't initialize items correctly, resulting in errors and the item not functioning correctly (for example: Wesley's Moons audio logs not playing when used)."); LLLUnlockSyncing = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "LLL Unlock Syncing", false, "Sends the host's unlocked moons to the clients after they load in, so any moons unlocked by the host will be unlocked by the client as well."); VideoTapeInsertFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "Wesley Moons Tape Insert Fix", false, "EXPERIMENTAL - For Wesley's Moons: attempts to fix an issue where clients are unable to insert cassette tapes into the projector (might also fix issues with registering story log items)."); VideoTapeSkip = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "Wesley Moons Video Tape Skip", false, "For Wesley's Moons: after inserting a casette tape on Galetry, you can interact with the cassette player again to skip the video and unlock the moon immediately."); MrovWeatherTweaksAnnouncement = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "Weather Tweaks Announcement Change", false, "Makes the wording more clear when a weather change is announced, stating the current weather and the weather it's going to be transitioned into."); SSSTerminalStock = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "Smart Cupboard Mrov Terminal Stock", true, "If you are using both Self Sorting Storage (which adds the 'smart cupboard') and mrov's TerminalFormatter (which shows a count of items on the ship), items in the cupboard will be counted on the terminal display."); DiversityComputerBegone = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Tweaks", "Diversity Computer Begone", false, "Removes the floppy reader computer from Diversity and any floppy disks that spawn (does nothing if Diversity isn't installed)."); DebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "Debug Mode", false, "For testing certain interactions and resetting some variables. Do not enable unless you know what you're doing."); ExtraLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "Verbose Logs", false, "Extra logging for debugging specific functions."); ConfigTeleporterSize = new Vector3(TinyTeleporterSizeX.Value, TinyTeleporterSizeY.Value, TinyTeleporterSizeZ.Value); ConfigLeverSize = new Vector3(LargerLeverSizeX.Value, LargerLeverSizeY.Value, LargerLeverSizeZ.Value); KeepScrapPatches.Initialize(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); TweaksAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "tweaksassets")); Patch(); Logger.LogInfo((object)"ScienceBird.ScienceBirdTweaks v4.0.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("ScienceBird.ScienceBirdTweaks"); } Logger.LogDebug((object)"Patching..."); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name == "BMX.LobbyCompatibility") { Logger.LogDebug((object)"Found BMX!"); doLobbyCompat = true; } if (assembly.GetName().Name == "MrovWeathers") { Logger.LogDebug((object)"Found mrov1!"); mrovPresent1 = true; } else if (assembly.GetName().Name == "WeatherRegistry") { Logger.LogDebug((object)"Found mrov2!"); mrovPresent2 = true; } else if (assembly.GetName().Name == "TerminalFormatter") { Logger.LogDebug((object)"Found mrov3!"); mrovPresent3 = true; } else if (assembly.GetName().Name == "WeatherTweaks") { Logger.LogDebug((object)"Found mrov4!"); mrovPresent4 = true; } else if (assembly.GetName().Name == "SelfSortingStorage") { Logger.LogDebug((object)"Found zigzag!"); zigzagPresent = true; } else if (assembly.GetName().Name == "WesleyMoons") { Logger.LogDebug((object)"Found wesley!"); wesleyPresent = true; } else if (assembly.GetName().Name == "JLLItemsModule") { Logger.LogDebug((object)"Found jacob!"); jacobPresent = true; } else if (assembly.GetName().Name == "LethalLevelLoader") { Logger.LogDebug((object)"Found batby!"); batbyPresent = true; } } if (doLobbyCompat) { LobbyCompatibility.RegisterCompatibility(); } if (mrovPresent1 && mrovPresent2 && TrueBlackout.Value) { MrovWeathersPatch.DoPatching(); } if (zigzagPresent && mrovPresent3 && SSSTerminalStock.Value) { SSSPatch.DoPatching(); } if (wesleyPresent && (VideoTapeSkip.Value || VideoTapeInsertFix.Value)) { WesleyPatches.DoPatching(); } if (batbyPresent && LLLUnlockSyncing.Value) { LLLPatches.DoPatching(); } if (jacobPresent && JLLNoisemakerFix.Value) { JLLPatches.DoPatching(); } Harmony.PatchAll(); NetcodePatcher(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } private static void NetcodePatcher() { if (ClientsideMode.Value) { return; } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { if ((!methodInfo.Name.Contains("CheckUnlocksClientRpc") || batbyPresent) && (!methodInfo.Name.Contains("CollectDataServerRpc") || zigzagPresent) && (!methodInfo.Name.Contains("SendDataClientRpc") || zigzagPresent) && (!methodInfo.Name.Contains("ResetDictClientRpc") || zigzagPresent) && (!methodInfo.Name.Contains("StopTapeServerRpc") || wesleyPresent) && (!methodInfo.Name.Contains("StopTapeClientRpc") || wesleyPresent)) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } public class WesleyTapeSkip : NetworkBehaviour { public void StopTape() { ScienceBirdTweaks.Logger.LogDebug((object)"Stop tape called!"); LevelCassetteLoader currentLoader = TapeSkipPatches.currentLoader; if ((Object)(object)currentLoader != (Object)null) { StopTapeServerRpc(); return; } ScienceBirdTweaks.Logger.LogWarning((object)"Loader not obtained from patch, searching manually..."); currentLoader = Object.FindObjectOfType<LevelCassetteLoader>(); if ((Object)(object)currentLoader != (Object)null) { StopTapeServerRpc(); } else { ScienceBirdTweaks.Logger.LogError((object)"Couldn't find loader in scene, exiting skip procedure."); } } [ServerRpc(RequireOwnership = false)] public void StopTapeServerRpc() { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(134654531u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 134654531u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StopTapeClientRpc(); } } } [ClientRpc] public void StopTapeClientRpc() { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(307242747u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 307242747u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ScienceBirdTweaks.Logger.LogDebug((object)"Stopping tape early..."); LevelCassetteLoader currentLoader = TapeSkipPatches.currentLoader; if ((Object)(object)currentLoader != (Object)null) { MethodInfo method = typeof(LevelCassetteLoader).GetMethod("TapeEnded", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(currentLoader, new object[0]); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_WesleyTapeSkip() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(134654531u, new RpcReceiveHandler(__rpc_handler_134654531)); NetworkManager.__rpc_func_table.Add(307242747u, new RpcReceiveHandler(__rpc_handler_307242747)); } private static void __rpc_handler_134654531(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; ((WesleyTapeSkip)(object)target).StopTapeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_307242747(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)2; ((WesleyTapeSkip)(object)target).StopTapeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WesleyTapeSkip"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ScienceBird.ScienceBirdTweaks"; public const string PLUGIN_NAME = "ScienceBirdTweaks"; public const string PLUGIN_VERSION = "4.0.0"; } } namespace ScienceBirdTweaks.ZapGun { public class DoorZapper : NetworkBehaviour, IShockableWithGun { private TerminalAccessibleObject terminalObj; public bool stunned = false; public bool masterZappable = true; private void Start() { ((Component)this).gameObject.layer = 21; terminalObj = ((Component)this).GetComponent<TerminalAccessibleObject>(); masterZappable = ScienceBirdTweaks.ZappableBigDoors.Value && ScienceBirdTweaks.ZapGunRework.Value; } bool IShockableWithGun.CanBeShocked() { return !terminalObj.isDoorOpen && !stunned && masterZappable; } float IShockableWithGun.GetDifficultyMultiplier() { return 0.8f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position + new Vector3(0f, 2.5f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)this).gameObject.transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { terminalObj.SetDoorOpen(true); stunned = true; } void IShockableWithGun.StopShockingWithGun() { stunned = false; terminalObj.SetDoorOpen(false); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "DoorZapper"; } } [HarmonyPatch] public class HazardPatches { public static GameObject doorPrefab; public static Color spikesGreen = new Color(0.3254902f, 1f, 0.3679014f, 1f); public static AudioClip disabledBeep; public static Material disabledMat; public static Material offMat; public static RuntimeAnimatorController newController; public static bool extraTrigger = false; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializeAssets() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if (ScienceBirdTweaks.SpikeTrapDisableAnimation.Value || ScienceBirdTweaks.ZapGunRework.Value) { doorPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("DoorKillTrigger"); disabledMat = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SpikeRoofTrapDisabledMat"); offMat = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SpikeRoofTrapOffMat"); disabledBeep = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("SingleBeep"); newController = (RuntimeAnimatorController)ScienceBirdTweaks.TweaksAssets.LoadAsset("landmineAltController"); } } [HarmonyPatch(typeof(TerminalAccessibleObject), "Start")] [HarmonyPostfix] private static void BigDoorsPatch(TerminalAccessibleObject __instance) { if (__instance.isBigDoor && (ScienceBirdTweaks.PlayerLethalBigDoors.Value || ScienceBirdTweaks.EnemyLethalBigDoors.Value) && ScienceBirdTweaks.ZapGunRework.Value) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.transform.Find("DoorKillTrigger(Clone)"))) { InitializeBigDoors(__instance); } ((Component)__instance).gameObject.AddComponent<DoorZapper>(); } } public static void InitializeBigDoors(TerminalAccessibleObject terminalObj) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) GameObject val = Object.Instantiate<GameObject>(doorPrefab, Vector3.zero, Quaternion.Euler(-90f, 0f, 0f)); val.transform.SetParent(((Component)terminalObj).gameObject.transform, false); GameObject gameObject = ((Component)val.transform.Find("Trigger")).gameObject; gameObject.transform.localPosition = new Vector3(0f, 2f, -2.623f); gameObject.AddComponent<KillOnStay>(); Transform val2 = ((Component)terminalObj).gameObject.transform.Find("BigDoorLeft"); Transform val3 = ((Component)terminalObj).gameObject.transform.Find("BigDoorRight"); ((Component)val2).gameObject.layer = 21; ((Component)val3).gameObject.layer = 21; } [HarmonyPatch(typeof(TerminalAccessibleObject), "SetDoorOpen")] [HarmonyPostfix] public static void DoorClosePatch(TerminalAccessibleObject __instance, bool open) { if (__instance.isBigDoor && (ScienceBirdTweaks.PlayerLethalBigDoors.Value || ScienceBirdTweaks.EnemyLethalBigDoors.Value) && ScienceBirdTweaks.ZapGunRework.Value) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.transform.Find("DoorKillTrigger(Clone)"))) { InitializeBigDoors(__instance); } if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.transform.Find("DoorKillTrigger(Clone)").Find("Trigger"))) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("DoorKillTrigger(Clone)")).gameObject; GameObject gameObject2 = ((Component)gameObject.transform.Find("Trigger")).gameObject; gameObject.GetComponent<Animator>().SetBool("open", open); } } } [HarmonyPatch(typeof(SpikeRoofTrap), "ToggleSpikesEnabledLocalClient")] [HarmonyPostfix] public static void SpikeCooldownPatch(SpikeRoofTrap __instance, bool enabled) { //IL_0186: 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) if (!ScienceBirdTweaks.SpikeTrapDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return; } GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.parent).gameObject; SpikesZapper componentInChildren = gameObject.GetComponentInChildren<SpikesZapper>(); if (!((Object)(object)componentInChildren != (Object)null) || componentInChildren.tempStun) { return; } if (!enabled) { if (ApparatusRemovalPatch.doingHazardShutdown) { componentInChildren.light.intensity = 0f; Material[] materials = ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials; materials[0] = offMat; ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials = materials; return; } ScienceBirdTweaks.Logger.LogDebug((object)"Starting spike trap special animation!"); componentInChildren.light.intensity = 2f; componentInChildren.light.colorTemperature = 6580f; componentInChildren.light.color = spikesGreen; Material[] materials2 = ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials; materials2[0] = disabledMat; ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials = materials2; componentInChildren.startRoutine = true; } else { ScienceBirdTweaks.Logger.LogDebug((object)"Ending spike trap special animation!"); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.light.intensity = 1.172347f; componentInChildren.light.colorTemperature = 1500f; componentInChildren.light.color = Color.white; Material[] materials3 = ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials; materials3[0] = componentInChildren.originalMat; ((Renderer)componentInChildren.supportLights.GetComponent<MeshRenderer>()).materials = materials3; } } } [HarmonyPatch(typeof(Landmine), "ToggleMineEnabledLocalClient")] [HarmonyPostfix] public static void MineCooldownPatch(Landmine __instance, bool enabled) { if (!ScienceBirdTweaks.MineDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return; } MineZapper component = ((Component)__instance).GetComponent<MineZapper>(); if (!((Object)(object)component != (Object)null) || component.tempStun) { return; } if (!enabled) { if (ApparatusRemovalPatch.doingHazardShutdown) { __instance.mineAudio.Stop(); __instance.mineAudio.volume = 0f; component.light1.intensity = 0f; component.light2.intensity = 0f; component.indirectLight.intensity = 0f; } else { ScienceBirdTweaks.Logger.LogDebug((object)"Starting landmine special animation!"); __instance.mineAnimator.SetBool("disabled", true); component.light1.intensity = 227.6638f; component.light2.intensity = 227.6638f; component.indirectLight.intensity = 436.6049f; component.startRoutine = true; extraTrigger = true; } } else { ScienceBirdTweaks.Logger.LogDebug((object)"Ending landmine special animation!"); __instance.mineAnimator.SetBool("disabled", false); __instance.mineAudio.Stop(); } } } public class KillOnStay : MonoBehaviour { public bool dontSpawnBody; public CauseOfDeath causeOfDeath = (CauseOfDeath)8; public bool justDamage; public int deathAnimation; [Space(5f)] public int playAudioOnDeath = -1; public GameObject spawnPrefab; public bool disallowKillingInShip; public void KillPlayer(PlayerControllerB playerWhoTriggered) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (justDamage) { playerWhoTriggered.DamagePlayer(25, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); return; } if (playAudioOnDeath != -1) { SoundManager.Instance.PlayAudio1AtPositionForAllClients(((Component)playerWhoTriggered).transform.position, playAudioOnDeath); } if ((Object)(object)spawnPrefab != (Object)null) { Object.Instantiate<GameObject>(spawnPrefab, ((Component)playerWhoTriggered.lowerSpine).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); } playerWhoTriggered.KillPlayer(Vector3.zero, !dontSpawnBody, causeOfDeath, deathAnimation, default(Vector3)); } private void OnTriggerStay(Collider other) { if (ScienceBirdTweaks.PlayerLethalBigDoors.Value && ((Component)other).gameObject.CompareTag("Player") && Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && ((NetworkBehaviour)((Component)other).gameObject.GetComponent<PlayerControllerB>()).IsOwner && !((Component)other).gameObject.GetComponent<PlayerControllerB>().isPlayerDead) { KillPlayer(((Component)other).gameObject.GetComponent<PlayerControllerB>()); } if (ScienceBirdTweaks.EnemyLethalBigDoors.Value && ((NetworkBehaviour)RoundManager.Instance).IsServer && ((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead) { component.mainScript.KillEnemyOnOwnerClient(false); } } } } public class MineZapper : NetworkBehaviour, IShockableWithGun { private Landmine mine; private TerminalAccessibleObject terminalObj; public float cooldown = 3.2f; private float cooldownTimer; private float startTime; private float effectiveCooldown; public Light light1; public Light light2; public Light indirectLight; public bool tempStun = false; public bool startRoutine = false; public bool masterZappable = true; public float multiplier = 0.25f; private void Start() { mine = ((Component)this).GetComponent<Landmine>(); terminalObj = ((Component)this).GetComponent<TerminalAccessibleObject>(); Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { if (((Object)((Component)val).gameObject).name == "BrightLight") { light1 = val; } if (((Object)((Component)val).gameObject).name == "BrightLight2") { light2 = val; } if (((Object)((Component)val).gameObject).name == "IndirectLight") { indirectLight = val; } } Animator component = ((Component)mine).gameObject.GetComponent<Animator>(); component.runtimeAnimatorController = HazardPatches.newController; masterZappable = ScienceBirdTweaks.ZappableMines.Value && ScienceBirdTweaks.ZapGunRework.Value; cooldown = ScienceBirdTweaks.MineZapBaseCooldown.Value; multiplier = ScienceBirdTweaks.ZapScalingFactor.Value; } bool IShockableWithGun.CanBeShocked() { return !mine.hasExploded && !terminalObj.inCooldown && masterZappable; } float IShockableWithGun.GetDifficultyMultiplier() { return 0.5f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position + new Vector3(0f, 0.5f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)this).gameObject.transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { if (!terminalObj.inCooldown && !tempStun) { startRoutine = false; light1.intensity = 0f; light2.intensity = 0f; indirectLight.intensity = 0f; tempStun = true; startTime = Time.realtimeSinceStartup; mine.ToggleMineEnabledLocalClient(false); terminalObj.inCooldown = true; } } void IShockableWithGun.StopShockingWithGun() { if (terminalObj.inCooldown && tempStun) { tempStun = false; float num = Time.realtimeSinceStartup - startTime; mine.mineActivated = true; mine.ToggleMineEnabledLocalClient(false); effectiveCooldown = cooldown * (num * multiplier); cooldownTimer = effectiveCooldown; ScienceBirdTweaks.Logger.LogDebug((object)$"Freezing for {cooldownTimer}s ({num * multiplier}x normal)"); ((MonoBehaviour)this).StartCoroutine(mineCoolDown()); } } private IEnumerator mineCoolDown() { while (!startRoutine) { yield return null; } startRoutine = false; if (!terminalObj.initializedValues) { terminalObj.InitializeValues(); } Image cooldownBar = terminalObj.mapRadarBox; Image[] componentsInChildren = ((Component)terminalObj.mapRadarText).gameObject.GetComponentsInChildren<Image>(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((int)componentsInChildren[i].type == 3) { cooldownBar = componentsInChildren[i]; } } ((Behaviour)cooldownBar).enabled = true; ((Graphic)terminalObj.mapRadarText).color = Color.red; ((Graphic)terminalObj.mapRadarBox).color = Color.red; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = cooldownTimer / effectiveCooldown; } terminalObj.TerminalCodeCooldownReached(); ((Graphic)terminalObj.mapRadarText).color = Color.green; ((Graphic)terminalObj.mapRadarBox).color = Color.green; cooldownTimer = 1.5f; int frameNum = 0; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = Mathf.Abs(cooldownTimer / 1.5f - 1f); frameNum++; if (frameNum % 7 == 0) { ((Behaviour)terminalObj.mapRadarText).enabled = !((Behaviour)terminalObj.mapRadarText).enabled; } } ((Behaviour)terminalObj.mapRadarText).enabled = true; ((Behaviour)cooldownBar).enabled = false; terminalObj.inCooldown = false; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MineZapper"; } } public class SpikesZapper : NetworkBehaviour, IShockableWithGun { private SpikeRoofTrap spikes; private TerminalAccessibleObject terminalObj; public GameObject mainObj; public float cooldown = 7f; private float cooldownTimer; private float startTime; private float effectiveCooldown; public Light light; public GameObject supportLights; public bool tempStun = false; public Material originalMat; public bool startRoutine = false; public bool masterZappable = true; public float multiplier = 0.25f; private void Start() { mainObj = ((Component)((Component)this).transform.parent.parent).gameObject; supportLights = ((Component)mainObj.transform.Find("AnimContainer").Find("BaseSupport")).gameObject; mainObj.layer = 21; light = ((Component)this).GetComponent<Light>(); spikes = mainObj.GetComponentInChildren<SpikeRoofTrap>(); terminalObj = mainObj.GetComponentInChildren<TerminalAccessibleObject>(); originalMat = ((Renderer)supportLights.GetComponent<MeshRenderer>()).materials[0]; masterZappable = ScienceBirdTweaks.ZappableSpikeTraps.Value && ScienceBirdTweaks.ZapGunRework.Value; cooldown = ScienceBirdTweaks.SpikeTrapBaseCooldown.Value; multiplier = ScienceBirdTweaks.ZapScalingFactor.Value; } bool IShockableWithGun.CanBeShocked() { return spikes.trapActive && !terminalObj.inCooldown && masterZappable; } float IShockableWithGun.GetDifficultyMultiplier() { return 0.7f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //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_0014: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position; } Transform IShockableWithGun.GetShockableTransform() { return ((Component)this).gameObject.transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { if (!terminalObj.inCooldown && !tempStun) { startRoutine = false; startTime = Time.realtimeSinceStartup; tempStun = true; spikes.ToggleSpikesEnabledLocalClient(false); terminalObj.inCooldown = true; } } void IShockableWithGun.StopShockingWithGun() { if (terminalObj.inCooldown && tempStun) { tempStun = false; float num = Time.realtimeSinceStartup - startTime; spikes.trapActive = true; spikes.ToggleSpikesEnabledLocalClient(false); effectiveCooldown = cooldown * (num * multiplier); cooldownTimer = effectiveCooldown; ScienceBirdTweaks.Logger.LogDebug((object)$"Freezing for {cooldownTimer}s ({num * multiplier}x normal)"); ((MonoBehaviour)this).StartCoroutine(spikesCoolDown()); } } private IEnumerator spikesCoolDown() { while (!startRoutine) { yield return null; } startRoutine = false; if (!terminalObj.initializedValues) { terminalObj.InitializeValues(); } Image cooldownBar = terminalObj.mapRadarBox; Image[] componentsInChildren = ((Component)terminalObj.mapRadarText).gameObject.GetComponentsInChildren<Image>(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((int)componentsInChildren[i].type == 3) { cooldownBar = componentsInChildren[i]; } } ((Behaviour)cooldownBar).enabled = true; ((Graphic)terminalObj.mapRadarText).color = Color.red; ((Graphic)terminalObj.mapRadarBox).color = Color.red; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = cooldownTimer / effectiveCooldown; } terminalObj.TerminalCodeCooldownReached(); ((Graphic)terminalObj.mapRadarText).color = Color.green; ((Graphic)terminalObj.mapRadarBox).color = Color.green; cooldownTimer = 1.5f; int frameNum = 0; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = Mathf.Abs(cooldownTimer / 1.5f - 1f); frameNum++; if (frameNum % 7 == 0) { ((Behaviour)terminalObj.mapRadarText).enabled = !((Behaviour)terminalObj.mapRadarText).enabled; } } ((Behaviour)terminalObj.mapRadarText).enabled = true; ((Behaviour)cooldownBar).enabled = false; terminalObj.inCooldown = false; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SpikesZapper"; } } public class TurretZapper : NetworkBehaviour, IShockableWithGun { private Turret turret; private TerminalAccessibleObject terminalObj; public bool panicMode = false; public float cooldown = 7f; private float cooldownTimer; private float startTime; private float effectiveCooldown; public Quaternion savedRot; public float savedTimer; private bool restoredRot = true; public bool masterZappable = true; public float multiplier = 0.25f; private void Start() { turret = ((Component)this).GetComponent<Turret>(); terminalObj = ((Component)this).GetComponent<TerminalAccessibleObject>(); ScienceBirdTweaks.Logger.LogDebug((object)turret); masterZappable = ScienceBirdTweaks.ZappableTurrets.Value && ScienceBirdTweaks.ZapGunRework.Value; cooldown = ScienceBirdTweaks.TurretZapBaseCooldown.Value; multiplier = ScienceBirdTweaks.ZapScalingFactor.Value; } bool IShockableWithGun.CanBeShocked() { return turret.turretActive && !panicMode && !terminalObj.inCooldown && masterZappable; } float IShockableWithGun.GetDifficultyMultiplier() { return 1f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //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_0014: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position; } Transform IShockableWithGun.GetShockableTransform() { return ((Component)this).gameObject.transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //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) if (terminalObj.inCooldown || panicMode || !((Object)(object)terminalObj != (Object)null)) { return; } startTime = Time.realtimeSinceStartup; if ((int)turret.turretMode > 0) { turret.rotatingClockwise = false; turret.SwitchTurretMode(0); turret.turretAnimator.SetInteger("TurretMode", 1); if (turret.fadeBulletAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(turret.fadeBulletAudioCoroutine); } turret.fadeBulletAudioCoroutine = ((MonoBehaviour)this).StartCoroutine(turret.FadeBulletAudio()); turret.bulletParticles.Stop(true, (ParticleSystemStopBehavior)1); } terminalObj.inCooldown = true; turret.mainAudio.Stop(); turret.farAudio.Stop(); turret.turretActive = false; turret.berserkAudio.Play(); turret.rotationSpeed = 336f; turret.rotatingSmoothly = true; turret.wasTargetingPlayerLastFrame = false; turret.targetPlayerWithRotation = null; savedTimer = turret.switchRotationTimer; savedRot = turret.turretRod.rotation; panicMode = true; } void IShockableWithGun.StopShockingWithGun() { if (terminalObj.inCooldown && panicMode) { panicMode = false; float num = Time.realtimeSinceStartup - startTime; turret.turretActive = true; turret.berserkAudio.Stop(); restoredRot = false; turret.rotationSpeed = 28f; ((UnityEvent<PlayerControllerB>)(object)terminalObj.terminalCodeEvent).Invoke(GameNetworkManager.Instance.localPlayerController); effectiveCooldown = cooldown * (num * multiplier); cooldownTimer = effectiveCooldown; ScienceBirdTweaks.Logger.LogDebug((object)$"Freezing for {cooldownTimer}s ({num * multiplier}x normal)"); ((MonoBehaviour)this).StartCoroutine(turretCoolDown()); } } private void Update() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) if (panicMode && terminalObj.inCooldown) { if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { if (turret.switchRotationTimer >= 7f) { turret.switchRotationTimer = 0f; bool flag = !turret.rotatingRight; turret.SwitchRotationClientRpc(flag); turret.SwitchRotationOnInterval(flag); } else { Turret obj = turret; obj.switchRotationTimer += Time.deltaTime * 12f; } } if (turret.rotatingClockwise) { turret.turnTowardsObjectCompass.localEulerAngles = new Vector3(-180f, turret.turretRod.localEulerAngles.y - Time.deltaTime * 20f, 180f); turret.turretRod.rotation = Quaternion.RotateTowards(turret.turretRod.rotation, turret.turnTowardsObjectCompass.rotation, turret.rotationSpeed * Time.deltaTime); return; } if (turret.rotatingSmoothly) { turret.turnTowardsObjectCompass.localEulerAngles = new Vector3(-180f, Mathf.Clamp(turret.targetRotation, 0f - turret.rotationRange, turret.rotationRange), 180f); } turret.turretRod.rotation = Quaternion.RotateTowards(turret.turretRod.rotation, turret.turnTowardsObjectCompass.rotation, turret.rotationSpeed * Time.deltaTime); } else if (!restoredRot && terminalObj.inCooldown) { turret.turretRod.rotation = Quaternion.Slerp(turret.turretRod.rotation, savedRot, Time.deltaTime / cooldownTimer); } } private IEnumerator turretCoolDown() { if (!((Object)(object)terminalObj != (Object)null)) { yield break; } if (!terminalObj.initializedValues) { terminalObj.InitializeValues(); } Image cooldownBar = terminalObj.mapRadarBox; Image[] componentsInChildren = ((Component)terminalObj.mapRadarText).gameObject.GetComponentsInChildren<Image>(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((int)componentsInChildren[i].type == 3) { cooldownBar = componentsInChildren[i]; } } ((Behaviour)cooldownBar).enabled = true; ((Graphic)terminalObj.mapRadarText).color = Color.red; ((Graphic)terminalObj.mapRadarBox).color = Color.red; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = cooldownTimer / effectiveCooldown; } terminalObj.TerminalCodeCooldownReached(); ((Graphic)terminalObj.mapRadarText).color = Color.green; ((Graphic)terminalObj.mapRadarBox).color = Color.green; cooldownTimer = 1.5f; int frameNum = 0; while (cooldownTimer > 0f) { yield return null; cooldownTimer -= Time.deltaTime; cooldownBar.fillAmount = Mathf.Abs(cooldownTimer / 1.5f - 1f); frameNum++; if (frameNum % 7 == 0) { ((Behaviour)terminalObj.mapRadarText).enabled = !((Behaviour)terminalObj.mapRadarText).enabled; } } ((Behaviour)terminalObj.mapRadarText).enabled = true; ((Behaviour)cooldownBar).enabled = false; terminalObj.inCooldown = false; turret.turretRod.rotation = savedRot; if (((NetworkBehaviour)this).IsServer) { turret.switchRotationTimer = savedTimer; } restoredRot = true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TurretZapper"; } } [HarmonyPatch] public class ZapPatches { public static bool goingRight; public static bool goingLeft; public static GameObject leftArrow; public static GameObject rightArrow; public static bool doTutorialOverride = false; public static int tutorialCount = 2; public static Dictionary<int, int> layerDict; public static int layersLength; public static RectTransform image1; public static RectTransform image2; public static PatcherTool currentZapInstance; public static float tVal = 0f; public static float bendInterpolate = 0f; [HarmonyPatch(typeof(Landmine), "Start")] [HarmonyPostfix] private static void MinePatch(ref Landmine __instance) { if (ScienceBirdTweaks.ZapGunRework.Value || ScienceBirdTweaks.MineDisableAnimation.Value) { ((Component)__instance).gameObject.AddComponent<MineZapper>(); MineAudio mineAudio = ((Component)__instance).gameObject.AddComponent<MineAudio>(); mineAudio.audioSource = ((Component)__instance).gameObject.GetComponent<AudioSource>(); mineAudio.beepClip = HazardPatches.disabledBeep; } } [HarmonyPatch(typeof(Turret), "Start")] [HarmonyPostfix] private static void TurretPatch(ref Turret __instance) { if (ScienceBirdTweaks.ZapGunRework.Value) { ((Component)__instance).gameObject.AddComponent<TurretZapper>(); } } [HarmonyPatch(typeof(SpikeRoofTrap), "Start")] [HarmonyPostfix] private static void SpikesPatch(ref SpikeRoofTrap __instance) { if (ScienceBirdTweaks.ZapGunRework.Value || ScienceBirdTweaks.SpikeTrapDisableAnimation.Value) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.parent).gameObject; gameObject.layer = 21; Light componentInChildren = gameObject.GetComponentInChildren<Light>(); ((Component)componentInChildren).gameObject.layer = 21; ((Component)componentInChildren).gameObject.AddComponent<SpikesZapper>(); BoxCollider val = ((Component)componentInChildren).gameObject.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void SetZapGunProperties(GameNetworkManager __instance) { Item val = (from x in Resources.FindObjectsOfTypeAll<Item>() where x.itemName == "Zap gun" select x).First(); if ((Object)(object)val != (Object)null) { val.batteryUsage = ScienceBirdTweaks.ZapGunBattery.Value; } } [HarmonyPatch(typeof(GameNetworkManager), "SaveLocalPlayerValues")] [HarmonyPostfix] private static void FixShockMinigameSave(GameNetworkManager __instance) { if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Vanilla") { return; } try { if ((Object)(object)HUDManager.Instance != (Object)null) { ES3.Save<int>("FinishedShockMinigame", PatcherTool.finishedShockMinigame, "LCGeneralSaveData"); } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"ERROR occured while saving local player shockminigame values!: {arg}"); } } [HarmonyPatch(typeof(HUDManager), "SetSavedValues")] [HarmonyPostfix] private static void FixShockMinigameLoad(HUDManager __instance) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown if (ScienceBirdTweaks.ZapGunRework.Value) { string[] array = ScienceBirdTweaks.ZapScanPriority.Value.ToLower().Replace(" ", "").Split(","); layerDict = new Dictionary<int, int>(); for (int i = 0; i < array.Length; i++) { int num = 0; switch (array[i]) { case "doors": num = -1; break; case "enemies": num = 19; break; case "traps": num = 21; break; case "players": num = 3; break; default: continue; } if (num != 0) { layerDict.Add(num, i); } } layersLength = layerDict.Count; } if (ScienceBirdTweaks.ZapGunTutorialRevamp.Value) { RuntimeAnimatorController runtimeAnimatorController = (RuntimeAnimatorController)ScienceBirdTweaks.TweaksAssets.LoadAsset("ArrowRightAlt"); leftArrow = ((Component)__instance.shockTutorialLeftAlpha).gameObject; rightArrow = ((Component)__instance.shockTutorialRightAlpha).gameObject; leftArrow.GetComponent<Animator>().runtimeAnimatorController = runtimeAnimatorController; rightArrow.GetComponent<Animator>().runtimeAnimatorController = runtimeAnimatorController; image1 = ((Component)leftArrow.transform.Find("Image (1)")).gameObject.GetComponent<RectTransform>(); image2 = ((Component)rightArrow.transform.Find("Image (1)")).gameObject.GetComponent<RectTransform>(); } if (!(ScienceBirdTweaks.ZapGunTutorialMode.Value == "Vanilla")) { tutorialCount = ScienceBirdTweaks.ZapGunTutorialCount.Value; __instance.setTutorialArrow = false; if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Only First Time" && ES3.Load<int>("FinishedShockMinigame", "LCGeneralSaveData", 0) < tutorialCount) { PatcherTool.finishedShockMinigame = 0; __instance.setTutorialArrow = true; } else if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Every Session" || ScienceBirdTweaks.ZapGunTutorialMode.Value == "Always") { PatcherTool.finishedShockMinigame = 0; __instance.setTutorialArrow = true; } if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Always") { doTutorialOverride = true; } } } [HarmonyPatch(typeof(PatcherTool), "BeginShockingAnomalyOnClient")] [HarmonyPostfix] private static void StoreZapGunInstance(PatcherTool __instance) { if (((NetworkBehaviour)__instance).IsOwner && ScienceBirdTweaks.ZapGunTutorialRevamp.Value) { currentZapInstance = __instance; } } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPrefix] private static void TutorialGrabValues(HUDManager __instance, out HUDManager __state) { __state = __instance; } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] private static void TutorialAnimChange(HUDManager __instance, HUDManager __state) { //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.ZapGunTutorialRevamp.Value) { return; } if (__instance.tutorialArrowState == 0 || !__instance.setTutorialArrow) { __instance.shockTutorialLeftAlpha.alpha = Mathf.Lerp(__state.shockTutorialLeftAlpha.alpha, 0f, 17f * Time.deltaTime); __instance.shockTutorialRightAlpha.alpha = Mathf.Lerp(__state.shockTutorialRightAlpha.alpha, 0f, 17f * Time.deltaTime); } else if (__instance.tutorialArrowState == 1) { float num = Mathf.Clamp((Mathf.Abs(currentZapInstance.bendMultiplier) - 0.3f) / 0.7f, 0f, 1f); if (bendInterpolate > num) { bendInterpolate -= Time.deltaTime * 2f; } if (bendInterpolate < num) { bendInterpolate += Time.deltaTime * 2f; } if (tVal > bendInterpolate) { tVal -= Time.deltaTime; } if (tVal < bendInterpolate) { tVal += Time.deltaTime; } image1.anchoredPosition = new Vector2(Mathf.Lerp(image1.anchoredPosition.x, 35f - 70f * bendInterpolate, Mathf.Clamp(tVal, 0f, 1f)), 4.2f); __instance.shockTutorialLeftAlpha.alpha = Mathf.Lerp(__state.shockTutorialLeftAlpha.alpha, 1f, 17f * Time.deltaTime); __instance.shockTutorialRightAlpha.alpha = Mathf.Lerp(__state.shockTutorialRightAlpha.alpha, 0f, 17f * Time.deltaTime); } else { float num2 = Mathf.Clamp((Mathf.Abs(currentZapInstance.bendMultiplier) - 0.3f) / 0.7f, 0f, 1f); if (bendInterpolate > num2) { bendInterpolate -= Time.deltaTime * 2f; } if (bendInterpolate < num2) { bendInterpolate += Time.deltaTime * 2f; } if (tVal > bendInterpolate) { tVal -= Time.deltaTime; } if (tVal < bendInterpolate) { tVal += Time.deltaTime; } image2.anchoredPosition = new Vector2(Mathf.Lerp(image1.anchoredPosition.x, 35f - 70f * bendInterpolate, Mathf.Clamp(tVal, 0f, 1f)), 4.2f); __instance.shockTutorialRightAlpha.alpha = Mathf.Lerp(__state.shockTutorialRightAlpha.alpha, 1f, 17f * Time.deltaTime); __instance.shockTutorialLeftAlpha.alpha = Mathf.Lerp(__state.shockTutorialLeftAlpha.alpha, 0f, 17f * Time.deltaTime); } } [HarmonyPatch(typeof(PatcherTool), "StopShockingAnomalyOnClient")] [HarmonyPrefix] private static void StopShockPrefix(PatcherTool __instance, bool failed, out float __state) { __state = __instance.timeSpentShocking; } [HarmonyPatch(typeof(PatcherTool), "StopShockingAnomalyOnClient")] [HarmonyPostfix] private static void StopShockPostfix(PatcherTool __instance, bool failed, float __state) { if (((NetworkBehaviour)__instance).IsOwner && !doTutorialOverride && __instance.timeSpentShocking == 0f && failed && __state > 0.75f) { __instance.SetFinishedShockMinigameTutorial(); } } [HarmonyPatch(typeof(PatcherTool), "SetFinishedShockMinigameTutorial")] [HarmonyPrefix] private static bool TutorialUpdateOverridePrefix(PatcherTool __instance) { if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Vanilla") { return true; } TutorialUpdate(__instance); return false; } private static void TutorialUpdate(PatcherTool zapGun) { if (doTutorialOverride) { PatcherTool.finishedShockMinigame = 0; HUDManager.Instance.setTutorialArrow = true; } else if (HUDManager.Instance.setTutorialArrow) { PatcherTool.finishedShockMinigame++; if (PatcherTool.finishedShockMinigame >= tutorialCount) { HUDManager.Instance.setTutorialArrow = false; } } } [HarmonyPatch(typeof(PatcherTool), "ScanGun")] [HarmonyPrefix] public static bool ZapGunOverridePrefix(PatcherTool __instance, ref IEnumerator __result) { if (!ScienceBirdTweaks.ZapGunRework.Value) { return true; } __result = ScanGunPatch(__instance); return false; } private static int LayerSort(RaycastHit hit) { int num = 0; num = ((Component)((RaycastHit)(ref hit)).transform).gameObject.layer; if (((Object)((Component)((RaycastHit)(ref hit)).transform).gameObject).name == "BigDoor(Clone)") { num = -1; } if (layerDict.TryGetValue(num, out var value)) { return value; } return layersLength; } private static IEnumerator ScanGunPatch(PatcherTool __instance) { __instance.anomalyMask = 2621448; __instance.effectAnimator.SetTrigger("Scan"); __instance.gunAudio.PlayOneShot(__instance.scanAnomaly); __instance.lightningScript = __instance.lightningObject.GetComponent<LightningSplineScript>(); __instance.lightningDest.SetParent((Transform)null); __instance.lightningBend1.SetParent((Transform)null); __instance.lightningBend2.SetParent((Transform)null); IShockableWithGun component = default(IShockableWithGun); for (int i = 0; i < 12; i++) { if (((NetworkBehaviour)__instance).IsOwner) { if (((GrabbableObject)__instance).isPocketed) { yield break; } __instance.ray = new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position - ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward * 3f, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward); int num = Physics.SphereCastNonAlloc(__instance.ray, 5f, __instance.raycastEnemies, 5f, __instance.anomalyMask, (QueryTriggerInteraction)2); RaycastHit[] validHits = (RaycastHit[])(object)new RaycastHit[num]; for (int k = 0; k < num; k++) { validHits[k] = __instance.raycastEnemies[k]; } validHits = validHits.Where((RaycastHit x) => (Object)(object)((RaycastHit)(ref x)).collider != (Object)null).OrderBy(LayerSort).ThenBy((RaycastHit x) => ((RaycastHit)(ref x)).distance) .ToArray(); for (int j = 0; j < validHits.Length; j++) { __instance.hit = validHits[j]; if (!((Object)(object)((RaycastHit)(ref __instance.hit)).transform == (Object)null) && ((Component)((RaycastHit)(ref __instance.hit)).transform).gameObject.TryGetComponent<IShockableWithGun>(ref component) && component.CanBeShocked()) { Vector3 shockablePosition = component.GetShockablePosition(); ScienceBirdTweaks.Logger.LogDebug((object)("Got shockable transform name : " + ((Object)((Component)component.GetShockableTransform()).gameObject).name)); if (__instance.GunMeetsConditionsToShock(((GrabbableObject)__instance).playerHeldBy, shockablePosition, 60f)) { __instance.gunAudio.Stop(); __instance.BeginShockingAnomalyOnClient(component); yield break; } } component = null; } } yield return (object)new WaitForSeconds(0.125f); } __instance.SwitchFlashlight(false); __instance.isScanning = false; } } } namespace ScienceBirdTweaks.Scripts { public class LLLUnlockSync : NetworkBehaviour { public void CheckUnlocks() { foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { CheckUnlocksClientRpc(((ExtendedContent)extendedLevel).UniqueIdentificationName, extendedLevel.IsRouteHidden, extendedLevel.IsRouteLocked); } } [ClientRpc] public void CheckUnlocksClientRpc(string uniqueName, bool hidden, bool locked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(224630158u, val, (RpcDelivery)0); bool flag = uniqueName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(uniqueName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hidden, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 224630158u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } string uniqueName2 = uniqueName; if (!((NetworkBehaviour)this).IsServer) { ExtendedLevel val3 = PatchedContent.ExtendedLevels.Find((ExtendedLevel x) => ((ExtendedContent)x).UniqueIdentificationName == uniqueName2); if ((Object)(object)val3 != (Object)null && (val3.IsRouteHidden != hidden || val3.IsRouteLocked != locked)) { ScienceBirdTweaks.Logger.LogInfo((object)("Client mismatch with host extended level " + uniqueName2 + " detected! Fixing...")); val3.IsRouteHidden = hidden; val3.IsRouteLocked = locked; } if ((Object)(object)val3 == (Object)null) { ScienceBirdTweaks.Logger.LogWarning((object)("Couldn't find moon " + uniqueName2 + "!")); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LLLUnlockSync() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(224630158u, new RpcReceiveHandler(__rpc_handler_224630158)); } private static void __rpc_handler_224630158(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to inv