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 DunGen; using EasyTextEffects.Editor.MyBoxCopy.Extensions; using GameNetcodeStuff; using GoodItemScan; 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 ShipWindows.Patches.Shutters; using ShipWindows.ShutterSwitch; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; 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.7.4.0")] [assembly: AssemblyInformationalVersion("4.7.4+b347872f3d9258285ec77705ef564bf0d062a463")] [assembly: AssemblyProduct("ScienceBirdTweaks")] [assembly: AssemblyTitle("ScienceBird.ScienceBirdTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.7.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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.7.4"), (CompatibilityLevel)0, (VersionStrictness)0); } else { PluginHelper.RegisterPlugin("ScienceBird.ScienceBirdTweaks", Version.Parse("4.7.4"), (CompatibilityLevel)2, (VersionStrictness)0); } } } public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } public static event Action 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(); 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_00ff: 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 != 1 && (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(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 == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkHandler.LevelEvent?.Invoke(eventName); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3412331623u, new RpcReceiveHandler(__rpc_handler_3412331623), "EventClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } 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(ref flag, default(ForPrimitives)); string eventName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((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(); 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(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } } [BepInPlugin("ScienceBird.ScienceBirdTweaks", "ScienceBirdTweaks", "4.7.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [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 FixedShipObjects; public static ConfigEntry OnlyFixDefault; public static ConfigEntry AlternateFixLogic; public static ConfigEntry FixedSuitRack; public static ConfigEntry ConsistentCatwalkCollision; public static ConfigEntry TinyTeleporterCollision; public static ConfigEntry BegoneBottomCollision; public static ConfigEntry LargerLeverCollision; public static ConfigEntry ModdedListMode; public static ConfigEntry ModdedUnlockableList; public static ConfigEntry RemoveClipboard; public static ConfigEntry RemoveStickyNote; public static ConfigEntry RemoveTeleporterCord; public static ConfigEntry RemoveLongTube; public static ConfigEntry RemoveGenerator; public static ConfigEntry RemoveHelmet; public static ConfigEntry RemoveOxygenTanks; public static ConfigEntry RemoveBoots; public static ConfigEntry RemoveAirFilter; public static ConfigEntry RemoveMonitorWires; public static ConfigEntry RemoveBatteries; public static ConfigEntry RemoveExteriorCam; public static ConfigEntry RemoveInteriorCam; public static ConfigEntry RemoveDoorMonitor; public static ConfigEntry RemoveCruiserClipboard; public static ConfigEntry TinyTeleporterSizeX; public static ConfigEntry TinyTeleporterSizeY; public static ConfigEntry TinyTeleporterSizeZ; public static ConfigEntry LargerLeverSizeX; public static ConfigEntry LargerLeverSizeY; public static ConfigEntry LargerLeverSizeZ; public static ConfigEntry FloodlightRotation; public static ConfigEntry FloodlightRotationOnLand; public static ConfigEntry FloodlightExtraControls; public static ConfigEntry FloodlightPlayerFollow; public static ConfigEntry FloodLightIntensity; public static ConfigEntry FloodLightAngle; public static ConfigEntry FloodLightRange; public static ConfigEntry FloodLightRotationSpeed; public static ConfigEntry FancyPanel; public static ConfigEntry DynamicOccupancySign; public static ConfigEntry OccupancyScribble; public static ConfigEntry OccupancyFixedValue; public static ConfigEntry PlayGlobalDeathSFX; public static ConfigEntry AutoTeleportBody; public static ConfigEntry UnrecoverableNotification; public static ConfigEntry Red1Tip; public static ConfigEntry Red2Tip; public static ConfigEntry Black1Tip; public static ConfigEntry Black2Tip; public static ConfigEntry Knob1Tip; public static ConfigEntry Knob2Tip; public static ConfigEntry Knob3Tip; public static ConfigEntry SmallKnobTip; public static ConfigEntry SmallRedTip; public static ConfigEntry SmallGreenTip; public static ConfigEntry MissingHoverTipFix; public static ConfigEntry HandsFullFix; public static ConfigEntry StretchedHoverIconFix; public static ConfigEntry SmokeFix; public static ConfigEntry BridgeItemsFix; public static ConfigEntry ClientShipItems; public static ConfigEntry LandmineFix; public static ConfigEntry ApplianceInteractionFixes; public static ConfigEntry MonitorTransitionFix; public static ConfigEntry LingeringLightningFix; public static ConfigEntry TurretFiringFix; public static ConfigEntry PauseMenuFlickerFix; public static ConfigEntry FallingRotationFix; public static ConfigEntry ReplaceNullItems; public static ConfigEntry CrouchDamageAnimation; public static ConfigEntry CleanBeltBagUI; public static ConfigEntry BigScrew; public static ConfigEntry KiwiManeaterScream; public static ConfigEntry RadarPathAllExits; public static ConfigEntry DisableTrapsOnApparatusRemoval; public static ConfigEntry DisableTrapsOnBreakerSwitch; public static ConfigEntry SpikesCooldownMute; public static ConfigEntry ForceSunShadows; public static ConfigEntry SunFade; public static ConfigEntry FearfulBuilding; public static ConfigEntry OldHalloweenElevatorMusic; public static ConfigEntry ScanHighlights; public static ConfigEntry StartingMoon; public static ConfigEntry MuteScrapList; public static ConfigEntry SingleItemBlacklist; public static ConfigEntry CoilheadElevatorFix; public static ConfigEntry ManeaterAttackFix; public static ConfigEntry DropMasks; public static ConfigEntry MaskScrapValue; public static ConfigEntry CentipedeMode; public static ConfigEntry CentipedeFixedDamage; public static ConfigEntry CentipedeSecondChanceThreshold; public static ConfigEntry LeviathanSurfacePatch; public static ConfigEntry LeviathanQuicksand; public static ConfigEntry LeviathanNaturalSurfaces; public static ConfigEntry ManeaterTransformInterrupt; public static ConfigEntry ManeaterFastDoors; public static ConfigEntry TulipSnakeMuteLaugh; public static ConfigEntry MineDisableAnimation; public static ConfigEntry SpikeTrapDisableAnimation; public static ConfigEntry ZapGunTutorialRevamp; public static ConfigEntry ZapGunRework; public static ConfigEntry ZappableTurrets; public static ConfigEntry ZappableMines; public static ConfigEntry ZappableSpikeTraps; public static ConfigEntry ZappableBigDoors; public static ConfigEntry PlayerLethalBigDoors; public static ConfigEntry EnemyLethalBigDoors; public static ConfigEntry ZapGunTutorialMode; public static ConfigEntry ZapScanPriority; public static ConfigEntry MineSoundEffect; public static ConfigEntry ZapGunTutorialCount; public static ConfigEntry ZapGunBattery; public static ConfigEntry TurretZapBaseCooldown; public static ConfigEntry MineZapBaseCooldown; public static ConfigEntry SpikeTrapBaseCooldown; public static ConfigEntry ZapScalingFactor; public static ConfigEntry ShotgunMasterDisable; public static ConfigEntry ShowAmmo; public static ConfigEntry UnloadShells; public static ConfigEntry DoAmmoCheck; public static ConfigEntry PickUpGunOrbit; public static ConfigEntry PickUpShellsOrbit; public static ConfigEntry SafetyOnString; public static ConfigEntry SafetyOffString; public static ConfigEntry DustSpaceClouds; public static ConfigEntry ThickDustClouds; public static ConfigEntry DustCloudsNoise; public static ConfigEntry DustCloudsThickness; public static ConfigEntry PreventWorthlessDespawn; public static ConfigEntry UsePreventDespawnList; public static ConfigEntry ZeroDespawnPreventedItems; public static ConfigEntry PreventedDespawnList; public static ConfigEntry CustomWorthlessDisplayText; public static ConfigEntry WorthlessDisplayTextBlacklist; public static ConfigEntry BlackoutOnApparatusRemoval; public static ConfigEntry TrueBlackout; public static ConfigEntry DisableTrapsOnTrueBlackout; public static ConfigEntry BlackoutSFX; public static ConfigEntry BlacklistLightAnimators; public static ConfigEntry BlacklistPoles; public static ConfigEntry BlacklistEmergency; public static ConfigEntry BlackoutFloodLightIntensity; public static ConfigEntry BlackoutFloodLightAngle; public static ConfigEntry BlackoutFloodLightRange; public static ConfigEntry ApparatusSpawnMin; public static ConfigEntry ApparatusSpawnChance; public static ConfigEntry TrueBlackoutNameBlacklist; public static ConfigEntry TrueBlackoutHierarchyBlacklist; public static ConfigEntry BlackoutSun; public static ConfigEntry LocalCam; public static ConfigEntry TrueLocalCam; public static ConfigEntry HideLocalCam; public static ConfigEntry HideAllCams; public static ConfigEntry SprintCam; public static ConfigEntry ImprovedTextBox; public static ConfigEntry PlayerCamAngleX; public static ConfigEntry PlayerCamAngleY; public static ConfigEntry PlayerCamPosVertical; public static ConfigEntry PlayerCamPosHorizontal; public static ConfigEntry PlayerCamClipping; public static ConfigEntry LLLUnlockSyncing; public static ConfigEntry LLLShipLeverFix; public static ConfigEntry VideoTapeSkip; public static ConfigEntry ShipWindowsShutterFix; public static ConfigEntry MrovWeatherTweaksAnnouncement; public static ConfigEntry SSSTerminalStock; public static ConfigEntry SolarFlareTwoRadar; public static ConfigEntry ShipWindowsShutterAudio; public static ConfigEntry ClientsideMode; public static ConfigEntry DebugMode; public static ConfigEntry ClearOrphans; public static ConfigEntry ExtraLogs; public static ConfigEntry DisableWarnings; public static ConfigEntry InteriorLogging; public static ConfigEntry ZeroWeightCheck; public static ConfigEntry FixNaNColliders; 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 bool test1Present; public static bool test2Present; public static bool mborshPresent; public static bool qcfPresent; public static bool zaggyPresent; public static bool shaosilPresent; 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Expected O, but got Unknown //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Expected O, but got Unknown //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Expected O, but got Unknown //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Expected O, but got Unknown //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Expected O, but got Unknown //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0c06: Expected O, but got Unknown //IL_0d3f: Unknown result type (might be due to invalid IL or missing references) //IL_0d49: Expected O, but got Unknown //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0d9a: Expected O, but got Unknown //IL_0dcd: Unknown result type (might be due to invalid IL or missing references) //IL_0dd7: Expected O, but got Unknown //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e0a: Expected O, but got Unknown //IL_0f35: Unknown result type (might be due to invalid IL or missing references) //IL_0f3f: Expected O, but got Unknown //IL_0fae: Unknown result type (might be due to invalid IL or missing references) //IL_0fb8: Expected O, but got Unknown //IL_0fe0: Unknown result type (might be due to invalid IL or missing references) //IL_0fea: Expected O, but got Unknown //IL_1081: Unknown result type (might be due to invalid IL or missing references) //IL_108b: Expected O, but got Unknown //IL_10de: Unknown result type (might be due to invalid IL or missing references) //IL_10e8: Expected O, but got Unknown //IL_113b: Unknown result type (might be due to invalid IL or missing references) //IL_1145: Expected O, but got Unknown //IL_1198: Unknown result type (might be due to invalid IL or missing references) //IL_11a2: Expected O, but got Unknown //IL_11d5: Unknown result type (might be due to invalid IL or missing references) //IL_11df: Expected O, but got Unknown //IL_12b2: Unknown result type (might be due to invalid IL or missing references) //IL_12bc: Expected O, but got Unknown //IL_161f: Unknown result type (might be due to invalid IL or missing references) //IL_1629: Expected O, but got Unknown //IL_1658: Unknown result type (might be due to invalid IL or missing references) //IL_1662: Expected O, but got Unknown //IL_168e: Unknown result type (might be due to invalid IL or missing references) //IL_1698: Expected O, but got Unknown //IL_16c7: Unknown result type (might be due to invalid IL or missing references) //IL_16d1: Expected O, but got Unknown //IL_1704: Unknown result type (might be due to invalid IL or missing references) //IL_170e: Expected O, but got Unknown //IL_1741: Unknown result type (might be due to invalid IL or missing references) //IL_174b: Expected O, but got Unknown //IL_177e: Unknown result type (might be due to invalid IL or missing references) //IL_1788: Expected O, but got Unknown //IL_17bb: Unknown result type (might be due to invalid IL or missing references) //IL_17c5: Expected O, but got Unknown //IL_17f8: Unknown result type (might be due to invalid IL or missing references) //IL_1802: Expected O, but got Unknown //IL_1991: Unknown result type (might be due to invalid IL or missing references) //IL_199b: Expected O, but got Unknown //IL_1b1e: Unknown result type (might be due to invalid IL or missing references) //IL_1b23: Unknown result type (might be due to invalid IL or missing references) //IL_1b46: Unknown result type (might be due to invalid IL or missing references) //IL_1b4b: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Instance = this; FixedShipObjects = ((BaseUnityPlugin)this).Config.Bind("1 i. 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("1 i. 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."); ModdedListMode = ((BaseUnityPlugin)this).Config.Bind("1 i. Ship Tweaks", "Fix Modded List Mode", "Don't Use List", new ConfigDescription("Choose whether the list of modded furniture below will be a whitelist (only listed items will be fixed), or a blacklist (everything EXCEPT listed items will be fixed).", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "Don't Use List", "Whitelist", "Blacklist" }), Array.Empty())); ModdedUnlockableList = ((BaseUnityPlugin)this).Config.Bind("1 i. Ship Tweaks", "Fix Modded Objects List", "", "List the exact names of modded furniture items you want to either blacklist or whitelist (not case-sensitive)."); AlternateFixLogic = ((BaseUnityPlugin)this).Config.Bind("1 i. 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("1 i. 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("1 i. 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("1 i. 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("1 i. 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("1 i. 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)."); TinyTeleporterSizeX = ((BaseUnityPlugin)this).Config.Bind("1 ii. Ship Tweaks Collider Sizes", "Tiny Teleporter Size X", 1.5f, "Vanilla: 2.48"); TinyTeleporterSizeY = ((BaseUnityPlugin)this).Config.Bind("1 ii. Ship Tweaks Collider Sizes", "Tiny Teleporter Size Y", 4f, "(Height) Vanilla: 6"); TinyTeleporterSizeZ = ((BaseUnityPlugin)this).Config.Bind("1 ii. Ship Tweaks Collider Sizes", "Tiny Teleporter Size Z", 1.6f, "Vanilla: 2.6"); LargerLeverSizeX = ((BaseUnityPlugin)this).Config.Bind("1 ii. 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("1 ii. Ship Tweaks Collider Sizes", "Larger Lever Size Y", 1.75f, "(Height) Vanilla: 1"); LargerLeverSizeZ = ((BaseUnityPlugin)this).Config.Bind("1 ii. Ship Tweaks Collider Sizes", "Larger Lever Size Z", 1.65f, "(Width, e.g. left to right edge of monitor) Vanilla: 1"); RemoveClipboard = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Clipboard", false, "Removes the service manual clipboard."); RemoveStickyNote = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Sticky Note", false, "Removes the 'ACCESS FILE: SIGURD' hint sticky note."); RemoveTeleporterCord = ((BaseUnityPlugin)this).Config.Bind("1 iii. 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("1 iii. 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("1 iii. Ship Tweaks Removals", "Generator", false, "Removes the generator next to the door."); RemoveHelmet = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Helmet", false, "Removes the helmet on the counter by the main monitor."); RemoveOxygenTanks = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Oxygen Tanks", false, "Removes the oxygen tanks leaning against the wall."); RemoveBoots = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Boots", false, "Removes the boots by the suit rack."); RemoveAirFilter = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Air Filter", false, "Removes the air filter in the corner by the monitors."); RemoveMonitorWires = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Monitor Wires", false, "Removes the wires in the corner behind the ship monitors."); RemoveBatteries = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Batteries", false, "Removes the batteries strewn across the desk by the monitors."); RemoveInteriorCam = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Interior Camera", false, "Removes the internal spherical camera placed above the main ship panel and monitors (feed will no longer show up on monitors)."); RemoveExteriorCam = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Exterior Camera", false, "Removes the exterior panning camera (feed will no longer show up on monitors)."); RemoveDoorMonitor = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Exterior Camera Monitor", false, "Removes the monitor above the buttons for the ship door."); RemoveCruiserClipboard = ((BaseUnityPlugin)this).Config.Bind("1 iii. Ship Tweaks Removals", "Cruiser Clipboard", false, "Removes the clipboard manual which comes with the Company Cruiser."); FloodlightRotation = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Rotating Floodlight", false, "The ship's top-mounted floodlight can rotate, toggled by a button near the start lever."); FloodLightRotationSpeed = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Ship Floodlight Rotation Speed", 45f, new ConfigDescription("Rotation speed of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 360f), Array.Empty())); FloodLightIntensity = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Ship Floodlight Brightness", 760, new ConfigDescription("Intensity value in lux of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 30000), Array.Empty())); FloodLightAngle = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Ship Floodlight Angle", 115, new ConfigDescription("Light angle (degrees) of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 180), Array.Empty())); FloodLightRange = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Ship Floodlight Range", 45, new ConfigDescription("Light range (meters) of the ship's floodlights.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 2000), Array.Empty())); FloodlightRotationOnLand = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Rotate Floodlight Upon Landing", false, "The ship's floodlight will automatically start rotating when the ship lands."); FloodlightExtraControls = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Floodlight Configuration Controls", true, "If floodlight rotation is enabled, the ship's main panel will come with additional controls to dynamically adjust the floodlight's speed, reset its position, or switch to targeting the closest player."); FloodlightPlayerFollow = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Floodlight Follows Players Button", false, "EXPERIMENTAL - If extra controls is enabled, a button is added to track the closest player (note that since the floodlight points outwards, the targeted player will be between the lights, not actually illuminated)."); FancyPanel = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Button Panel", false, "Revamps the ship's main panel to have interactable buttons and knobs, with working lights that will activate at certain times. None of these buttons do anything (yet), unless you have the rotating floodlight and its extra configuration enabled, which gives a purpose to a few of the buttons."); DynamicOccupancySign = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Dynamic Occupancy Sign", false, "The ship's 'maximum occupancy' sign will now update accordingly if more than 4 players join the lobby."); OccupancyScribble = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Occupancy Sign Scribble", false, "Instead of just changing the number on the sign, enabling this will scribble out the old number and replace it with a new hand-drawn one, giving it a more amateur feel."); OccupancyFixedValue = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Occupancy Sign Fixed Value", "None", new ConfigDescription("Pick a maximum occupancy here if you'd rather a single fixed value rather than one which updates dynamically.", (AcceptableValueBase)(object)new AcceptableValueList(new string[14] { "None", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "Infinite" }), Array.Empty())); PlayGlobalDeathSFX = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Broadcast Death Notification", false, "All players will recieve a quick succession of beeps to let them know that somebody has just died."); AutoTeleportBody = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Auto Teleport Bodies", false, "If the ship has a teleporter, it will automatically teleport a player's body back upon their death, letting all players know via the scrap collected notification. If the player's body has been destroyed, an alternative notification will appear instead."); UnrecoverableNotification = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Unrecoverable Body Notification", false, "Whenever a player is teleported but their body cannot be recovered, an alternative notification to the 'body collected' scrap notification will appear. This happens when the above auto teleport feature cannot recover a body, but enabling it here will make it happen on player-initiated teleports as well, and even if the above feature is disabled."); Red1Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Bottom Right Red", "", "If using fancy button panel, the tooltip for the bottom right red button (overriden by rotating floodlight)."); Red2Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Middle Right Red", "", "If using fancy button panel, the tooltip for the smaller middle right red button."); Black1Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Bottom Middle Black", "", "If using fancy button panel, the tooltip for the bottom middle black button (overriden by floodlight configuration controls)."); Black2Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Middle Right Black", "", "If using fancy button panel, the tooltip for the middle right black button (overriden by floodlight configuration controls)."); Knob1Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Middle Right Knob", "", "If using fancy button panel, the tooltip for the middle right knob (overriden by floodlight configuration controls)."); Knob2Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Top Middle Knob 1", "", "If using fancy button panel, the tooltip for the top middle knob closest to the player."); Knob3Tip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Top Middle Knob 2", "", "If using fancy button panel, the tooltip for the top middle knob farther from the player."); SmallKnobTip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Small Knob", "", "If using fancy button panel, the tooltip for the small knob at the top middle."); SmallRedTip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Small Red", "", "If using fancy button panel, the tooltip for the small red button on the right."); SmallGreenTip = ((BaseUnityPlugin)this).Config.Bind("2. Ship Additions", "Fancy Panel Tooltips - Small Green", "", "If using fancy button panel, the tooltip for the small green button on the right."); MissingHoverTipFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Missing Hover Tip Fix", true, "When starting a hold interaction before actually hovering over the interaction trigger, the hover tip will still display."); HandsFullFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Hands Full Tip Fix", true, "Fixes the misleading '[Hands full]' tip appearing even when you're able to interact with something with your hands full."); StretchedHoverIconFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Stretched Hand Icon Fix", true, "Fixes hand icons on interact triggers being stretched or squished on modded moons."); SmokeFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Smoke Particle Fix", true, "The exhaust smoke from the cruiser and smoke trail from old birds now blend normally into fog so the particles don't stand out so much from far away."); BridgeItemsFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Bridge Items Fix", true, "When a (vanilla) bridge collapses, any items left on it will now fall as well, rather than floating."); ClientShipItems = ((BaseUnityPlugin)this).Config.Bind("3. 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."); LandmineFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Mine Explosion On Exit Fix", true, "Fixes a vanilla issue where mines would explode after being stepped on while deactivated then going outside."); ApplianceInteractionFixes = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Appliance Interaction Fixes", true, "Fixes some of the issues with placing and grabbing items from the fridge and microwave (mostly the fridge)."); MonitorTransitionFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Ship Monitor Fixes", true, "Fixes some elements briefly appearing/lingering on the main ship monitor after taking off and going into orbit (mainly the ship and player icons and the video feed), and does some other small things such as removing the black bars which appear on the video feed."); LingeringLightningFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Lingering Lightning Fix", true, "Will stop all lightning effects on an object when it is brought indoors (so lightning particles and sounds will stop immediately). This also makes some changes to the HUD indicators added by GeneralImprovements to make them more accurate (and not linger indoors)."); TurretFiringFix = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Turret Stuck Firing Fix", true, "Attempts to stop the turret from shooting if it's disabled (by terminal or otherwise) while firing."); FallingRotationFix = ((BaseUnityPlugin)this).Config.Bind("3. 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("3. 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)."); ReplaceNullItems = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Swap Null Items", true, "Attempts to swap out any grabbable objects which have null item properties with valid ones. This happens when a moon has items in it that are not registered properly and the those items are then taken to another moon (e.g. the shovel and boombox on Aquatis). Note that this is only a bandage fix and may not work consistently in all situations. This fix should only come into play as a last resort if a problem remains unfixed by the moon/interior."); CrouchDamageAnimation = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "No Crouched Damage Animation", true, "Disables the player damaged animation if they are crouching, as this animation would cause players to stand up when damaged."); CleanBeltBagUI = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Clean Belt Bag UI", true, "Scan nodes currently on screen are cleared when opening the belt bag's inventory to reduce visual clutter."); BigScrew = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Big Screw", true, "'Big bolt' is accurately renamed to 'Big screw'."); KiwiManeaterScream = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Sapsucker Eggs Scream At Maneaters", true, "Giant sapsucker eggs will scream like they do on the company desk when a maneater baby is about to eat them."); RadarPathAllExits = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Radar Pathfind To All Exits", false, "EXPERIMENTAL - The guiding line on the ship radar will path to the closest exit to the player, instead of always pathing them to the main entrance (note that this is the closest path in terms of direct distance, ignoring any walls or obstacles in the way)."); DisableTrapsOnApparatusRemoval = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Apparatus Hazard Shutdown", false, "Disables all traps/hazards on the map after removing the apparatus."); DisableTrapsOnBreakerSwitch = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Breaker Hazard Shutdown", false, "Disables all traps/hazards on the map when the breaker power is switched off."); SpikesCooldownMute = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Mute Spike Trap Audio When Disabled", false, "Mutes the screeching sound which alerts players they're standing under a spike trap if that spike trap is disabled (e.g. on cooldown)."); ForceSunShadows = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Sun Always Casts Shadows", false, "Certain custom moons have a sun which does not cast shadows, leading to an overly bright ship interior. With this enabled, the sun will always cast shadows (beware any performance costs)."); SunFade = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Fade Out Sun Texture After Sunset", false, "Fades the sun texture to black slowly starting at sunset (no effect on lighting), so on moons where the low horizon is visible, you won't see the sun in a dark sky."); FearfulBuilding = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Place Furniture While Afraid", false, "Removes the inability to build above a certain fear level."); OldHalloweenElevatorMusic = ((BaseUnityPlugin)this).Config.Bind("3. 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)."); ScanHighlights = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Scanned Item Highlights", "Disabled", new ConfigDescription("EXPERIMENTAL - Creates a holographic highlight on scanned objects. If this causes performance issues (lag) try the 'performant' option (renders less layers and disables the fading in effect).", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "Disabled", "Enabled (Full)", "Enabled (Performant)" }), Array.Empty())); ApparatusSpawnChance = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Apparatus Increased Enemy Spawn Chance", 70, "Percentage chance for the minimum enemy spawns each hour to increase after removing the apparatus (vanilla is 70%). This is a separate feature from the 'blackout' options at the top."); ApparatusSpawnMin = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Apparatus Minimum Enemy Spawns", 2, "The minimum number of enemy spawns each hour after removing the apparatus if the above chance is hit (vanilla is 2). This is a separate feature from the 'blackout' options at the top."); StartingMoon = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Starting Moon", "Experimentation", "LLL REQUIRED - The default moon your ship will orbit when creating a new save or after being fired (only the moon name needs to be included, not the number). This can be either a vanilla or modded moon."); MuteScrapList = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Muted Scrap List", "", "A comma separated list of items which will have their passive noise effects disabled (e.g. 'Comedy, Tragedy, Clock, Toy robot, Radioactive barrel', not case-sensitive). Eyeless dogs will also no longer hear these sounds."); SingleItemBlacklist = ((BaseUnityPlugin)this).Config.Bind("3. General Tweaks", "Single Item Day Blacklist", "", "A comma separated list of items which will be excluded from a 'single item day' where only one type of scrap will spawn (note that all two-handed items and very rare items are already blacklisted in vanilla)."); CoilheadElevatorFix = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Coilhead Elevator Fix", true, "Fixes inconsistent sightlines when standing in an elevator, which could cause coilheads to kill players in the elevator while being looked at."); ManeaterAttackFix = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Maneater Attack Networking Fix", true, "Fixes an issue where the maneater attack would sometimes skip it's wind-up when switching between multiple targets."); DropMasks = ((BaseUnityPlugin)this).Config.Bind("4. Enemy 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("4. Enemy 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(0, 200), Array.Empty())); CentipedeMode = ((BaseUnityPlugin)this).Config.Bind("4. Enemy 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(new string[3] { "Vanilla", "Second Chance", "Fixed Damage" }), Array.Empty())); CentipedeFixedDamage = ((BaseUnityPlugin)this).Config.Bind("4. Enemy 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(0f, 1f), Array.Empty())); CentipedeSecondChanceThreshold = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Snare Flea Second Chance Threshold", 15, new ConfigDescription("At what threshold of health should the snare flea drops off the player if it's using the 'Second Chance' mode (vanilla value in singleplayer is 15 HP).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); LeviathanSurfacePatch = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Earth Leviathan More Surfaces", false, "Allows the earth leviathan to burrow through and emerge from more types of surfaces, using the list below."); LeviathanNaturalSurfaces = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Earth Leviathan Surfaces List", "Wood, Tiles, Aluminum, Rock, Catwalk, Concrete, Metal, Carpet, Puddle, Untagged", "Surface tags (tied to footstep sounds) earth leviathans should be able to burrow through if above option is enabled (in addition to the default tags Grass, Gravel, and Snow)"); LeviathanQuicksand = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Earth Leviathan Quicksand", false, "Earth leviathans will leave behind patches of quicksand where they emerge and enter the ground (note that quicksand cannot appear on every type of surface)."); ManeaterTransformInterrupt = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Maneater Transformation Interrupt", false, "Hitting the maneater while it's transforming will cause it to immediately exit its state and become active."); ManeaterFastDoors = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Maneater Fast Doors", false, "The maneater will move more quickly through doors."); TulipSnakeMuteLaugh = ((BaseUnityPlugin)this).Config.Bind("4. Enemy Tweaks", "Quiet Tulip Snakes", false, "Tulip snake chuckles will no longer alert eyeless dogs."); MineDisableAnimation = ((BaseUnityPlugin)this).Config.Bind("5. 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."); MineSoundEffect = ((BaseUnityPlugin)this).Config.Bind("5. Zap Gun & Hazards", "Mine Cooldown Sound Effect", "Click", new ConfigDescription("The repeating sound effect that will play when a mine is disabled: either a clicking noise, a beeping noise, or no sound effect at all.", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "Click", "Beep", "None" }), Array.Empty())); SpikeTrapDisableAnimation = ((BaseUnityPlugin)this).Config.Bind("5. 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("5. 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(new string[4] { "Only First Time", "Every Session", "Always", "Vanilla" }), Array.Empty())); ZapGunTutorialCount = ((BaseUnityPlugin)this).Config.Bind("5. 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(1, 15), Array.Empty())); ZapGunTutorialRevamp = ((BaseUnityPlugin)this).Config.Bind("5. 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("5. 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("5. 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("5. 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(5f, 150f), Array.Empty())); ZappableTurrets = ((BaseUnityPlugin)this).Config.Bind("5. Zap Gun & Hazards", "Zappable Turrets", true, "Allows you to disable turrets with the zap gun."); TurretZapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind("5. 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(1f, 50f), Array.Empty())); ZappableMines = ((BaseUnityPlugin)this).Config.Bind("5. Zap Gun & Hazards", "Zappable Mines", true, "Allows you to disable mines with the zap gun."); MineZapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind("5. 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(1f, 50f), Array.Empty())); ZappableSpikeTraps = ((BaseUnityPlugin)this).Config.Bind("5. Zap Gun & Hazards", "Zappable Spike Traps", true, "Allows you to disable spike traps with the zap gun."); SpikeTrapBaseCooldown = ((BaseUnityPlugin)this).Config.Bind("5. 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(1f, 50f), Array.Empty())); ZapScalingFactor = ((BaseUnityPlugin)this).Config.Bind("5. 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(0.03f, 3f), Array.Empty())); ZappableBigDoors = ((BaseUnityPlugin)this).Config.Bind("5. 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("5. 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("5. 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("6. 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("6. 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("6. 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(0.05f, 40f), Array.Empty())); DustCloudsNoise = ((BaseUnityPlugin)this).Config.Bind("6. 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("7. 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("7. 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("7. 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("7. 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("7. 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("7. 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("8. 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("8. Shotgun QOL", "Show Loaded Shells", false, "Shows how many shells your shotgun has left in the top-right tooltips."); SafetyOnString = ((BaseUnityPlugin)this).Config.Bind("8. Shotgun QOL", "Shotgun Safety On Tooltip", "The safety is on", "Customize the tooltip for the shotgun safety toggle (vanilla: 'Turn safety off')."); SafetyOffString = ((BaseUnityPlugin)this).Config.Bind("8. Shotgun QOL", "Shotgun Safety Off Tooltip", "The safety is off", "Customize the tooltip for the shotgun safety toggle (vanilla: 'Turn safety on')."); UnloadShells = ((BaseUnityPlugin)this).Config.Bind("8. Shotgun QOL", "Unload Shells", false, "Allows you to eject shells already in the shotgun by holding the reload button (E) while you have no shells to load in your inventory. Top-right tooltips are dynamically adjusted accordingly."); DoAmmoCheck = ((BaseUnityPlugin)this).Config.Bind("8. Shotgun QOL", "Check and Unload Animation", false, "When pressing reload while unable to reload, the shotgun will open to reveal how many shells it has. Enabling this will also mean the eject shells function (which has you holding down the reload button) will be animated."); PickUpGunOrbit = ((BaseUnityPlugin)this).Config.Bind("8. 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("8. 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("9. 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 affect sun)."); TrueBlackout = ((BaseUnityPlugin)this).Config.Bind("9. 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)."); DisableTrapsOnTrueBlackout = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "MrovWeathers True Blackout Hazard Shutdown", false, "During MrovWeathers' blackout, all traps/hazards are disabled and doors are opened in the facility (this makes the weather much easier to navigate)."); BlackoutSFX = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "Blackout Sound Effect", true, "Plays a global sound effect when a blackout is triggered by apparatus or weather (Apparatus True Blackout and/or MrovWeathers True Blackout must be enabled to hear the sound)."); TrueBlackoutNameBlacklist = ((BaseUnityPlugin)this).Config.Bind("9. 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("9. 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."); BlacklistLightAnimators = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "Ignore Animators", false, "Exclude any lights associated with animations (will not exclude any manually included animators, such as the vanilla light switches). With mods like Facility Meltdown (or any mod/moon which animates lights), this will allow the lights to animate as usual rather than being blacked out."); BlacklistPoles = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "Ignore Guidance Poles", false, "Exclude the guidance pole lights found on moons like Rend, Dine, and Titan."); BlacklistEmergency = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "Ignore Emergency Exit Lights", false, "Exclude the red lights mounted on interior emergency exits."); BlackoutSun = ((BaseUnityPlugin)this).Config.Bind("9. Blackout", "Blackout Weather Sun Behaviour", "Blackout Sun + Lights", new ConfigDescription("'Blackout Sun + Lights': Default blackout behaviour from MrovWeathers, both the sun and all lights inside and outside will go dark. - 'Blackout Only Sun': 'Blackout weather will only affect the sun and leave lights alone.'. - 'Blackout Only Lights': Blackout weather will only affect interior and exterior lights and leave the sun alone.", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "Blackout Sun + Lights", "Blackout Only Sun", "Blackout Only Lights" }), Array.Empty())); BlackoutFloodLightIntensity = ((BaseUnityPlugin)this).Config.Bind("9. 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(0, 60000), Array.Empty())); BlackoutFloodLightAngle = ((BaseUnityPlugin)this).Config.Bind("9. 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(0, 180), Array.Empty())); BlackoutFloodLightRange = ((BaseUnityPlugin)this).Config.Bind("9. 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(0, 2000), Array.Empty())); PlayerCamAngleX = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Vertical Angle", 0f, new ConfigDescription("How much the head-mounted camera should be angled up or down (-90 degrees is looking straight up, 90 degrees is looking straight down).", (AcceptableValueBase)(object)new AcceptableValueRange(-90f, 90f), Array.Empty())); PlayerCamAngleY = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Orientation", 0f, new ConfigDescription("How much the head-mounted camera should be rotated on its vertical axis (e.g. setting this to 180 degrees will rotate the camera to face towards the player).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 360f), Array.Empty())); PlayerCamPosVertical = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Vertical Offset", 0f, new ConfigDescription("How far up or down the head-mounted camera should be moved (relative to the player's standing position). You might need to change this if you change the rotation.", (AcceptableValueBase)(object)new AcceptableValueRange(-2f, 2f), Array.Empty())); PlayerCamPosHorizontal = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Closeness", 0f, new ConfigDescription("How far away or towards the player the head-mounted camera should be moved (positive values move the camera away).", (AcceptableValueBase)(object)new AcceptableValueRange(-3f, 3f), Array.Empty())); PlayerCamClipping = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Extra Render Distance", 0f, new ConfigDescription("How much extra distance the head-mounted camera should render (increase this to see more of the area surrounding the player). The vanilla base is 11, so if you set this to 11 as well you'll get double the render distance at 22.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), Array.Empty())); LocalCam = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "See Your Own Cam", false, "Instead of a static placeholder image for the head-mounted camera, your camera feed will display as normal (if the camera is rotated to face the player, their model will appear blocky and low poly unless you use the option below)."); TrueLocalCam = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "See Your Own High Poly Model", false, "When using the above option, you can see your own model in realtime (if the camera is facing you). With this disabled, a lower poly blocky version of your model is what you'll see by default. This will only matter if you've rotated the camera to face the player, or are using the sprinting option. This is a pretty involved change, so there may be issues with mods that change player models."); HideLocalCam = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Hide Your Own Cam", false, "Instead of a static placeholder image for the head-mounted camera, you will just see your name (position adjusted accordingly)."); HideAllCams = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Hide All Cams", false, "Only names will display for each player instead of the head-mounted camera (position adjusted accordingly)."); SprintCam = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Cam Faces Player While Sprinting", false, "When a player is running, the head-mounted camera switches to face them (for comedic effect)."); ImprovedTextBox = ((BaseUnityPlugin)this).Config.Bind("A. Head Cam Tweaks", "Improved Name Text Box", false, "EXPERIMENTAL - Allows player names to expand onto multiple lines, split themselves at better places, and generally display better."); LLLUnlockSyncing = ((BaseUnityPlugin)this).Config.Bind("X. 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."); LLLShipLeverFix = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "LLL - Start Ship Lever Fix", false, "Fixes the ship lever remaining interactable while routing (WARNING: this may cause issues with mods changing ship routing, such as RandomMoonFX)."); VideoTapeSkip = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "Wesleys 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."); ShipWindowsShutterFix = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "ShipWindows - Shutter Fix", true, "Closes the ship window shutters when taking off from a planet (requires you to have 'Hide Moon Transitions' enabled in ShipWindowsBeta config)."); ShipWindowsShutterAudio = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "ShipWindows - Shutter Sound Effect", "Unchanged", new ConfigDescription("Allows you to change the sound effect of the shutter switch (unrelated to the voice lines) to either use only one of its two sound effects or make no noise at all.", (AcceptableValueBase)(object)new AcceptableValueList(new string[4] { "Unchanged", "Only Open", "Only Close", "Muted" }), Array.Empty())); MrovWeatherTweaksAnnouncement = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "Weather Tweaks - Announcement Change", true, "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("X. Mod Tweaks", "SSS 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."); SolarFlareTwoRadar = ((BaseUnityPlugin)this).Config.Bind("X. Mod Tweaks", "No Signal Solar Flare", false, "The solar flare weather from LethalElements will cause the terminal's second radar map to show 'no signal', since the terminal is otherwise unaffected by the solar flare's technological interruptions."); ClientsideMode = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "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)."); DebugMode = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Dev Mode", false, "For testing certain interactions and resetting some variables. Do not enable unless you know what you're doing."); ClearOrphans = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Clear Orphaned Config On Next Join", false, "This check box acts like a button which will only activate once then go back to being unchecked: after starting a game, all unused config entries will be cleared. These are configs which are still in the config file, but you won't see them in your mod launcher (e.g. config entries that no longer exist in the current version or scrap bonus entries for interiors which are no longer installed)"); ExtraLogs = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Verbose Logs", false, "Extra logging for debugging specific functions."); DisableWarnings = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Disable Warning Popups", false, "Disables all red warning boxes and their sound effects, vanilla and modded (e.g. when attempting to land with 0 days left)."); InteriorLogging = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Interior Analysis", false, "LLL REQUIRED - Logs the area and scrap density of the generated interior and its tiles."); ZeroWeightCheck = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Zero Weight On Empty Inventory", false, "Sets your carrying weight to zero when your inventory is emptied (to solve potential bugs/mod issues where your weight would get offset and remain above 0 even with no items)."); FixNaNColliders = ((BaseUnityPlugin)this).Config.Bind("Z. Technical", "Fix Collider Errors", false, "An experimental option which will attempt to catch and resolve errors when an item's collider encounters some catastrophic failure. Enable this if you sometimes encounter issues with players falling through the world alongside the error: 'Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider'. Even if this fix doesn't work, it might provide some useful logs you can send to me!"); 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")); BlackoutTriggerPatches.LoadAssets(); Patch(); Logger.LogInfo((object)"ScienceBird.ScienceBirdTweaks v4.7.4 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; } else if (assembly.GetName().Name == "TestAccount666.ShipWindows") { Logger.LogDebug((object)"Found test1!"); test1Present = true; } else if (assembly.GetName().Name == "TestAccount666.GoodItemScan") { Logger.LogDebug((object)"Found test2!"); test2Present = true; } else if (assembly.GetName().Name == "LiveReaction") { Logger.LogDebug((object)"Found mborsh!"); mborshPresent = true; } else if (assembly.GetName().Name == "QualityCompanyFork") { Logger.LogDebug((object)"Found qcf!"); qcfPresent = true; } else if (assembly.GetName().Name == "TwoRadarMaps") { Logger.LogDebug((object)"Found zaggy!"); zaggyPresent = true; } else if (assembly.GetName().Name == "GeneralImprovements") { Logger.LogDebug((object)"Found shaosil!"); shaosilPresent = true; } } if (doLobbyCompat) { LobbyCompatibility.RegisterCompatibility(); } if (mrovPresent1 && mrovPresent2 && TrueBlackout.Value) { MrovWeathersPatch.DoPatching(); } if (zigzagPresent && ((mrovPresent3 && SSSTerminalStock.Value) || PreventWorthlessDespawn.Value || UsePreventDespawnList.Value)) { SSSPatches.DoPatching(); } if (wesleyPresent && VideoTapeSkip.Value) { WesleyPatches.DoPatching(); } if (batbyPresent) { LLLPatches.DoPatching(); } if (jacobPresent) { JLLPatches.DoPatching(); } if (test1Present) { ShipWindowsPatch.DoPatching(); } if (test2Present && ScanHighlights.Value != "Disabled") { GoodItemScanPatches.DoPatching(); } if (qcfPresent) { QualityCompanyForkPatch.DoPatching(); } if (shaosilPresent && LingeringLightningFix.Value) { GeneralImprovementsPatch.DoPatching(); } if (DynamicOccupancySign.Value || OccupancyFixedValue.Value != "None") { OccupancyPatch.LoadAssets(); } 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") && !methodInfo.Name.Contains("ConfigLoader")) || batbyPresent) && ((!methodInfo.Name.Contains("CollectDataServerRpc") && !methodInfo.Name.Contains("SendDataClientRpc") && !methodInfo.Name.Contains("ResetDictClientRpc")) || zigzagPresent) && ((!methodInfo.Name.Contains("StopTapeServerRpc") && !methodInfo.Name.Contains("StopTapeClientRpc")) || wesleyPresent) && (!methodInfo.Name.Contains("ScanUpdatePatch") || test2Present)) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ScienceBird.ScienceBirdTweaks"; public const string PLUGIN_NAME = "ScienceBirdTweaks"; public const string PLUGIN_VERSION = "4.7.4"; } } 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(); 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(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [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 disabledSFX; 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown if (!ScienceBirdTweaks.SpikeTrapDisableAnimation.Value && !ScienceBirdTweaks.MineDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return; } doorPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("DoorKillTrigger"); disabledMat = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SpikeRoofTrapDisabledMat"); offMat = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SpikeRoofTrapOffMat"); disabledSFX = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("SingleClick"); string value = ScienceBirdTweaks.MineSoundEffect.Value; string text = value; if (!(text == "Beep")) { if (text == "None") { disabledSFX = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("SingleSilence"); } } else { disabledSFX = (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.ZappableBigDoors.Value) && ScienceBirdTweaks.ZapGunRework.Value) { InitializeBigDoors(__instance); ((Component)__instance).gameObject.AddComponent(); } } public static void InitializeBigDoors(TerminalAccessibleObject terminalObj) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((ScienceBirdTweaks.PlayerLethalBigDoors.Value || ScienceBirdTweaks.EnemyLethalBigDoors.Value) && !Object.op_Implicit((Object)(object)((Component)terminalObj).gameObject.transform.Find("DoorKillTrigger(Clone)"))) { GameObject val = Object.Instantiate(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(); } 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().SetBool("open", open); } } } [HarmonyPatch(typeof(SpikeRoofTrap), "ToggleSpikesEnabledLocalClient")] [HarmonyPostfix] public static void SpikeCooldownPatch(SpikeRoofTrap __instance, bool enabled) { //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.SpikesCooldownMute.Value && (Object)(object)((Component)__instance).transform.parent != (Object)null && (Object)(object)((Component)__instance).transform.parent.parent != (Object)null && (Object)(object)((Component)__instance).transform.parent.parent.parent != (Object)null) { Transform val = ((Component)__instance).transform.parent.parent.parent.Find("CreakingSFX"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.GetComponent().mute = !enabled; } } if (!ScienceBirdTweaks.SpikeTrapDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return; } GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.parent.parent).gameObject; SpikesZapper componentInChildren = gameObject.GetComponentInChildren(); if (!((Object)(object)componentInChildren != (Object)null) || componentInChildren.tempStun) { return; } if (!enabled) { if (BlackoutTriggerPatches.doingHazardShutdown) { componentInChildren.light.intensity = 0f; Material[] materials = ((Renderer)componentInChildren.supportLights.GetComponent()).materials; materials[0] = offMat; ((Renderer)componentInChildren.supportLights.GetComponent()).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()).materials; materials2[0] = disabledMat; ((Renderer)componentInChildren.supportLights.GetComponent()).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()).materials; materials3[0] = componentInChildren.originalMat; ((Renderer)componentInChildren.supportLights.GetComponent()).materials = materials3; } } } [HarmonyPatch(typeof(Landmine), "TriggerMineOnLocalClientByExiting")] [HarmonyPrefix] public static bool DetonateCheck1(Landmine __instance) { if (!ScienceBirdTweaks.MineDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return true; } if (!__instance.mineActivated || (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) && (((Component)__instance).GetComponent().tempStun || ((Component)__instance).GetComponent().light1.intensity == 0f))) { return false; } return true; } [HarmonyPatch(typeof(Landmine), "SetOffMineAnimation")] [HarmonyPrefix] public static bool DetonateCheck2(Landmine __instance) { if (!ScienceBirdTweaks.MineDisableAnimation.Value && !ScienceBirdTweaks.ZapGunRework.Value) { return true; } if (!__instance.mineActivated || (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) && (((Component)__instance).GetComponent().tempStun || ((Component)__instance).GetComponent().light1.intensity == 0f))) { return false; } return true; } [HarmonyPatch(typeof(Landmine), "OnTriggerExit")] [HarmonyPrefix] public static void MineTriggerExitFix(Landmine __instance, Collider other) { if (ScienceBirdTweaks.LandmineFix.Value && !__instance.mineActivated && ((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { __instance.localPlayerOnMine = false; } } } [HarmonyPatch(typeof(Turret), "Update")] [HarmonyPrefix] public static void TurretUpdatePatch(Turret __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.TurretFiringFix.Value && !__instance.turretActive && (int)__instance.turretModeLastFrame > 0) { __instance.turretMode = (TurretMode)0; __instance.turretModeLastFrame = (TurretMode)0; __instance.mainAudio.clip = null; __instance.farAudio.Stop(); TurretZapper component = ((Component)__instance).GetComponent(); if (((!ScienceBirdTweaks.ZappableTurrets.Value || !ScienceBirdTweaks.ZapGunRework.Value) && (Object)(object)component == (Object)null) || ((Object)(object)component != (Object)null && !component.panicMode)) { __instance.rotatingClockwise = false; __instance.berserkAudio.Stop(); __instance.rotationSpeed = 28f; } if (__instance.fadeBulletAudioCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(__instance.fadeBulletAudioCoroutine); } __instance.fadeBulletAudioCoroutine = ((MonoBehaviour)__instance).StartCoroutine(__instance.FadeBulletAudio()); __instance.bulletParticles.Stop(true, (ParticleSystemStopBehavior)1); __instance.rotatingSmoothly = true; __instance.turretAnimator.SetInteger("TurretMode", 0); __instance.turretInterval = Random.Range(0f, 0.15f); } } [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(); if (!((Object)(object)component != (Object)null) || component.tempStun || component.disabled) { return; } if (!enabled) { if (BlackoutTriggerPatches.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 if (BlackoutTriggerPatches.doingHazardStartup) { __instance.mineAudio.Play(); __instance.mineAudio.volume = 1f; component.light1.intensity = 227.6638f; component.light2.intensity = 227.6638f; component.indirectLight.intensity = 436.6049f; } else { ScienceBirdTweaks.Logger.LogDebug((object)"Ending landmine special animation!"); __instance.mineAnimator.SetBool("disabled", false); } } } 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(spawnPrefab, ((Component)playerWhoTriggered.lowerSpine).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); } playerWhoTriggered.KillPlayer(Vector3.zero, !dontSpawnBody, causeOfDeath, deathAnimation, default(Vector3), false); } private void OnTriggerStay(Collider other) { if (ScienceBirdTweaks.PlayerLethalBigDoors.Value && ((Component)other).gameObject.CompareTag("Player") && Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent()) && ((NetworkBehaviour)((Component)other).gameObject.GetComponent()).IsOwner && !((Component)other).gameObject.GetComponent().isPlayerDead) { KillPlayer(((Component)other).gameObject.GetComponent()); } if (ScienceBirdTweaks.EnemyLethalBigDoors.Value && ((NetworkBehaviour)RoundManager.Instance).IsServer && ((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead) { component.mainScript.KillEnemyOnOwnerClient(false); } } } } public class MineZapper : NetworkBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MineZapper <>4__this; private Image 5__1; private Image[] 5__2; private int 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 //IL_014e: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0052; case 1: <>1__state = -1; goto IL_0052; case 2: <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = <>4__this.cooldownTimer / <>4__this.effectiveCooldown; goto IL_01ce; case 3: { <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = Mathf.Abs(<>4__this.cooldownTimer / 1.5f - 1f); 5__3++; if (5__3 % 7 == 0) { ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = !((Behaviour)<>4__this.terminalObj.mapRadarText).enabled; } break; } IL_01ce: if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 2; return true; } <>4__this.terminalObj.TerminalCodeCooldownReached(); ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.green; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.green; <>4__this.cooldownTimer = 1.5f; 5__3 = 0; break; IL_0052: if (!<>4__this.startRoutine) { <>2__current = null; <>1__state = 1; return true; } <>4__this.startRoutine = false; if (!<>4__this.terminalObj.initializedValues) { <>4__this.terminalObj.InitializeValues(); } 5__1 = <>4__this.terminalObj.mapRadarBox; 5__2 = ((Component)<>4__this.terminalObj.mapRadarText).gameObject.GetComponentsInChildren(); 5__4 = 0; while (5__4 < 5__2.Length) { if ((int)5__2[5__4].type == 3) { 5__1 = 5__2[5__4]; } 5__4++; } ((Behaviour)5__1).enabled = true; ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.red; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.red; goto IL_01ce; } if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 3; return true; } ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = true; ((Behaviour)5__1).enabled = false; <>4__this.terminalObj.inCooldown = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } 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; public bool disabled = false; private void Start() { mine = ((Component)this).GetComponent(); terminalObj = ((Component)this).GetComponent(); Light[] componentsInChildren = ((Component)this).GetComponentsInChildren(); 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(); if ((Object)(object)component == (Object)null) { disabled = true; return; } 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 && !disabled; } 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()); } } [IteratorStateMachine(typeof(d__22))] private IEnumerator mineCoolDown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { <>4__this = this }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MineZapper"; } } public class SpikesZapper : NetworkBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SpikesZapper <>4__this; private Image 5__1; private Image[] 5__2; private int 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Invalid comparison between Unknown and I4 //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0052; case 1: <>1__state = -1; goto IL_0052; case 2: <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = <>4__this.cooldownTimer / <>4__this.effectiveCooldown; goto IL_01ee; case 3: { <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = Mathf.Abs(<>4__this.cooldownTimer / 1.5f - 1f); 5__3++; if (5__3 % 7 == 0) { ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = !((Behaviour)<>4__this.terminalObj.mapRadarText).enabled; } break; } IL_01ee: if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 2; return true; } ScienceBirdTweaks.Logger.LogDebug((object)"COOLDOWN1 REACHED"); <>4__this.terminalObj.TerminalCodeCooldownReached(); ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.green; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.green; <>4__this.cooldownTimer = 1.5f; 5__3 = 0; break; IL_0052: if (!<>4__this.startRoutine) { <>2__current = null; <>1__state = 1; return true; } ScienceBirdTweaks.Logger.LogDebug((object)"STARTING ROUTINE"); <>4__this.startRoutine = false; if (!<>4__this.terminalObj.initializedValues) { <>4__this.terminalObj.InitializeValues(); } 5__1 = <>4__this.terminalObj.mapRadarBox; 5__2 = ((Component)<>4__this.terminalObj.mapRadarText).gameObject.GetComponentsInChildren(); 5__4 = 0; while (5__4 < 5__2.Length) { if ((int)5__2[5__4].type == 3) { 5__1 = 5__2[5__4]; } 5__4++; } ((Behaviour)5__1).enabled = true; ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.red; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.red; ScienceBirdTweaks.Logger.LogDebug((object)"BEFORE COOLDOWN1"); goto IL_01ee; } if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 3; return true; } ScienceBirdTweaks.Logger.LogDebug((object)"COOLDOWN2 REACHED"); ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = true; ((Behaviour)5__1).enabled = false; <>4__this.terminalObj.inCooldown = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } 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 = false; public float multiplier = 0.25f; private void Start() { mainObj = ((Component)((Component)this).transform.parent).gameObject; GameObject gameObject = ((Component)mainObj.transform.Find("AnimContainer")).gameObject; if (Object.op_Implicit((Object)(object)gameObject.transform.Find("BaseSupport"))) { supportLights = ((Component)gameObject.transform.Find("BaseSupport")).gameObject; mainObj.layer = 21; light = gameObject.GetComponentInChildren(); spikes = mainObj.GetComponentInChildren(); terminalObj = mainObj.GetComponentInChildren(); originalMat = ((Renderer)supportLights.GetComponent()).materials[0]; masterZappable = ScienceBirdTweaks.ZappableSpikeTraps.Value && ScienceBirdTweaks.ZapGunRework.Value; cooldown = ScienceBirdTweaks.SpikeTrapBaseCooldown.Value; multiplier = ScienceBirdTweaks.ZapScalingFactor.Value; } } bool IShockableWithGun.CanBeShocked() { return masterZappable && spikes.trapActive && !terminalObj.inCooldown; } 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()); } } [IteratorStateMachine(typeof(d__22))] private IEnumerator spikesCoolDown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { <>4__this = this }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SpikesZapper"; } } public class TurretZapper : NetworkBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__21 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TurretZapper <>4__this; private Image 5__1; private Image[] 5__2; private int 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0339: 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_00c7: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!((Object)(object)<>4__this.terminalObj != (Object)null)) { break; } if (!<>4__this.terminalObj.initializedValues) { <>4__this.terminalObj.InitializeValues(); } 5__1 = <>4__this.terminalObj.mapRadarBox; 5__2 = ((Component)<>4__this.terminalObj.mapRadarText).gameObject.GetComponentsInChildren(); 5__4 = 0; while (5__4 < 5__2.Length) { if ((int)5__2[5__4].type == 3) { 5__1 = 5__2[5__4]; } 5__4++; } ((Behaviour)5__1).enabled = true; ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.red; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.red; goto IL_01a8; case 1: <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = <>4__this.cooldownTimer / <>4__this.effectiveCooldown; goto IL_01a8; case 2: { <>1__state = -1; <>4__this.cooldownTimer -= Time.deltaTime; 5__1.fillAmount = Mathf.Abs(<>4__this.cooldownTimer / 1.5f - 1f); 5__3++; if (5__3 % 7 == 0) { ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = !((Behaviour)<>4__this.terminalObj.mapRadarText).enabled; } goto IL_02d3; } IL_02d3: if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 2; return true; } ((Behaviour)<>4__this.terminalObj.mapRadarText).enabled = true; ((Behaviour)5__1).enabled = false; <>4__this.terminalObj.inCooldown = false; <>4__this.turret.turretRod.rotation = <>4__this.savedRot; if (((NetworkBehaviour)<>4__this).IsServer) { <>4__this.turret.switchRotationTimer = <>4__this.savedTimer; } <>4__this.restoredRot = true; 5__1 = null; 5__2 = null; break; IL_01a8: if (<>4__this.cooldownTimer > 0f) { <>2__current = null; <>1__state = 1; return true; } <>4__this.terminalObj.TerminalCodeCooldownReached(); ((Graphic)<>4__this.terminalObj.mapRadarText).color = Color.green; ((Graphic)<>4__this.terminalObj.mapRadarBox).color = Color.green; <>4__this.cooldownTimer = 1.5f; 5__3 = 0; goto IL_02d3; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } 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(); terminalObj = ((Component)this).GetComponent(); 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)(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); } } [IteratorStateMachine(typeof(d__21))] private IEnumerator turretCoolDown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__21(0) { <>4__this = this }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TurretZapper"; } } [HarmonyPatch] public class ZapPatches { [CompilerGenerated] private sealed class d__28 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool __instance; private int 5__1; private int 5__2; private RaycastHit[] 5__3; private int 5__4; private int 5__5; private IShockableWithGun 5__6; private Vector3 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; __instance.anomalyMask = 2621448; __instance.effectAnimator.SetTrigger("Scan"); __instance.gunAudio.PlayOneShot(__instance.scanAnomaly); __instance.lightningScript = __instance.lightningObject.GetComponent(); Transform lightningDest = __instance.lightningDest; if (lightningDest != null) { lightningDest.SetParent((Transform)null); } Transform lightningBend = __instance.lightningBend1; if (lightningBend != null) { lightningBend.SetParent((Transform)null); } Transform lightningBend2 = __instance.lightningBend2; if (lightningBend2 != null) { lightningBend2.SetParent((Transform)null); } 5__1 = 0; break; } case 1: <>1__state = -1; 5__1++; break; } if (5__1 < 12) { if (((NetworkBehaviour)__instance).IsOwner) { if (((GrabbableObject)__instance).isPocketed) { return false; } __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); 5__2 = Physics.SphereCastNonAlloc(__instance.ray, 5f, __instance.raycastEnemies, 5f, __instance.anomalyMask, (QueryTriggerInteraction)2); 5__3 = (RaycastHit[])(object)new RaycastHit[5__2]; 5__4 = 0; while (5__4 < 5__2) { 5__3[5__4] = __instance.raycastEnemies[5__4]; 5__4++; } 5__3 = 5__3.Where((RaycastHit x) => (Object)(object)((RaycastHit)(ref x)).collider != (Object)null).OrderBy(LayerSort).ThenBy((RaycastHit x) => ((RaycastHit)(ref x)).distance) .ToArray(); 5__5 = 0; while (5__5 < 5__3.Length) { __instance.hit = 5__3[5__5]; if (!((Object)(object)((RaycastHit)(ref __instance.hit)).transform == (Object)null) && ((Component)((RaycastHit)(ref __instance.hit)).transform).gameObject.TryGetComponent(ref 5__6) && 5__6.CanBeShocked()) { 5__7 = 5__6.GetShockablePosition(); ScienceBirdTweaks.Logger.LogDebug((object)("Got shockable transform name : " + ((Object)((Component)5__6.GetShockableTransform()).gameObject).name)); if (__instance.GunMeetsConditionsToShock(((GrabbableObject)__instance).playerHeldBy, 5__7, 60f)) { __instance.gunAudio.Stop(); __instance.BeginShockingAnomalyOnClient(5__6); return false; } } 5__6 = null; 5__5++; } 5__3 = null; } <>2__current = (object)new WaitForSeconds(0.125f); <>1__state = 1; return true; } __instance.SwitchFlashlight(false); __instance.isScanning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } 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 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(); MineAudio mineAudio = ((Component)__instance).gameObject.AddComponent(); mineAudio.audioSource = ((Component)__instance).gameObject.GetComponent(); mineAudio.beepClip = HazardPatches.disabledSFX; } } [HarmonyPatch(typeof(Turret), "Start")] [HarmonyPostfix] private static void TurretPatch(ref Turret __instance) { if (ScienceBirdTweaks.ZapGunRework.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPatch(typeof(SpikeRoofTrap), "Start")] [HarmonyPostfix] private static void SpikesPatch(ref SpikeRoofTrap __instance) { if (!ScienceBirdTweaks.ZapGunRework.Value && !ScienceBirdTweaks.SpikeTrapDisableAnimation.Value) { return; } GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.parent.parent).gameObject; if (!((Object)(object)gameObject == (Object)null) && !(((Object)gameObject).name != "Container")) { GameObject gameObject2 = ((Component)((Component)__instance).gameObject.transform.parent).gameObject; gameObject2.layer = 21; Transform val = gameObject.transform.Find("LaserEye"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.layer = 21; ((Component)val).gameObject.AddComponent(); BoxCollider val2 = ((Component)val).gameObject.AddComponent(); ((Collider)val2).isTrigger = true; } } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void SetZapGunProperties(GameNetworkManager __instance) { Item val = (from x in Resources.FindObjectsOfTypeAll() 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("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(); 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().runtimeAnimatorController = runtimeAnimatorController; rightArrow.GetComponent().runtimeAnimatorController = runtimeAnimatorController; image1 = ((Component)leftArrow.transform.Find("Image (1)")).gameObject.GetComponent(); image2 = ((Component)rightArrow.transform.Find("Image (1)")).gameObject.GetComponent(); } if (!(ScienceBirdTweaks.ZapGunTutorialMode.Value == "Vanilla")) { tutorialCount = ScienceBirdTweaks.ZapGunTutorialCount.Value; __instance.setTutorialArrow = false; if (ScienceBirdTweaks.ZapGunTutorialMode.Value == "Only First Time" && ES3.Load("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; } [IteratorStateMachine(typeof(d__28))] private static IEnumerator ScanGunPatch(PatcherTool __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__28(0) { __instance = __instance }; } } } namespace ScienceBirdTweaks.Scripts { public class AutoTeleportScript : NetworkBehaviour { [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int player; public AutoTeleportScript <>4__this; private PlayerControllerB 5__1; private bool 5__2; private GrabbableObject 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.doingRoutine = true; <>4__this.currentPlayer = player; 5__1 = StartOfRound.Instance.allPlayerScripts[player]; teleporter.teleporterAnimator.SetTrigger("useTeleporter"); teleporter.shipTeleporterAudio.PlayOneShot(teleporter.teleporterSpinSFX); if ((Object)(object)5__1 == (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Targeted player is null"); return false; } if ((Object)(object)5__1.deadBody != (Object)null) { if ((Object)(object)5__1.deadBody.beamUpParticle == (Object)null) { return false; } 5__1.deadBody.beamUpParticle.Play(); 5__1.deadBody.bodyAudio.PlayOneShot(teleporter.beamUpPlayerBodySFX); } <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = false; if ((Object)(object)5__1.deadBody != (Object)null && ((Object)(object)5__1.deadBody.grabBodyObject == (Object)null || !5__1.deadBody.grabBodyObject.isHeldByEnemy)) { 5__2 = true; 5__1.deadBody.attachedTo = null; 5__1.deadBody.attachedLimb = null; 5__1.deadBody.secondaryAttachedLimb = null; 5__1.deadBody.secondaryAttachedTo = null; 5__1.deadBody.SetRagdollPositionSafely(teleporter.teleporterPosition.position, true); ((Component)5__1.deadBody).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); if ((Object)(object)5__1.deadBody.grabBodyObject != (Object)null) { 5__3 = 5__1.deadBody.grabBodyObject; RoundManager instance = RoundManager.Instance; instance.scrapCollectedInLevel += 5__3.scrapValue; RoundManager.Instance.CollectNewScrapForThisRound(5__3); 5__3.OnBroughtToShip(); StartOfRound instance2 = StartOfRound.Instance; instance2.currentShipItemCount++; if (5__3.isHeld && (Object)(object)5__3.playerHeldBy != (Object)null) { 5__3.playerHeldBy.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } 5__3 = null; } } teleporter.SetPlayerTeleporterId(5__1, -1); if (5__2) { teleporter.shipTeleporterAudio.PlayOneShot(teleporter.teleporterBeamUpSFX); if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } if ((Object)(object)5__1.deadBody == (Object)null && 5__1.isPlayerDead) { <>4__this.DisplayCustomScrapBox(); } <>4__this.doingRoutine = false; <>4__this.currentPlayer = -1; <>4__this.AfterTeleport(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__5 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int player; public AutoTeleportScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy == (Object)null || !((Behaviour)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy).isActiveAndEnabled) { <>4__this.PlaySFXClientRpc(); } else { ScienceBirdTweaks.Logger.LogDebug((object)"Found enemy!"); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int player; public AutoTeleportScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy == (Object)null || !((Behaviour)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy).isActiveAndEnabled) { <>4__this.DoTeleportRoutineClientRpc(player); } else { ScienceBirdTweaks.Logger.LogDebug((object)"Found enemy!"); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool doingRoutine = false; public static ShipTeleporter teleporter; public int currentPlayer = -1; public List playerQueue = new List(); public void StartSFXRoutine(int player) { if (((NetworkBehaviour)this).IsServer && ((Object)(object)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy == (Object)null || !((Behaviour)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy).isActiveAndEnabled)) { ((MonoBehaviour)this).StartCoroutine(WaitBeforeSFX(player)); } } [IteratorStateMachine(typeof(d__5))] private IEnumerator WaitBeforeSFX(int player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this, player = player }; } [ClientRpc] public void PlaySFXClientRpc() { //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) //IL_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3232941009u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3232941009u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead) { HUDManager.Instance.UIAudio.PlayOneShot(PlayerDeathPatches.globalDeathSFX, 0.45f); } if (ScienceBirdTweaks.FancyPanel.Value && (Object)(object)ButtonPanelController.Instance != (Object)null) { ButtonPanelController.Instance.BlueLight2Set(on: true); ButtonPanelController.Instance.SetLightAfterDelay(1, 1f, on: false); } } } public void StartTeleportRoutine(ShipTeleporter shipTeleporter, int player) { teleporter = shipTeleporter; if (!((NetworkBehaviour)this).IsServer) { return; } if (!doingRoutine) { if ((Object)(object)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy == (Object)null || !((Behaviour)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy).isActiveAndEnabled) { ((MonoBehaviour)this).StartCoroutine(WaitBeforeTeleport(player)); } } else if (currentPlayer != -1 && player != currentPlayer && !playerQueue.Contains(player)) { playerQueue.Add(player); } } [IteratorStateMachine(typeof(d__8))] private IEnumerator WaitBeforeTeleport(int player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this, player = player }; } [ClientRpc] public void DoTeleportRoutineClientRpc(int player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(502574612u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, player); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 502574612u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)teleporter == (Object)null) { ShipTeleporter[] array = (from x in Object.FindObjectsOfType() where !x.isInverseTeleporter select x).ToArray(); if (array.Length != 0) { teleporter = array.First(); } } ((MonoBehaviour)this).StartCoroutine(TeleportBodyToShip(player)); } private void AfterTeleport() { if (((NetworkBehaviour)this).IsServer && playerQueue.Count > 0) { int num = playerQueue.Last(); StartTeleportRoutine(teleporter, num); playerQueue.Remove(num); } } [IteratorStateMachine(typeof(d__11))] private IEnumerator TeleportBodyToShip(int player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this, player = player }; } public void DisplayBoxAfterCheck(int player) { if (((NetworkBehaviour)this).IsServer && ((Object)(object)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy == (Object)null || !((Behaviour)StartOfRound.Instance.allPlayerScripts[player].redirectToEnemy).isActiveAndEnabled)) { DisplayCustomScrapBoxClientRpc(); } } [ClientRpc] public void DisplayCustomScrapBoxClientRpc() { //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) //IL_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1972978940u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1972978940u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; DisplayCustomScrapBox(); } } } public void DisplayCustomScrapBox() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) HUDManager instance = HUDManager.Instance; instance.UIAudio.PlayOneShot(PlayerDeathPatches.HUDWarning, 0.5f); GameObject val = Object.Instantiate(PlayerDeathPatches.questionMark, instance.ScrapItemBoxes[instance.nextBoxIndex].itemObjectContainer); val.transform.localPosition = new Vector3(0f, 0f, -1f); val.transform.localScale = val.transform.localScale * 3.5f; val.transform.rotation = Quaternion.Euler(-90f, 0f, 0f); Renderer[] componentsInChildren = val.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if (((Component)componentsInChildren[i]).gameObject.layer != 22) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; componentsInChildren[i].rendererPriority = 70; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = instance.hologramMaterial; } componentsInChildren[i].sharedMaterials = sharedMaterials; ((Component)componentsInChildren[i]).gameObject.layer = 5; } } instance.ScrapItemBoxes[instance.nextBoxIndex].itemDisplayAnimator.SetTrigger("collect"); ((TMP_Text)instance.ScrapItemBoxes[instance.nextBoxIndex].headerText).text = "Body unrecoverable!"; ((TMP_Text)instance.ScrapItemBoxes[instance.nextBoxIndex].valueText).text = ""; if (instance.boxesDisplaying > 0) { instance.ScrapItemBoxes[instance.nextBoxIndex].UIContainer.anchoredPosition = new Vector2(instance.ScrapItemBoxes[instance.nextBoxIndex].UIContainer.anchoredPosition.x, instance.ScrapItemBoxes[instance.bottomBoxIndex].UIContainer.anchoredPosition.y - 124f); } else { instance.ScrapItemBoxes[instance.nextBoxIndex].UIContainer.anchoredPosition = new Vector2(instance.ScrapItemBoxes[instance.nextBoxIndex].UIContainer.anchoredPosition.x, (float)instance.bottomBoxYPosition); } instance.bottomBoxIndex = instance.nextBoxIndex; ((MonoBehaviour)this).StartCoroutine(instance.displayScrapTimer(val)); instance.playScrapDisplaySFX(); instance.boxesDisplaying++; instance.nextBoxIndex = (instance.nextBoxIndex + 1) % 3; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3232941009u, new RpcReceiveHandler(__rpc_handler_3232941009), "PlaySFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(502574612u, new RpcReceiveHandler(__rpc_handler_502574612), "DoTeleportRoutineClientRpc"); ((NetworkBehaviour)this).__registerRpc(1972978940u, new RpcReceiveHandler(__rpc_handler_1972978940), "DisplayCustomScrapBoxClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3232941009(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; ((AutoTeleportScript)(object)target).PlaySFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_502574612(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int player = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref player); target.__rpc_exec_stage = (__RpcExecStage)1; ((AutoTeleportScript)(object)target).DoTeleportRoutineClientRpc(player); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1972978940(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; ((AutoTeleportScript)(object)target).DisplayCustomScrapBoxClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "AutoTeleportScript"; } } public class ButtonPanelController : NetworkBehaviour { [CompilerGenerated] private sealed class d__48 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int light; public float time; public bool on; public ButtonPanelController <>4__this; private int <>s__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; case 1: { <>1__state = -1; int num = light; <>s__1 = num; switch (<>s__1) { case 0: <>4__this.BlueLight1Set(on); break; case 1: <>4__this.BlueLight2Set(on); break; case 2: <>4__this.GreenLight1Set(on); break; case 3: <>4__this.GreenLight2Set(on); break; case 4: <>4__this.GreenLight3Set(on); break; case 5: <>4__this.OrangeRoundSet(on); break; case 6: <>4__this.OrangeTallSet(on); break; case 7: <>4__this.RedLightSet(on); break; } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Animator panelAnimator; public InteractTrigger redButton1; public InteractTrigger redButton2; public InteractTrigger blackButton1; public InteractTrigger blackButton2; public InteractTrigger smallGreenButton; public InteractTrigger smallRedButton; public InteractTrigger knob1; public InteractTrigger knob2; public InteractTrigger knob3; public InteractTrigger smallKnob; public static ShipFloodlightController floodlightController; public ShipFloodlightInteractionHandler floodlightInteractHandler; public string redStr1; public string redStr2; public string blackStr1; public string blackStr2; public string smallRedStr; public string smallGreenStr; public string knobStr1; public string knobStr2; public string knobStr3; public string smallKnobStr; public AudioClip knobTurnSFX; private int knob1State; private int knob2State; private int knob3State; private int smallKnobState; private bool smallRedState = false; private bool smallGreenState = false; public bool fancyPanel = false; public bool floodlight = false; public bool floodlightExtra = false; public bool floodlightTarget = false; private bool sendingRPC; public static ButtonPanelController Instance { get; set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)Instance).gameObject); } } private void Start() { fancyPanel = ScienceBirdTweaks.FancyPanel.Value; floodlight = ScienceBirdTweaks.FloodlightRotation.Value; floodlightExtra = ScienceBirdTweaks.FloodlightExtraControls.Value; floodlightTarget = ScienceBirdTweaks.FloodlightPlayerFollow.Value; if (floodlight) { floodlightController = Object.FindObjectOfType(); } if (fancyPanel) { SetupStrings(); SetupLights(); } if (!floodlight) { return; } SetupLights("floodlight"); if (!floodlightExtra) { return; } SetupLights("floodlightExtra"); if (!floodlightTarget) { blackButton2.hoverTip = ""; if (!fancyPanel) { blackButton2.interactable = false; } } } public void SetupStrings() { redStr1 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Red1Tip.Value) ? "" : (ScienceBirdTweaks.Red1Tip.Value + " : [LMB]")); redStr2 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Red2Tip.Value) ? "" : (ScienceBirdTweaks.Red2Tip.Value + " : [LMB]")); blackStr1 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Black1Tip.Value) ? "" : (ScienceBirdTweaks.Black1Tip.Value + " : [LMB]")); blackStr2 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Black2Tip.Value) ? "" : (ScienceBirdTweaks.Black2Tip.Value + " : [LMB]")); smallRedStr = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.SmallRedTip.Value) ? "" : (ScienceBirdTweaks.SmallRedTip.Value + " : [LMB]")); smallGreenStr = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.SmallGreenTip.Value) ? "" : (ScienceBirdTweaks.SmallGreenTip.Value + " : [LMB]")); knobStr1 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Knob1Tip.Value) ? "" : (ScienceBirdTweaks.Knob1Tip.Value + " : [LMB]")); knobStr2 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Knob2Tip.Value) ? "" : (ScienceBirdTweaks.Knob2Tip.Value + " : [LMB]")); knobStr3 = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.Knob3Tip.Value) ? "" : (ScienceBirdTweaks.Knob3Tip.Value + " : [LMB]")); smallKnobStr = (Utility.IsNullOrWhiteSpace(ScienceBirdTweaks.SmallKnobTip.Value) ? "" : (ScienceBirdTweaks.SmallKnobTip.Value + " : [LMB]")); } public void SetupLights(string mode = "all") { switch (mode) { case "all": redButton1.interactable = true; redButton1.hoverTip = redStr1; redButton2.interactable = true; redButton2.hoverTip = redStr2; blackButton1.interactable = true; blackButton1.hoverTip = blackStr1; blackButton2.interactable = true; blackButton2.hoverTip = blackStr2; smallGreenButton.interactable = true; smallGreenButton.hoverTip = smallGreenStr; smallRedButton.interactable = true; smallRedButton.hoverTip = smallRedStr; knob1.interactable = true; knob1.hoverTip = knobStr1; knob2.interactable = true; knob2.hoverTip = knobStr2; knob3.interactable = true; knob3.hoverTip = knobStr3; smallKnob.interactable = true; smallKnob.hoverTip = smallKnobStr; break; case "floodlight": redButton1.interactable = true; redButton1.hoverTip = "Toggle light rotation : [LMB]"; break; case "floodlightExtra": blackButton1.interactable = true; blackButton1.hoverTip = "Reset light rotation : [LMB]"; blackButton2.interactable = true; blackButton2.hoverTip = "Toggle player targeting : [LMB]"; knob1.interactable = true; knob1.hoverTip = "Rotation speed (1.0x) : [LMB]"; SetKnob1(2); break; } } [ServerRpc(RequireOwnership = false)] public void PanelAnimationServerRpc(int num, int player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) 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(100301815u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, num); BytePacker.WriteValueBitPacked(val2, player); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 100301815u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PanelAnimationClientRpc(num, player); } } } [ClientRpc] public void PanelAnimationClientRpc(int num, int player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(389280784u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, num); BytePacker.WriteValueBitPacked(val2, player); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 389280784u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (sendingRPC) { sendingRPC = false; } else { PanelAnimation(num, player); } } } public void PanelAnimationLocal(int num) { sendingRPC = true; PanelAnimation(num, (int)GameNetworkManager.Instance.localPlayerController.playerClientId); PanelAnimationServerRpc(num, (int)GameNetworkManager.Instance.localPlayerController.playerClientId); } public void PanelAnimation(int num, int player) { if (floodlight && (num == 0 || (num == 1 && floodlightExtra) || (num == 3 && floodlightExtra && floodlightTarget) || (num == 4 && floodlightExtra)) && (Object)(object)floodlightController == (Object)null) { floodlightController = Object.FindObjectOfType(); if ((Object)(object)floodlightController == (Object)null) { ShipFloodlightsPatch.AddSpinnerComponentPatch(StartOfRound.Instance); } if ((Object)(object)floodlightController == (Object)null) { return; } } switch (num) { case 0: if (floodlight) { floodlightInteractHandler.ToggleSpinning(); break; } GreenLightSet(!panelAnimator.GetBool("GreenOn")); Red1Func(player, panelAnimator.GetBool("GreenOn")); break; case 1: if (floodlight && floodlightExtra) { floodlightController.ResetRotation(); } else { Black1Func(player); } break; case 2: Red2Func(player); break; case 3: if (floodlight && floodlightExtra && floodlightTarget) { floodlightController.SetTargeting(); break; } BlueLightSet(!panelAnimator.GetBool("BlueOn")); Black2Func(player, panelAnimator.GetBool("BlueOn")); break; case 4: TurnKnob1(); if (floodlight && floodlightExtra) { floodlightController.SetRotationSpeed(-1f, knob1State); } else { Knob1Func(player, knob1State); } break; case 5: TurnKnob2(); Knob2Func(player, knob2State); break; case 6: TurnKnob3(); Knob3Func(player, knob3State); break; case 7: TurnSmallKnob(); SmallKnobFunc(player, smallKnobState); break; case 8: SmallRedLightSet(!panelAnimator.GetBool("SmallRedOn")); SmallRedFunc(player, panelAnimator.GetBool("SmallRedOn")); break; case 9: SmallGreenLightSet(!panelAnimator.GetBool("SmallGreenOn")); SmallGreenFunc(player, panelAnimator.GetBool("SmallGreenOn")); break; } } public void SetLightAfterDelay(int light, float time, bool on) { ((MonoBehaviour)this).StartCoroutine(LightDelay(light, time, on)); } [IteratorStateMachine(typeof(d__48))] private IEnumerator LightDelay(int light, float time, bool on) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__48(0) { <>4__this = this, light = light, time = time, on = on }; } private void PlayKnobSFX(int knob) { switch (knob) { case 0: ((Component)knob1).gameObject.GetComponent().PlayOneShot(knobTurnSFX); break; case 1: ((Component)knob2).gameObject.GetComponent().PlayOneShot(knobTurnSFX); break; case 2: ((Component)knob3).gameObject.GetComponent().PlayOneShot(knobTurnSFX); break; case 3: ((Component)smallKnob).gameObject.GetComponent().PlayOneShot(knobTurnSFX); break; } } public void BlueLightSet(bool on) { panelAnimator.SetBool("BlueOn", on); } public void GreenLightSet(bool on) { panelAnimator.SetBool("GreenOn", on); } public void RedLightSet(bool on) { panelAnimator.SetBool("BaseRedOn", on); } public void BlueLight1Set(bool on) { panelAnimator.SetBool("BaseBlue1On", on); } public void BlueLight2Set(bool on) { panelAnimator.SetBool("BaseBlue2On", on); } public void GreenLight1Set(bool on) { panelAnimator.SetBool("BaseGreen1On", on); } public void GreenLight2Set(bool on) { panelAnimator.SetBool("BaseGreen2On", on); } public void GreenLight3Set(bool on) { panelAnimator.SetBool("BaseGreen3On", on); } public void OrangeRoundSet(bool on) { panelAnimator.SetBool("BaseOrangeRoundOn", on); } public void OrangeTallSet(bool on) { panelAnimator.SetBool("BaseOrangeTallOn", on); } public void SmallGreenLightSet(bool on) { panelAnimator.SetBool("SmallGreenOn", on); } public void SmallRedLightSet(bool on) { panelAnimator.SetBool("SmallRedOn", on); } public void Knob1Tip(string tip) { knob1.hoverTip = tip; } public void TurnKnob1() { knob1State++; knob1State %= 8; panelAnimator.SetInteger("KnobA", knob1State); PlayKnobSFX(0); } public void SetKnob1(int state) { knob1State = state; knob1State %= 8; panelAnimator.SetInteger("KnobA", knob1State); PlayKnobSFX(0); } public void Knob2Tip(string tip) { knob2.hoverTip = tip; } public void TurnKnob2() { knob2State++; knob2State %= 8; panelAnimator.SetInteger("KnobB", knob2State); PlayKnobSFX(1); } public void SetKnob2(int state) { knob2State = state; knob2State %= 8; panelAnimator.SetInteger("KnobB", knob2State); PlayKnobSFX(1); } public void Knob3Tip(string tip) { knob3.hoverTip = tip; } public void TurnKnob3() { knob3State++; knob3State %= 8; panelAnimator.SetInteger("KnobC", knob3State); PlayKnobSFX(2); } public void SetKnob3(int state) { knob3State = state; knob3State %= 8; panelAnimator.SetInteger("KnobC", knob3State); PlayKnobSFX(2); } public void SmallKnobTip(string tip) { smallKnob.hoverTip = tip; } public void TurnSmallKnob() { smallKnobState++; smallKnobState %= 8; panelAnimator.SetInteger("SmallKnob", smallKnobState); PlayKnobSFX(3); } public void SetSmallKnob(int state) { smallKnobState = state; smallKnobState %= 8; panelAnimator.SetInteger("SmallKnob", smallKnobState); PlayKnobSFX(3); } public void Knob1Func(int player, int state) { } public void Knob2Func(int player, int state) { } public void Knob3Func(int player, int state) { } public void SmallKnobFunc(int player, int state) { } public void Red1Func(int player, bool on) { } public void Red2Func(int player) { } public void Black1Func(int player) { } public void Black2Func(int player, bool on) { } public void SmallRedFunc(int player, bool on) { } public void SmallGreenFunc(int player, bool on) { } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(100301815u, new RpcReceiveHandler(__rpc_handler_100301815), "PanelAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(389280784u, new RpcReceiveHandler(__rpc_handler_389280784), "PanelAnimationClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_100301815(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int player = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref player); target.__rpc_exec_stage = (__RpcExecStage)1; ((ButtonPanelController)(object)target).PanelAnimationServerRpc(num, player); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_389280784(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int player = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref player); target.__rpc_exec_stage = (__RpcExecStage)1; ((ButtonPanelController)(object)target).PanelAnimationClientRpc(num, player); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ButtonPanelController"; } } 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_0135: 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 != 1 && (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(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(uniqueName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref hidden, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 224630158u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; 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(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(224630158u, new RpcReceiveHandler(__rpc_handler_224630158), "CheckUnlocksClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } 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 invalid IL or missing references) //IL_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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(ref flag, default(ForPrimitives)); string uniqueName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref uniqueName, false); } bool hidden = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hidden, default(ForPrimitives)); bool locked = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref locked, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LLLUnlockSync)(object)target).CheckUnlocksClientRpc(uniqueName, hidden, locked); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LLLUnlockSync"; } } public class MaskDropScript : NetworkBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass4_0 { public GameObject mask; internal bool b__0(MaskInstance x) { return (Object)(object)x.wornMask == (Object)(object)mask; } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject prefab; public GameObject mask; public MaskDropScript <>4__this; private <>c__DisplayClass4_0 <>8__1; private MaskInstance 5__2; private GameObject 5__3; private GrabbableObject 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass4_0(); <>8__1.mask = mask; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = activeMasks.Find((MaskInstance x) => (Object)(object)x.wornMask == (Object)(object)<>8__1.mask); if (5__2 != null) { 5__2.UpdateTransform(); } if (!((Object)(object)prefab != (Object)null) || 5__2 == null) { break; } 5__3 = Object.Instantiate(prefab, 5__2.position, 5__2.rotation, RoundManager.Instance.spawnedScrapContainer); 5__3.GetComponent().Spawn(false); 5__4 = 5__3.GetComponent(); <>4__this.doneRPC = false; <>4__this.SyncMaskValuesClientRpc(activeMasks.IndexOf(5__2), (int)((Component)5__4).GetComponent().NetworkObjectId, Mathf.RoundToInt(Random.Range(0.85f, 1.15f) * (float)ScienceBirdTweaks.MaskScrapValue.Value)); goto IL_0190; case 2: { <>1__state = -1; goto IL_0190; } IL_0190: if (!<>4__this.doneRPC) { <>2__current = null; <>1__state = 2; return true; } MaskDropPatches.MaskDropSync(5__3.GetComponent(), (int)((Component)5__4).GetComponent().NetworkObjectId, 5__2.position, 5__2.rotation, 5__2.value); 5__4.DiscardItemRpc(); 5__3 = null; 5__4 = null; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public bool doneRPC = false; public static List activeMasks = new List(); public void PrepareMaskDropCoroutine(GameObject? prefab, GameObject mask) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) GameObject mask2 = mask; if (!activeMasks.Any((MaskInstance x) => x.position == mask2.transform.position)) { activeMasks.Add(new MaskInstance(mask2, mask2.transform.position, mask2.transform.rotation)); ((MonoBehaviour)this).StartCoroutine(SpawnMaskAfterAnim(prefab, mask2)); } } [ClientRpc] private void SyncMaskValuesClientRpc(int activeMaskIndex, int maskId, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3160590867u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, activeMaskIndex); BytePacker.WriteValueBitPacked(val2, maskId); BytePacker.WriteValueBitPacked(val2, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3160590867u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (activeMaskIndex >= activeMasks.Count) { ScienceBirdTweaks.Logger.LogWarning((object)"Failed to find mask on this client! Expect a de-synced item and please report this issue."); doneRPC = true; return; } ScienceBirdTweaks.Logger.LogDebug((object)$"Registering mask in clientRPC: {activeMaskIndex}, {maskId}, {value}"); MaskInstance maskInstance = activeMasks[activeMaskIndex]; maskInstance.id = maskId; maskInstance.value = value; maskInstance.UpdateTransform(); maskInstance.AddToBufferAndDestroy(); activeMasks.RemoveAt(activeMaskIndex); MaskDropPatches.patchingMask = true; doneRPC = true; } } [IteratorStateMachine(typeof(d__4))] public IEnumerator SpawnMaskAfterAnim(GameObject? prefab, GameObject mask) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { <>4__this = this, prefab = prefab, mask = mask }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3160590867u, new RpcReceiveHandler(__rpc_handler_3160590867), "SyncMaskValuesClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3160590867(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int activeMaskIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref activeMaskIndex); int maskId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref maskId); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((MaskDropScript)(object)target).SyncMaskValuesClientRpc(activeMaskIndex, maskId, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MaskDropScript"; } } public class MaskInstance { public GameObject wornMask; public Vector3 position; public Quaternion rotation; public int id; public int value = ScienceBirdTweaks.MaskScrapValue.Value; public MaskInstance(GameObject headMask, Vector3 targetPos, Quaternion targetRot, int networkId = -1) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) wornMask = headMask; position = targetPos; rotation = targetRot; id = networkId; } public void UpdateTransform() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)wornMask != (Object)null) { position = wornMask.transform.position; rotation = wornMask.transform.rotation; } } public void AddToBufferAndDestroy() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ScienceBirdTweaks.Logger.LogDebug((object)"Adding mask to buffer!"); if (id == -1) { return; } MaskDropPatches.maskBuffer.Add(id, (position, rotation, value)); if ((Object)(object)wornMask != (Object)null) { if (((Object)wornMask).name == "HeadOni") { Object.Destroy((Object)(object)wornMask); } else { Object.Destroy((Object)(object)((Component)wornMask.transform.parent).gameObject); } } } } public class MineAudio : MonoBehaviour { public AudioClip beepClip; public AudioSource audioSource; public void PlayBeepAudio() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) audioSource.clip = beepClip; audioSource.Play(); WalkieTalkie.TransmitOneShotAudio(audioSource, beepClip, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.65f, 0, false, 546); } } public class NullItemScript : NetworkBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference netObjectRef; public int scrapValue; public Vector3 position; public Vector3 fallPosition; public Vector3 floorPosition; public bool usedUp; public Quaternion rotation; public bool inShip; public bool inElev; public bool inFactory; public bool nullParent; public NullItemScript <>4__this; private NetworkObject 5__1; private float 5__2; private GrabbableObject 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; 5__2 = Time.realtimeSinceStartup; goto IL_0064; case 1: <>1__state = -1; goto IL_0064; case 2: { <>1__state = -1; 5__3 = ((Component)5__1).GetComponent(); if (nullParent) { ((Component)5__3).gameObject.transform.SetParent((Transform)null, false); } else if ((Object)(object)((Component)5__3).gameObject.transform.parent == (Object)null) { ((Component)5__3).gameObject.transform.SetParent(StartOfRound.Instance.elevatorTransform, false); } ((Component)5__3).transform.position = position; ((Component)5__3).transform.rotation = rotation; BridgePatches.SetGrabbableFall(5__3); 5__3.itemUsedUp = usedUp; if (scrapValue >= 0 && 5__3.itemProperties.isScrap) { 5__3.SetScrapValue(scrapValue); } 5__3.isInShipRoom = inShip; 5__3.isInElevator = inElev; 5__3.isInFactory = inFactory; return false; } IL_0064: if (Time.realtimeSinceStartup - 5__2 < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref 5__1, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } if ((Object)(object)5__1 == (Object)null) { ScienceBirdTweaks.Logger.LogError((object)"Failed to recieve replacement object on client!"); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool doFix; public Dictionary activeObjects = new Dictionary(); public static NullItemScript Instance { get; set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)Instance).gameObject); } } [ClientRpc] public void SpawnReplacementObjectClientRpc(NetworkObjectReference netObjectRef, int scrapValue, Vector3 position, Vector3 fallPosition, Vector3 floorPosition, bool usedUp, Quaternion rotation, bool inShip, bool inElev, bool inFactory, bool nullParent = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3741618776u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netObjectRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref fallPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref floorPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref usedUp, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inShip, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inElev, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inFactory, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref nullParent, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3741618776u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForSpawn(netObjectRef, scrapValue, position, fallPosition, floorPosition, usedUp, rotation, inShip, inElev, inFactory, nullParent)); } } } [IteratorStateMachine(typeof(d__8))] private IEnumerator WaitForSpawn(NetworkObjectReference netObjectRef, int scrapValue, Vector3 position, Vector3 fallPosition, Vector3 floorPosition, bool usedUp, Quaternion rotation, bool inShip, bool inElev, bool inFactory, bool nullParent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this, netObjectRef = netObjectRef, scrapValue = scrapValue, position = position, fallPosition = fallPosition, floorPosition = floorPosition, usedUp = usedUp, rotation = rotation, inShip = inShip, inElev = inElev, inFactory = inFactory, nullParent = nullParent }; } [ServerRpc(RequireOwnership = false)] public void RequestReplacementObjectServerRpc(NetworkObjectReference netObjectRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4266673155u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netObjectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4266673155u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val3, (NetworkManager)null)) { return; } GrabbableObject component = ((Component)val3).GetComponent(); string name = Regex.Replace(((Object)((Component)component).gameObject).name, "\\(Clone\\)$", ""); Item[] array = (from x in Resources.FindObjectsOfTypeAll() where (Object)(object)x.spawnPrefab != (Object)null && ((Object)x.spawnPrefab).name == name && x.spawnPrefab.GetComponent().PrefabIdHash != 0 select x).ToArray(); if (array != null && array.Length != 0) { Item val4 = array.First(); GameObject val5 = Object.Instantiate(val4.spawnPrefab, ((Component)component).transform.position, Quaternion.identity); GrabbableObject component2 = val5.GetComponent(); component2.itemUsedUp = component.itemUsedUp; int num = -1; if (component2.itemProperties.isScrap) { num = component.scrapValue; component2.SetScrapValue(num); } component2.isInShipRoom = component.isInShipRoom; component2.isInElevator = component.isInElevator; component2.isInFactory = component.isInFactory; ((Component)component2).gameObject.GetComponent().Spawn(false); ((Component)component2).gameObject.transform.SetParent((Transform)null, true); Transform transform = ((Component)component2).transform; transform.position += Vector3.up * 0.5f; SetItemValsClientRpc(NetworkObjectReference.op_Implicit(((Component)component2).gameObject.GetComponent()), component2.scrapValue, component2.itemUsedUp, component2.isInShipRoom, component2.isInElevator, component2.isInFactory); ((NetworkBehaviour)component).NetworkObject.Despawn(true); NullItemPatches.triggered = false; } } [ClientRpc] public void SetItemValsClientRpc(NetworkObjectReference netObjectRef, int scrapValue, bool usedUp, bool inShip, bool inElev, bool inFactory) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(989745787u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netObjectRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref usedUp, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inShip, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inElev, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 989745787u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val3, (NetworkManager)null)) { GrabbableObject component = ((Component)val3).GetComponent(); component.SetScrapValue(scrapValue); component.itemUsedUp = usedUp; component.isInShipRoom = inShip; component.isInElevator = inElev; component.isInFactory = inFactory; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3741618776u, new RpcReceiveHandler(__rpc_handler_3741618776), "SpawnReplacementObjectClientRpc"); ((NetworkBehaviour)this).__registerRpc(4266673155u, new RpcReceiveHandler(__rpc_handler_4266673155), "RequestReplacementObjectServerRpc"); ((NetworkBehaviour)this).__registerRpc(989745787u, new RpcReceiveHandler(__rpc_handler_989745787), "SetItemValsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3741618776(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c7: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjectRef, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Vector3 fallPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref fallPosition); Vector3 floorPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref floorPosition); bool usedUp = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref usedUp, default(ForPrimitives)); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); bool inShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inShip, default(ForPrimitives)); bool inElev = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inElev, default(ForPrimitives)); bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inFactory, default(ForPrimitives)); bool nullParent = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref nullParent, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NullItemScript)(object)target).SpawnReplacementObjectClientRpc(netObjectRef, scrapValue, position, fallPosition, floorPosition, usedUp, rotation, inShip, inElev, inFactory, nullParent); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4266673155(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjectRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NullItemScript)(object)target).RequestReplacementObjectServerRpc(netObjectRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_989745787(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjectRef, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); bool usedUp = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref usedUp, default(ForPrimitives)); bool inShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inShip, default(ForPrimitives)); bool inElev = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inElev, default(ForPrimitives)); bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inFactory, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NullItemScript)(object)target).SetItemValsClientRpc(netObjectRef, scrapValue, usedUp, inShip, inElev, inFactory); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NullItemScript"; } } public class ScanHighlight : MonoBehaviour { [CompilerGenerated] private sealed class d__7 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScanHighlight <>4__this; private Material[] 5__1; private Material[] 5__2; private int 5__3; private int 5__4; private Material[] 5__5; private int 5__6; private int 5__7; private Material[] 5__8; private int 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__5 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = (Material[])(object)new Material[5] { ScanHighlightPatches.greenHologramMat1, ScanHighlightPatches.greenHologramMat2, ScanHighlightPatches.greenHologramMat3, ScanHighlightPatches.greenHologramMat4, ScanHighlightPatches.greenHologramMat }; 5__2 = (Material[])(object)new Material[5] { ScanHighlightPatches.blueHologramMat1, ScanHighlightPatches.blueHologramMat2, ScanHighlightPatches.blueHologramMat3, ScanHighlightPatches.blueHologramMat4, ScanHighlightPatches.blueHologramMat }; 5__3 = 0; break; case 1: <>1__state = -1; 5__4 = 0; while (5__4 < <>4__this.renderers.Length) { if (((Component)<>4__this.renderers[5__4]).gameObject.layer != 22) { 5__5 = (Material[])(object)new Material[<>4__this.renderers[5__4].materials.Length]; 5__6 = 0; while (5__6 < 5__5.Length) { 5__5[5__6] = (<>4__this.blue ? 5__2[5__3] : 5__1[5__3]); 5__6++; } <>4__this.renderers[5__4].materials = 5__5; 5__5 = null; } 5__4++; } 5__7 = 0; while (5__7 < <>4__this.extraRenderers.Length) { if (((Component)<>4__this.extraRenderers[5__7]).gameObject.layer != 22) { 5__8 = (Material[])(object)new Material[<>4__this.extraRenderers[5__7].materials.Length]; 5__9 = 0; while (5__9 < 5__8.Length) { 5__8[5__9] = (<>4__this.blue ? 5__2[5__3] : 5__1[5__3]); 5__9++; } <>4__this.extraRenderers[5__7].materials = 5__8; 5__8 = null; } 5__7++; } 5__3++; break; } if (5__3 < 5) { <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Transform parentTransform; public Renderer[] renderers; public Renderer[] extraRenderers; public bool blue; public bool full = false; private void Start() { if (full) { ((MonoBehaviour)this).StartCoroutine(FadeIn()); } } public void LateUpdate() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = parentTransform.position; ((Component)this).transform.rotation = parentTransform.rotation; } [IteratorStateMachine(typeof(d__7))] public IEnumerator FadeIn() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this }; } } public class ShipFloodlightController : MonoBehaviour { private struct TransformState { public Vector3 localPosition; public Quaternion localRotation; } public float rotationSpeed = ScienceBirdTweaks.FloodLightRotationSpeed.Value; private const string ParentName = "ShipLightsPost"; private const string PivotChildName = "Cube.006"; private readonly List SiblingToRotate = new List { "Floodlight1", "Floodlight2" }; private Transform _parentTransform; private Transform _pivotTransform; private List _rotationList = new List(); private List _shipFloodlightLights = new List(); private StartOfRound _startOfRoundInstance; public bool _isRotating = false; private bool _initialized = false; private bool _initialStateSet = false; public bool _canRotate = false; private bool followPlayer = false; private Vector3 playerPos = Vector3.zero; private Vector3 enemyPos = Vector3.zero; private float timeSinceLastCheck = 0f; private const float refreshInterval = 1f; private bool awaitingSpin = false; private bool rotatingLastFrame = false; private float[] speedStates = new float[8] { 22.5f, 32.14f, 41.8f, 51.43f, 61.07f, 70.71f, 80.36f, 90f }; private string[] stateTips = new string[8] { "Rotation speed (0.5x) : [LMB]", "Rotation speed (0.7x) : [LMB]", "Rotation speed (1.0x) : [LMB]", "Rotation speed (1.15x) : [LMB]", "Rotation speed (1.35x) : [LMB]", "Rotation speed (1.55x) : [LMB]", "Rotation speed (1.8x) : [LMB]", "Rotation speed (2.0x) : [LMB]" }; private int speedState = 0; private bool stopNext = false; public bool RPCsent = false; public bool queueBlackout = false; private Dictionary _originalStates = new Dictionary(); public ShipFloodlightInteractionHandler interactionHandler; private void Start() { _startOfRoundInstance = ((Component)this).GetComponent(); if ((Object)(object)_startOfRoundInstance == (Object)null) { _startOfRoundInstance = StartOfRound.Instance; } if ((Object)(object)_startOfRoundInstance == (Object)null) { ScienceBirdTweaks.Logger.LogError((object)"Failed to get StartOfRound instance! Spinner cannot check landing status."); } else { ScienceBirdTweaks.Logger.LogDebug((object)"ShipFloodlightController Start: Got StartOfRound reference. Waiting for initialization and landing."); } _initialized = false; interactionHandler = Object.FindObjectOfType(); } private void Update() { //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) Quaternion val3; if (!_initialized) { if ((Object)(object)_parentTransform == (Object)null) { GameObject val = GameObject.Find("ShipLightsPost"); if (!((Object)(object)val != (Object)null)) { return; } _parentTransform = val.transform; ScienceBirdTweaks.Logger.LogDebug((object)("Found parent container: '" + ((Object)_parentTransform).name + "'.")); } if ((Object)(object)_pivotTransform == (Object)null) { _pivotTransform = _parentTransform.Find("Cube.006"); if (!((Object)(object)_pivotTransform != (Object)null)) { return; } ScienceBirdTweaks.Logger.LogDebug((object)("Found pivot child: '" + ((Object)_pivotTransform).name + "'.")); if (!_rotationList.Contains(_pivotTransform)) { _rotationList.Add(_pivotTransform); } } if (_rotationList.Count < 3) { foreach (string item in SiblingToRotate) { Transform val2 = _parentTransform.Find(item); if ((Object)(object)val2 != (Object)null) { _shipFloodlightLights.Add(((Component)val2).GetComponentInChildren(true)); _rotationList.Add(val2); ScienceBirdTweaks.Logger.LogDebug((object)("Found sibling: '" + ((Object)val2).name + "'.")); continue; } return; } } else { if (_rotationList.Count != 3) { return; } ScienceBirdTweaks.Logger.LogDebug((object)$"All objects found: {_rotationList.Count} objects."); _originalStates.Clear(); foreach (Transform rotation in _rotationList) { if ((Object)(object)rotation != (Object)null) { _originalStates[rotation] = new TransformState { localPosition = rotation.localPosition, localRotation = rotation.localRotation }; ManualLogSource logger = ScienceBirdTweaks.Logger; string name = ((Object)rotation).name; object arg = rotation.localPosition; val3 = rotation.localRotation; logger.LogDebug((object)$"Stored initial state for {name}: Pos={arg}, Rot={((Quaternion)(ref val3)).eulerAngles}"); } else { ScienceBirdTweaks.Logger.LogWarning((object)"Attempted to store initial rotation for a null transform in _rotationList."); } } if (ScienceBirdTweaks.FloodlightExtraControls.Value) { float value = ScienceBirdTweaks.FloodLightRotationSpeed.Value; for (int i = 0; i < speedStates.Length; i++) { speedStates[i] = value / 2f + (float)i * ((2f * value - value / 2f) / 7f); } SetRotationSpeed(speedStates[2]); speedState = 2; } _initialized = true; if (queueBlackout) { SetFloodlightData(ScienceBirdTweaks.BlackoutFloodLightIntensity.Value, ScienceBirdTweaks.BlackoutFloodLightAngle.Value, ScienceBirdTweaks.BlackoutFloodLightRange.Value); queueBlackout = false; } } } if (!_initialized || !ScienceBirdTweaks.FloodlightRotation.Value) { return; } bool flag = (Object)(object)_startOfRoundInstance != (Object)null && _startOfRoundInstance.shipHasLanded; if (flag != _canRotate && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer && !RPCsent) { if ((Object)(object)interactionHandler == (Object)null) { interactionHandler = Object.FindObjectOfType(); } if ((Object)(object)interactionHandler != (Object)null) { RPCsent = true; interactionHandler.LandingSyncClientRpc(flag); } } if ((Object)(object)_pivotTransform == (Object)null) { return; } Vector3 position = _pivotTransform.position; if (_canRotate) { if (_isRotating) { timeSinceLastCheck += Time.deltaTime; if (followPlayer && timeSinceLastCheck >= 1f) { playerPos = GetClosestPlayerPosition(_pivotTransform); timeSinceLastCheck = 0f; } if (followPlayer && playerPos != Vector3.zero) { stopNext = false; Vector3 val4 = playerPos - _pivotTransform.position; val4.y = 0f; float y = _pivotTransform.eulerAngles.y; val3 = Quaternion.LookRotation(val4); float num = ((Quaternion)(ref val3)).eulerAngles.y + 90f; float num2 = Mathf.MoveTowardsAngle(y, num, rotationSpeed * Time.deltaTime * 0.5f); float num3 = num2 - y; foreach (Transform rotation2 in _rotationList) { if ((Object)(object)rotation2 != (Object)null) { rotation2.RotateAround(position, Vector3.up, num3); } } } else { foreach (Transform rotation3 in _rotationList) { if ((Object)(object)rotation3 != (Object)null) { Vector3 up = Vector3.up; rotation3.RotateAround(position, ((Vector3)(ref up)).normalized, rotationSpeed * Time.deltaTime); } else { ScienceBirdTweaks.Logger.LogWarning((object)"Rotating sibling is null! Skipping rotation."); } } } if (stopNext) { float num4 = Mathf.Clamp(1f - rotationSpeed / 30f * 0.001f + 0.0005f, 0.99f, 0.9995f); bool flag2 = true; foreach (KeyValuePair originalState in _originalStates) { Transform key = originalState.Key; TransformState value2 = originalState.Value; if ((Object)(object)key != (Object)null && Mathf.Abs(Quaternion.Dot(key.localRotation, value2.localRotation)) < num4) { flag2 = false; break; } } if (flag2) { foreach (KeyValuePair originalState2 in _originalStates) { Transform key2 = originalState2.Key; TransformState value3 = originalState2.Value; if ((Object)(object)key2 != (Object)null) { key2.localPosition = value3.localPosition; key2.localRotation = value3.localRotation; } } StopSpinning(); } } rotatingLastFrame = true; } else if (awaitingSpin && !rotatingLastFrame) { StartSpinning(); } else { rotatingLastFrame = false; } } else { if (rotatingLastFrame || _isRotating) { StopSpinning(); } rotatingLastFrame = false; } } public void StartSpinning() { if (!_canRotate) { if (!_startOfRoundInstance.inShipPhase && !_startOfRoundInstance.shipIsLeaving && !_startOfRoundInstance.shipLeftAutomatically) { awaitingSpin = true; } return; } if ((Object)(object)ButtonPanelController.Instance != (Object)null) { ButtonPanelController.Instance.GreenLightSet(on: true); } _isRotating = true; if (!((Behaviour)this).enabled) { ((Behaviour)this).enabled = true; } } public void StopSpinning() { if ((Object)(object)ButtonPanelController.Instance != (Object)null) { ButtonPanelController.Instance.GreenLightSet(on: false); } stopNext = false; _isRotating = false; awaitingSpin = false; } public void SetRotationSpeed(float newSpeed = -1f, int state = -1) { if (newSpeed == -1f) { if (state == -1) { speedState++; } else { speedState = state; } speedState %= speedStates.Length; rotationSpeed = speedStates[speedState]; if ((Object)(object)ButtonPanelController.Instance != (Object)null) { ButtonPanelController.Instance.Knob1Tip(stateTips[speedState]); } } else { rotationSpeed = newSpeed; } } public void ResetRotation() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!_canRotate) { return; } stopNext = true; if (_isRotating) { return; } bool flag = false; foreach (KeyValuePair originalState in _originalStates) { Transform key = originalState.Key; TransformState value = originalState.Value; if ((Object)(object)key != (Object)null && (double)Mathf.Abs(Quaternion.Dot(key.localRotation, value.localRotation)) < 0.999) { flag = true; break; } } if (flag) { StartSpinning(); } else { stopNext = false; } } public void SetTargeting() { followPlayer = !followPlayer; if ((Object)(object)ButtonPanelController.Instance != (Object)null) { ButtonPanelController.Instance.BlueLightSet(followPlayer); } } public void SetFloodlightData(float intensity, float angle, float range) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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) float num = 1.7f * intensity / 2275.72f; float num2 = num * 12.05f; if (_shipFloodlightLights.Count > 0) { HDAdditionalLightData val = default(HDAdditionalLightData); Color val3 = default(Color); foreach (Light shipFloodlightLight in _shipFloodlightLights) { if (!((Object)(object)shipFloodlightLight == (Object)null)) { GameObject gameObject = ((Component)shipFloodlightLight).gameObject; gameObject.TryGetComponent(ref val); if ((Object)(object)val != (Object)null) { val.SetIntensity(intensity); val.SetSpotAngle(angle, 78.3f); val.SetRange(range); } Transform parent = ((Component)shipFloodlightLight).transform.parent; Renderer component = ((Component)parent).GetComponent(); if (!((Object)(object)component == (Object)null)) { Material[] materials = component.materials; Material[] array = materials; foreach (Material val2 in array) { if (!((Object)(object)val2 == (Object)null) && val2.IsKeywordEnabled("_EMISSIVE_COLOR_MAP")) { Color color = val2.GetColor(Shader.PropertyToID("_EmissiveColor")); ((Color)(ref val3))..ctor(9.026f * num, 8.695f * num, 7.75f * num, 12.05f * num); val2.SetFloat(Shader.PropertyToID("_EmissiveIntensity"), val3.a); val2.SetColor(Shader.PropertyToID("_EmissiveColor"), val3); } } component.materials = materials; } } } return; } ScienceBirdTweaks.Logger.LogWarning((object)"No floodlight lights found to set data."); queueBlackout = true; } public void ResetFloodlightLights() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) SetFloodlightData(ScienceBirdTweaks.FloodLightIntensity.Value, ScienceBirdTweaks.FloodLightAngle.Value, ScienceBirdTweaks.FloodLightRange.Value); awaitingSpin = false; if (ScienceBirdTweaks.FloodlightRotation.Value) { if (_originalStates.Count == 0) { ScienceBirdTweaks.Logger.LogWarning((object)"Original rotations not captured or dictionary empty. Cannot reset rotation state."); return; } ScienceBirdTweaks.Logger.LogDebug((object)$"Resetting floodlight rotation for : {_originalStates}"); foreach (KeyValuePair originalState in _originalStates) { Transform key = originalState.Key; TransformState value = originalState.Value; if ((Object)(object)key != (Object)null) { key.localPosition = value.localPosition; key.localRotation = value.localRotation; } else { ScienceBirdTweaks.Logger.LogWarning((object)"Attempted to reset rotation on a null transform (originally stored)."); } } ScienceBirdTweaks.Logger.LogDebug((object)"Floodlight rotation reset complete."); } else { ScienceBirdTweaks.Logger.LogDebug((object)"Floodlight rotation disabled in config, skipping rotation reset."); } } public static Vector3 GetClosestPlayerPosition(Transform _pivotTransform) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; Vector3 result = Vector3.zero; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && !val.isInHangarShipRoom) { float num2 = Vector3.Distance(_pivotTransform.position, ((Component)val).transform.position); if (num2 < num && num2 < 80f) { num = num2; result = ((Component)val).transform.position; } } } return result; } public static Vector3 GetClosestEnemyPosition(Transform _pivotTransform) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; Vector3 result = Vector3.zero; List list = new List(); list.Add("Manticoil"); list.Add("Roaming_Locust"); list.Add("Tulip_Snake"); EnemyAI[] array = Object.FindObjectsOfType(); foreach (EnemyAI val in array) { if ((Object)(object)val == (Object)null || val.isEnemyDead || !val.isOutside) { continue; } string enemyName = val.enemyType.enemyName; if (list.Contains(enemyName)) { float num2 = Vector3.Distance(_pivotTransform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = ((Component)val).transform.position; } } } return result; } } public class ShipFloodlightInteractionHandler : NetworkBehaviour { [CompilerGenerated] private sealed class d__5 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool rotate; public ShipFloodlightInteractionHandler <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (rotate) { <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } controller._canRotate = rotate; controller.RPCsent = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ShipFloodlightController controller; public ButtonPanelController panelController; private bool sendingRPC = false; public void Start() { if (ScienceBirdTweaks.FloodlightRotation.Value) { controller = Object.FindObjectOfType(); } } [ClientRpc] public void LandingSyncClientRpc(bool rotate) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4136962484u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotate, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4136962484u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)controller == (Object)null) { controller = Object.FindObjectOfType(); } if ((Object)(object)controller != (Object)null) { ((MonoBehaviour)this).StartCoroutine(LandingSyncWait(rotate)); } } } [IteratorStateMachine(typeof(d__5))] public IEnumerator LandingSyncWait(bool rotate) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this, rotate = rotate }; } public void ToggleSpinning() { if ((Object)(object)controller == (Object)null) { controller = Object.FindObjectOfType(); } if ((Object)(object)controller != (Object)null) { if (controller._isRotating) { controller.StopSpinning(); } else { controller.StartSpinning(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4136962484u, new RpcReceiveHandler(__rpc_handler_4136962484), "LandingSyncClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4136962484(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool rotate = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotate, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShipFloodlightInteractionHandler)(object)target).LandingSyncClientRpc(rotate); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ShipFloodlightInteractionHandler"; } } public class ShotgunScript : NetworkBehaviour { [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool doEject; public bool doAnimation; public ShotgunScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.shotgun.isReloading = true; if (doAnimation) { if (doEject && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && (Object)(object)((GrabbableObject)<>4__this.shotgun).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ChangeControlTip(2, "Hold to eject : [E]", false); } ((Renderer)<>4__this.shotgun.shotgunShellLeft).enabled = <>4__this.shotgun.shellsLoaded > 0; ((Renderer)<>4__this.shotgun.shotgunShellRight).enabled = <>4__this.shotgun.shellsLoaded > 1; ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", true); } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; if (doAnimation) { <>4__this.shotgun.gunAudio.PlayOneShot(ShotgunPatches.inspectSFX); <>4__this.shotgun.gunAnimator.SetBool("Reloading", true); } <>2__current = (object)new WaitForSeconds(0.45f); <>1__state = 2; return true; case 2: <>1__state = -1; if (doAnimation) { ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.speed = 0.2f; } <>2__current = (object)new WaitForSeconds(0.55f); <>1__state = 3; return true; case 3: <>1__state = -1; if (doEject && <>4__this.holdingDown && ShotgunPatches.HasValidHolder(<>4__this.shotgun) && ShotgunPatches.LocalPlayerNotInteracting(<>4__this.shotgun) && ShotgunPatches.AllowedToEject(<>4__this.shotgun)) { <>4__this.fill = 0f; <>4__this.holdingDown = false; <>4__this.sendingRPC2 = true; <>4__this.EjectShells(); <>4__this.EjectShellsServerRpc(); if (!doAnimation) { return false; } } <>2__current = (object)new WaitForSeconds(0.4f); <>1__state = 4; return true; case 4: <>1__state = -1; if (doAnimation) { ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.speed = 0.6f; ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false); <>4__this.shotgun.gunAnimator.SetBool("Reloading", false); } ShotgunTooltipPatches.TooltipUpdate(<>4__this.shotgun); <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 5; return true; case 5: <>1__state = -1; if (doAnimation) { ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.speed = 1f; } <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 6; return true; case 6: <>1__state = -1; if (doAnimation) { ((GrabbableObject)<>4__this.shotgun).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false); } <>4__this.shotgun.isReloading = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public ShotgunItem shotgun; public bool holdingDown = false; public float startTime; private bool sendingRPC1 = false; private bool sendingRPC2 = false; public float fill = 0f; public void Start() { shotgun = ((Component)this).gameObject.GetComponent(); } public void StartHolding(ShotgunItem shotgunItem, bool doEject, bool doAnimation) { if ((Object)(object)shotgun == (Object)null) { shotgun = shotgunItem; } if (ShotgunPatches.HasValidHolder(shotgun)) { holdingDown = doEject; startTime = Time.realtimeSinceStartup; sendingRPC1 = true; ((MonoBehaviour)this).StartCoroutine(OpenShotgunAnimation(doEject, doAnimation)); StartAnimationServerRpc(doEject, doAnimation); } } [ServerRpc(RequireOwnership = false)] public void StartAnimationServerRpc(bool doEject, bool doAnimation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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(2314955611u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref doEject, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref doAnimation, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2314955611u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; StartAnimationClientRpc(doEject, doAnimation); } } } [ClientRpc] public void StartAnimationClientRpc(bool doEject, bool doAnimation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2065007350u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref doEject, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref doAnimation, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2065007350u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (sendingRPC1) { sendingRPC1 = false; return; } fill = 0f; ((MonoBehaviour)this).StartCoroutine(OpenShotgunAnimation(doEject, doAnimation)); } } [IteratorStateMachine(typeof(d__10))] public IEnumerator OpenShotgunAnimation(bool doEject, bool doAnimation) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, doEject = doEject, doAnimation = doAnimation }; } public void Update() { if (!ShotgunPatches.unloadEnabled) { return; } if (fill > 0.1f) { HUDManager.Instance.holdInteractionCanvasGroup.alpha = Mathf.Lerp(HUDManager.Instance.holdInteractionCanvasGroup.alpha, 1f, 20f * Time.deltaTime); } if (!holdingDown || !ShotgunPatches.HasValidHolder(shotgun)) { return; } if (ShotgunPatches.LocalPlayerNotInteracting(shotgun)) { if (!IngamePlayerSettings.Instance.playerInput.actions.FindAction("ItemTertiaryUse", false).IsPressed()) { if (!ShotgunPatches.ammoCheck) { ((MonoBehaviour)this).StopAllCoroutines(); shotgun.isReloading = false; } fill = 0f; holdingDown = false; } else { fill += Time.deltaTime; HUDManager.Instance.holdInteractionFillAmount.fillAmount = fill / 1.3f; } } else { if (!ShotgunPatches.ammoCheck) { ((MonoBehaviour)this).StopAllCoroutines(); shotgun.isReloading = false; } fill = 0f; holdingDown = false; } } [ServerRpc(RequireOwnership = false)] public void EjectShellsServerRpc() { //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) //IL_00c1: 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(2521062680u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2521062680u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; EjectShellsClientRpc(); } } } [ClientRpc] public void EjectShellsClientRpc() { //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) //IL_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1156144586u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1156144586u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (sendingRPC2) { sendingRPC2 = false; } else { EjectShells(); } } } public void EjectShells() { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ShotgunMasterDisable.Value || !ShotgunPatches.HasValidHolder(shotgun)) { return; } ((Renderer)shotgun.shotgunShellLeft).enabled = false; ((Renderer)shotgun.shotgunShellRight).enabled = false; if (!ShotgunPatches.shellRegistered) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(ShotgunPatches.shellPrefab)) { NutcrackerEnemyAI val = Resources.FindObjectsOfTypeAll().First(); if ((Object)(object)val != (Object)null) { ShotgunPatches.shellPrefab = val.shotgunShellPrefab; ScienceBirdTweaks.Logger.LogDebug((object)"Re-finding shell prefab on interact..."); if (ShotgunPatches.shellPrefab.GetComponent().PrefabIdHash == 0) { ScienceBirdTweaks.Logger.LogError((object)"Shell not registered on interaction due to an incompatibility. To avoid client de-syncs, enable the 'force register shells' config option. Please report this issue!"); } } } else { ShotgunPatches.shellRegistered = true; } } if (((NetworkBehaviour)this).IsServer) { Transform val2 = ((((!((Object)(object)((GrabbableObject)shotgun).playerHeldBy != (Object)null) || !((GrabbableObject)shotgun).playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer); for (int i = 0; i < shotgun.shellsLoaded; i++) { GameObject val3 = Object.Instantiate(ShotgunPatches.shellPrefab, ((Component)((GrabbableObject)shotgun).playerHeldBy).transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 0.1f, Random.Range(-0.5f, 0.5f)), Quaternion.identity, val2); val3.GetComponent().Spawn(false); GrabbableObject component = ((Component)val3.GetComponent()).GetComponent(); component.startFallingPosition = val3.transform.position; component.fallTime = 0f; component.hasHitGround = false; component.reachedFloorTarget = false; if ((Object)(object)((GrabbableObject)shotgun).playerHeldBy != (Object)null && ((GrabbableObject)shotgun).playerHeldBy.isInHangarShipRoom) { ((GrabbableObject)shotgun).playerHeldBy.SetItemInElevator(true, true, component); } else { component.isInFactory = ((Component)shotgun).gameObject.GetComponent().isInFactory; } } } shotgun.shellsLoaded = 0; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2314955611u, new RpcReceiveHandler(__rpc_handler_2314955611), "StartAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(2065007350u, new RpcReceiveHandler(__rpc_handler_2065007350), "StartAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(2521062680u, new RpcReceiveHandler(__rpc_handler_2521062680), "EjectShellsServerRpc"); ((NetworkBehaviour)this).__registerRpc(1156144586u, new RpcReceiveHandler(__rpc_handler_1156144586), "EjectShellsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2314955611(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool doEject = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref doEject, default(ForPrimitives)); bool doAnimation = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref doAnimation, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShotgunScript)(object)target).StartAnimationServerRpc(doEject, doAnimation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2065007350(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool doEject = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref doEject, default(ForPrimitives)); bool doAnimation = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref doAnimation, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShotgunScript)(object)target).StartAnimationClientRpc(doEject, doAnimation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2521062680(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; ((ShotgunScript)(object)target).EjectShellsServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1156144586(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; ((ShotgunScript)(object)target).EjectShellsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ShotgunScript"; } } public class SSSDataRequest : NetworkBehaviour { public Dictionary storedDict = new Dictionary(); [ServerRpc(RequireOwnership = false)] public void CollectDataServerRpc() { //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) //IL_00c1: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2034854668u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2034854668u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; SmartCupboard val3 = Object.FindObjectOfType(); if (SmartMemory.Instance == null || !((Object)(object)val3 != (Object)null)) { return; } storedDict = new Dictionary(); ResetDictClientRpc(); List> itemList = SmartMemory.Instance.ItemList; foreach (List item in itemList) { foreach (Data item2 in item) { string[] array = item2.Id.Split("/"); if (array.Length > 1 && storedDict.TryAdd(array[1].ToLower(), item2.Quantity)) { ScienceBirdTweaks.Logger.LogDebug((object)$"SERVER: Added {item2.Quantity} {array[1].ToLower()} to dictionary!"); SendDataClientRpc(array[1].ToLower(), item2.Quantity); } } } } [ClientRpc] public void SendDataClientRpc(string name, int count) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1440360438u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } BytePacker.WriteValueBitPacked(val2, count); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1440360438u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { if (storedDict.TryAdd(name, count)) { ScienceBirdTweaks.Logger.LogDebug((object)$"CLIENT: Added {count} {name} to dictionary!"); } else { ScienceBirdTweaks.Logger.LogError((object)"Client failure to sync dictionary!"); } } } [ClientRpc] public void ResetDictClientRpc() { //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) //IL_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2438141191u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2438141191u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { storedDict = new Dictionary(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2034854668u, new RpcReceiveHandler(__rpc_handler_2034854668), "CollectDataServerRpc"); ((NetworkBehaviour)this).__registerRpc(1440360438u, new RpcReceiveHandler(__rpc_handler_1440360438), "SendDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(2438141191u, new RpcReceiveHandler(__rpc_handler_2438141191), "ResetDictClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2034854668(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; ((SSSDataRequest)(object)target).CollectDataServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1440360438(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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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(ref flag, default(ForPrimitives)); string name = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false); } int count = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref count); target.__rpc_exec_stage = (__RpcExecStage)1; ((SSSDataRequest)(object)target).SendDataClientRpc(name, count); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2438141191(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; ((SSSDataRequest)(object)target).ResetDictClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SSSDataRequest"; } } public static class CollectionExtensions { private static Random rng = new Random(); public static void Shuffle(this IList list) { int num = list.Count; while (num > 1) { num--; int index = rng.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public class TrueBlackout : MonoBehaviour { [CompilerGenerated] private sealed class d__21 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerable lightObjectsEnumerable; public TrueBlackout <>4__this; private List 5__1; private int 5__2; private int 5__3; private int 5__4; private WaitForEndOfFrame 5__5; private Color 5__6; private Material 5__7; private int 5__8; private GameObject 5__9; private Light[] <>s__10; private int <>s__11; private Light 5__12; private Renderer[] <>s__13; private int <>s__14; private Renderer 5__15; private Material[] 5__16; private bool 5__17; private int 5__18; private Material 5__19; private bool 5__20; private bool 5__21; private bool 5__22; private bool 5__23; private bool 5__24; private bool 5__25; private bool 5__26; private bool 5__27; private int 5__28; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__5 = null; 5__7 = null; 5__9 = null; <>s__10 = null; 5__12 = null; <>s__13 = null; 5__15 = null; 5__16 = null; 5__19 = null; <>1__state = -2; } private bool MoveNext() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0076: 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) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; 5__28++; goto IL_07ad; } <>1__state = -1; 5__1 = lightObjectsEnumerable.ToList(); 5__1.Shuffle(); 5__2 = 5; 5__3 = 0; 5__4 = 15; 5__5 = new WaitForEndOfFrame(); 5__6 = new Color(0f, 0f, 0f, 1f); 5__7 = new Material(Shader.Find("HDRP/Lit")); 5__7.color = Color.black; 5__7.SetFloat(surfaceTypeID, 0f); 5__7.DisableKeyword("_EMISSIVE_COLOR_MAP"); goto IL_07c2; IL_07ad: if (5__28 < 5__4) { <>2__current = 5__5; <>1__state = 1; return true; } goto IL_07c2; IL_07c2: if (5__3 < 5__1.Count) { 5__8 = 0; while (5__8 < 5__2 && 5__3 < 5__1.Count) { 5__9 = 5__1[5__3]; if (!((Object)(object)5__9 == (Object)null)) { <>s__10 = 5__9.GetComponentsInChildren(true); for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++) { 5__12 = <>s__10[<>s__11]; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Disabling light " + ((Object)5__12).name + " with path " + GetObjectPath(5__9))); } ((Behaviour)5__12).enabled = false; 5__12 = null; } <>s__10 = null; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Disabling light object " + ((Object)5__9).name + " with path " + GetObjectPath(5__9))); } <>s__13 = 5__9.GetComponentsInChildren(true); for (<>s__14 = 0; <>s__14 < <>s__13.Length; <>s__14++) { 5__15 = <>s__13[<>s__14]; 5__16 = 5__15.materials; 5__17 = false; 5__18 = 0; while (5__18 < 5__16.Length) { 5__19 = 5__16[5__18]; if (!((Object)(object)5__19 == (Object)null)) { 5__20 = 5__19.HasProperty(emissionMapID); 5__21 = 5__19.HasProperty(emissiveColorID); 5__22 = 5__19.HasProperty(emissionColorID); 5__23 = 5__19.HasProperty(emissiveIntensityID); 5__24 = 5__19.IsKeywordEnabled("_EMISSIVE_COLOR_MAP"); 5__25 = false; if (5__19.HasProperty(useEmissiveIntensityID)) { 5__25 = 5__19.GetFloat("_UseEmissiveIntensity") == 1f; } 5__26 = FastContains(((Object)5__19).name, "Light") || FastContains(((Object)5__19).name, "LED"); 5__27 = 5__19.HasColor("_Color") && 5__19.color.a == 1f && (5__19.color.r == 1f || 5__19.color.g == 1f || 5__19.color.b == 1f); if (5__24 | 5__20 | 5__25 | 5__26 | 5__27) { if (5__21) { 5__19.SetColor(emissiveColorID, 5__6); } if (5__22) { 5__19.SetColor(emissionColorID, 5__6); } if (5__23) { 5__19.SetFloat(emissiveIntensityID, 0f); } 5__17 = true; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)$"Darkened material {((Object)5__19).name} of {((Object)((Component)5__15).gameObject).name} {5__24} {5__20} {5__21} {5__22} {5__23} {5__25} {5__26} {5__27}"); } } else { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)$"Skipping material {((Object)5__19).name} of {((Object)((Component)5__15).gameObject).name} which has the following properties: {5__19.color} {5__24} {5__20} {5__21} {5__22} {5__23} {5__25} {5__26} {5__27}"); } if (((Object)5__19).name == "SkyEmissive (Instance)") { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Found LED light material " + ((Object)5__19).name + " of " + ((Object)((Component)5__15).gameObject).name)); } 5__16[5__18] = 5__7; 5__17 = true; } } 5__19 = null; } 5__18++; } if (5__17) { 5__15.materials = 5__16; } 5__16 = null; 5__15 = null; } <>s__13 = null; 5__9 = null; } 5__8++; 5__3++; } if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)$"Processed {5__3} light objects, sleeping for a frame"); } 5__28 = 0; goto IL_07ad; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__20 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool blackoutWeather; public TrueBlackout <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!StartOfRound.Instance.shipHasLanded) { <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } if (ScienceBirdTweaks.BlackoutSFX.Value && (Object)(object)BlackoutTriggerPatches.powerDownClip != (Object)null) { HUDManager.Instance.UIAudio.PlayOneShot(BlackoutTriggerPatches.powerDownClip); ScienceBirdTweaks.Logger.LogDebug((object)"Playing blackout audio!"); } if (ScienceBirdTweaks.DisableTrapsOnTrueBlackout.Value & blackoutWeather) { BlackoutTriggerPatches.doingHazardShutdown = true; RoundManager.Instance.SwitchPower(false); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly int emissiveColorID = Shader.PropertyToID("_EmissiveColor"); private static readonly int emissionMapID = Shader.PropertyToID("_EmissionMap"); private static readonly int emissionColorID = Shader.PropertyToID("_EmissionColor"); private static readonly int emissiveIntensityID = Shader.PropertyToID("_EmissiveIntensity"); private static readonly int useEmissiveIntensityID = Shader.PropertyToID("_UseEmissiveIntensity"); private static readonly int surfaceTypeID = Shader.PropertyToID("_SurfaceType"); private const string emissiveColorMapKeyword = "_EMISSIVE_COLOR_MAP"; private static readonly bool extraLogs = ScienceBirdTweaks.ExtraLogs.Value; private static readonly bool blacklistAnimators = ScienceBirdTweaks.BlacklistLightAnimators.Value; private static string[] nameBlacklist = InitializeBlacklist(ScienceBirdTweaks.TrueBlackoutNameBlacklist.Value); private static readonly int nameBlacklistLength = nameBlacklist.Length; private static string[] hierarchyBlacklist = InitializeBlacklist(ScienceBirdTweaks.TrueBlackoutHierarchyBlacklist.Value); private static int hierarchyBlacklistLength = hierarchyBlacklist.Length; private static bool doContainsCheck = hierarchyBlacklistLength > 0; private static string[] InitializeBlacklist(string configValue) { if (string.IsNullOrWhiteSpace(configValue)) { return Array.Empty(); } string text = configValue.Replace(" ", ""); if (string.IsNullOrEmpty(text)) { return Array.Empty(); } return (from s in text.Split(',') where !string.IsNullOrEmpty(s) select s).ToArray(); } private static bool FastContains(string path, string keyword) { return path.IndexOf(keyword, StringComparison.Ordinal) >= 0; } private static bool BlacklistIsSame(string name) { for (int i = 0; i < nameBlacklistLength; i++) { if (name == nameBlacklist[i]) { return true; } } return false; } private static bool BlacklistContains(string path) { for (int i = 0; i < hierarchyBlacklistLength; i++) { if (FastContains(path, hierarchyBlacklist[i])) { return true; } } return false; } private static void AddToBlacklist(string item) { doContainsCheck = true; if (hierarchyBlacklist.Length == 0) { hierarchyBlacklist = new string[1] { item ?? "" }; } else { hierarchyBlacklist = hierarchyBlacklist.Append(item).ToArray(); } hierarchyBlacklistLength = hierarchyBlacklist.Length; string[] array = hierarchyBlacklist; foreach (string text in array) { ScienceBirdTweaks.Logger.LogDebug((object)text); } } public static void DoBlackout(bool disableSun) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Invalid comparison between Unknown and I4 //IL_0bc4: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) Stopwatch stopwatch = Stopwatch.StartNew(); if (ScienceBirdTweaks.BlacklistEmergency.Value) { doContainsCheck = true; AddToBlacklist("ExitDoor"); } if (ScienceBirdTweaks.BlacklistPoles.Value) { AddToBlacklist("GuidancePole"); } ScienceBirdTweaks.Logger.LogInfo((object)"Doing blackout!"); Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).isLoaded) { ScienceBirdTweaks.Logger.LogWarning((object)"Scene is not loaded. Aborting!"); stopwatch.Stop(); ScienceBirdTweaks.Logger.LogDebug((object)$"[TIMER] TOTAL blackout execution time (aborted): {stopwatch.ElapsedMilliseconds}ms"); return; } TrueBlackout trueBlackout = Object.FindObjectOfType(); if ((Object)(object)trueBlackout == (Object)null) { GameObject val = new GameObject("BlackoutManager"); trueBlackout = val.AddComponent(); } if (disableSun && ScienceBirdTweaks.BlackoutSun.Value != "Blackout Only Lights") { try { GameObject val2 = GameObject.Find("Sun"); if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } catch (Exception ex) { ScienceBirdTweaks.Logger.LogWarning((object)("Error disabling sun: " + ex.Message)); } try { ScienceBirdTweaks.Logger.LogDebug((object)"Setting spotlight lighting for Blackout"); ShipFloodlightController shipFloodlightController = Object.FindObjectOfType(); if ((Object)(object)shipFloodlightController != (Object)null) { shipFloodlightController.SetFloodlightData(ScienceBirdTweaks.BlackoutFloodLightIntensity.Value, ScienceBirdTweaks.BlackoutFloodLightAngle.Value, ScienceBirdTweaks.BlackoutFloodLightRange.Value); } else { ScienceBirdTweaks.Logger.LogWarning((object)"ShipFloodlightController instance not found in the scene."); } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogWarning((object)$"Error while trying to modify floodlights: {arg}"); } if (ScienceBirdTweaks.BlackoutSun.Value == "Blackout Only Sun") { return; } GameObject val3 = GameObject.Find("LightBehindDoor"); if ((Object)(object)val3 != (Object)null) { SpriteRenderer component = val3.GetComponent(); ScienceBirdTweaks.Logger.LogDebug((object)("Found sprite object " + ((Object)val3).name + " with path " + GetObjectPath(val3))); if ((Object)(object)component != (Object)null) { component.color = Color.black; ScienceBirdTweaks.Logger.LogDebug((object)("Set color of sprite object " + ((Object)val3).name + " to black with path " + GetObjectPath(val3))); } else { ScienceBirdTweaks.Logger.LogWarning((object)("SpriteRenderer not found on " + ((Object)val3).name + " with path " + GetObjectPath(val3))); } } else { ScienceBirdTweaks.Logger.LogWarning((object)"Sprite object not found in scene"); } } List list; try { list = GetSceneLights(StartOfRound.Instance.currentLevel.sceneName); if (list == null || list.Count == 0) { throw new Exception("GetSceneLights found no lights"); } } catch (Exception ex2) { ScienceBirdTweaks.Logger.LogWarning((object)("Error getting scene lights: " + ex2.Message + ". Falling back to all of Type.")); list = new List(Object.FindObjectsOfType(true)); } if (list == null || list.Count == 0) { ScienceBirdTweaks.Logger.LogWarning((object)"No lights found in scene!"); stopwatch.Stop(); ScienceBirdTweaks.Logger.LogDebug((object)$"[TIMER] TOTAL TrueBlackout execution time (no lights found): {stopwatch.ElapsedMilliseconds}ms"); return; } HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); foreach (Light item in list) { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)$"Found light {((Object)item).name} in {GetObjectPath(((Component)((Component)item).transform.parent).gameObject)} with type {item.type} and bake type {item.bakingOutput.lightmapBakeType}"); } Transform parent = ((Component)item).transform.parent; if ((Object)(object)parent == (Object)null || hashSet2.Contains(((Component)parent).gameObject)) { continue; } string objectPath = GetObjectPath(((Component)parent).gameObject); if (BlacklistIsSame(((Object)((Component)parent).gameObject).name) || (doContainsCheck && BlacklistContains(objectPath))) { hashSet2.Add(((Component)parent).gameObject); if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Skipping light object " + ((Object)((Component)parent).gameObject).name + " with path " + objectPath + " due to blacklist")); } if (hashSet.Contains(((Component)parent).gameObject)) { hashSet.Remove(((Component)parent).gameObject); } } else if ((int)item.bakingOutput.lightmapBakeType == 2 || HasParentWithInteractTrigger(((Component)item).gameObject) || (Object)(object)((Component)parent).GetComponentInChildren(true) != (Object)null || (blacklistAnimators && HasParentWithAnimator(((Component)item).gameObject))) { hashSet2.Add(((Component)parent).gameObject); if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Skipping light object " + ((Object)((Component)parent).gameObject).name + " with path " + objectPath + " due to baked lightmap, interact trigger, or animator")); } if (hashSet.Contains(((Component)parent).gameObject)) { hashSet.Remove(((Component)parent).gameObject); } } else { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Adding light object " + ((Object)((Component)parent).gameObject).name + " with path " + objectPath + " to processing list")); } hashSet.Add(((Component)parent).gameObject); } } ScienceBirdTweaks.Logger.LogDebug((object)$"[TIMER] Light processing finished at {stopwatch.ElapsedMilliseconds}ms"); ScienceBirdTweaks.Logger.LogDebug((object)$"Found {hashSet.Count} light objects to process"); if (hashSet.Count() == 0) { ScienceBirdTweaks.Logger.LogInfo((object)"Found no lights!"); stopwatch.Stop(); ScienceBirdTweaks.Logger.LogDebug((object)$"[TIMER] TOTAL Blackout execution time (no lights found): {stopwatch.ElapsedMilliseconds}ms"); return; } if ((Object)(object)RoundManager.Instance != (Object)null) { try { RoundManager.Instance.SwitchPower(true); RoundManager.Instance.TurnOnAllLights(false); } catch (Exception ex3) { ScienceBirdTweaks.Logger.LogWarning((object)("Error switching power state: " + ex3.Message)); } } else { ScienceBirdTweaks.Logger.LogWarning((object)"RoundManager.Instance is null, skipping power switching"); } try { BreakerBox val4 = Object.FindObjectOfType(); if ((Object)(object)val4 != (Object)null) { ((Component)val4).gameObject.SetActive(false); } } catch (Exception ex4) { ScienceBirdTweaks.Logger.LogWarning((object)("Error handling breaker box: " + ex4.Message)); } if (StartOfRound.Instance.currentLevel.PlanetName == "85 Rend" || StartOfRound.Instance.currentLevel.PlanetName == "20 Adamance") { GameObject val5 = GameObject.Find("SnowCabin/LightSwitchContainer/LightSwitch"); GameObject val6 = GameObject.Find("SnowCabin/LightSwitchContainer (1)/LightSwitch"); GameObject val7 = GameObject.Find("SnowCabin/HangingLight"); GameObject val8 = GameObject.Find("SnowCabin/HangingLight (1)"); if ((Object)(object)val5 != (Object)null) { val5.GetComponent().triggerAnimatorB = null; } if ((Object)(object)val6 != (Object)null) { val6.GetComponent().triggerAnimatorB = null; } if ((Object)(object)val7 != (Object)null) { val7.GetComponent().SetBool("on", false); } if ((Object)(object)val8 != (Object)null) { val8.GetComponent().SetBool("on", false); } } else if (StartOfRound.Instance.currentLevel.PlanetName == "68 Artifice") { GameObject val9 = GameObject.Find("SideShed/LightSwitchContainer (1)/LightSwitch"); GameObject val10 = GameObject.Find("SideShed/HangingLight (1)"); if ((Object)(object)val9 != (Object)null) { val9.GetComponent().triggerAnimatorB = null; } if ((Object)(object)val10 != (Object)null) { val10.GetComponent().SetBool("on", false); } Animator[] array = (from x in Object.FindObjectsOfType() where ((Object)x.runtimeAnimatorController).name == "LEDHangingLight" select x).ToArray(); Animator[] array2 = array; foreach (Animator val11 in array2) { val11.SetBool("on", false); } } else if (StartOfRound.Instance.currentLevel.PlanetName == "41 Experimentation") { Animator[] array3 = (from x in Object.FindObjectsOfType() where ((Object)((Component)x).gameObject).name.Contains("HangingLight", StringComparison.Ordinal) && (Object)(object)((Component)x).transform.parent != (Object)null && ((Object)((Component)((Component)x).transform.parent).gameObject).name == "Environment" select x).ToArray(); Animator[] array4 = array3; foreach (Animator val12 in array4) { val12.SetBool("on", false); } } if (Object.op_Implicit((Object)(object)GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot/Tower2x3(Clone)")) || Object.op_Implicit((Object)(object)GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot/Tower2x2(Clone)"))) { Animator[] array5 = (from x in Object.FindObjectsOfType() where ((Object)((Component)x).gameObject).name == "HangingLightSmall ON" select x).ToArray(); Animator[] array6 = array5; foreach (Animator val13 in array6) { val13.SetBool("on", false); } } if (Object.op_Implicit((Object)(object)GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot/backroomssillyhall(Clone)"))) { Material val14 = ((Renderer)(from x in Object.FindObjectsOfType() where ((Object)((Component)x).gameObject).name == "Cube" && ((Renderer)x).materials != null && ((Renderer)x).materials.Length == 1 && ((Object)((Renderer)x).materials[0]).name == "no light (Instance)" select x).First()).materials[0]; MeshRenderer[] array7 = (from x in Object.FindObjectsOfType() where ((Object)((Component)x).gameObject).name == "Cube" && ((Renderer)x).materials != null && ((Renderer)x).materials.Length == 1 && ((Object)((Renderer)x).materials[0]).name == "light (Instance)" select x).ToArray(); MeshRenderer[] array8 = array7; foreach (MeshRenderer val15 in array8) { Material[] materials = ((Renderer)val15).materials; materials[0] = val14; ((Renderer)val15).materials = materials; } } if (Object.op_Implicit((Object)(object)GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot/Bathroom(Clone)")) && Object.op_Implicit((Object)(object)GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot/OfficeStartRoom(Clone)"))) { MeshRenderer[] array9 = (from x in Object.FindObjectsOfType() where (((Object)((Component)x).gameObject).name == "Cube (1)" || ((Object)((Component)x).gameObject).name == "Cube (2)") && ((Renderer)x).materials != null && ((Renderer)x).materials.Length == 2 && (((Object)((Renderer)x).materials[1]).name == "male (Instance)" || ((Object)((Renderer)x).materials[1]).name == "female (Instance)") select x).ToArray(); MeshRenderer[] array10 = array9; foreach (MeshRenderer val16 in array10) { Material[] materials2 = ((Renderer)val16).materials; materials2[1].SetColor(emissiveColorID, new Color(0f, 0f, 0f, 1f)); materials2[1].SetColor(emissionColorID, new Color(0f, 0f, 0f, 1f)); materials2[1].SetFloat(emissiveIntensityID, 0f); ((Renderer)val16).materials = materials2; } } ((MonoBehaviour)trueBlackout).StartCoroutine(trueBlackout.PlayAudioAfterWait(disableSun)); ((MonoBehaviour)trueBlackout).StartCoroutine(trueBlackout.DisableLightsOverFrames(hashSet)); stopwatch.Stop(); ScienceBirdTweaks.Logger.LogDebug((object)$"[TIMER] Material Assignment finished at {stopwatch.ElapsedMilliseconds}ms"); } [IteratorStateMachine(typeof(d__20))] private IEnumerator PlayAudioAfterWait(bool blackoutWeather) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { <>4__this = this, blackoutWeather = blackoutWeather }; } [IteratorStateMachine(typeof(d__21))] private IEnumerator DisableLightsOverFrames(IEnumerable lightObjectsEnumerable) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__21(0) { <>4__this = this, lightObjectsEnumerable = lightObjectsEnumerable }; } private static string GetObjectPath(GameObject obj) { StringBuilder stringBuilder = new StringBuilder(((Object)obj).name); Transform parent = obj.transform.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } private static bool HasParentWithInteractTrigger(GameObject obj) { Transform val = obj.transform; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).GetComponent() != (Object)null) { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Found InteractTrigger in " + ((Object)val).name + " with path " + GetObjectPath(((Component)val).gameObject))); } return true; } val = val.parent; } return false; } private static bool HasParentWithAnimator(GameObject obj) { Transform val = obj.transform; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).GetComponent() != (Object)null) { if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Found Animator in " + ((Object)val).name + " with path " + GetObjectPath(((Component)val).gameObject))); } return true; } val = val.parent; } return false; } public static List GetLightsInParent(Transform parent, bool includeInactive = true) { List list = new List(); if ((Object)(object)parent == (Object)null) { return list; } Light[] componentsInChildren = ((Component)parent).GetComponentsInChildren(includeInactive); list.AddRange(componentsInChildren); return list; } public static List GetSceneLights(string sceneName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Scene sceneByName = SceneManager.GetSceneByName(sceneName); List list = new List(); GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); GameObject[] rootGameObjects2 = ((Scene)(ref sceneByName)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects2) { list.AddRange(val.GetComponentsInChildren(true)); } return list; } } 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(); 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) //IL_00c1: 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(2444557552u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2444557552u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(64298950u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 64298950u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2444557552u, new RpcReceiveHandler(__rpc_handler_2444557552), "StopTapeServerRpc"); ((NetworkBehaviour)this).__registerRpc(64298950u, new RpcReceiveHandler(__rpc_handler_64298950), "StopTapeClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2444557552(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_64298950(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).StopTapeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WesleyTapeSkip"; } } } namespace ScienceBirdTweaks.Patches { [HarmonyPatch] public class BetterDustClouds { private static bool initialSet = true; private static bool enableBuffer = true; private static bool transitionBuffer = false; private static bool transitionOverride = true; [HarmonyPatch(typeof(TimeOfDay), "Update")] [HarmonyPostfix] private static void ReEnable(TimeOfDay __instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 if ((ScienceBirdTweaks.ThickDustClouds.Value || ScienceBirdTweaks.DustCloudsNoise.Value) && (!((Object)(object)StartOfRound.Instance != (Object)null) || !((Object)(object)StartOfRound.Instance.currentLevel != (Object)null) || !(StartOfRound.Instance.currentLevel.PlanetName == "115 Wither")) && (int)__instance.currentLevelWeather == 0) { GameObject effectObject = __instance.effects[0].effectObject; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)effectObject != (Object)null && (!effectObject.activeInHierarchy || !__instance.effects[0].effectEnabled) && (Object)(object)localPlayerController != (Object)null && ((!localPlayerController.isInsideFactory && !localPlayerController.isPlayerDead) || (localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript != (Object)null && !localPlayerController.spectatedPlayerScript.isInsideFactory))) { effectObject.SetActive(true); __instance.effects[0].effectEnabled = true; } } } [HarmonyPatch(typeof(AudioReverbTrigger), "ChangeAudioReverbForPlayer")] [HarmonyPrefix] private static void TriggerPrefix(AudioReverbTrigger __instance, out bool __state) { __state = TimeOfDay.Instance.effects[0].effectEnabled; } [HarmonyPatch(typeof(AudioReverbTrigger), "ChangeAudioReverbForPlayer")] [HarmonyPostfix] private static void TriggerPostfix(AudioReverbTrigger __instance, bool __state) { if (__instance.weatherEffect == 0) { TimeOfDay.Instance.effects[0].effectEnabled = __state; } } [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPostfix] private static void SetInitial(TimeOfDay __instance) { if (ScienceBirdTweaks.ThickDustClouds.Value || ScienceBirdTweaks.DustCloudsNoise.Value) { initialSet = true; } } [HarmonyPatch(typeof(TimeOfDay), "SetWeatherEffects")] [HarmonyPrefix] private static void CheckBefore(TimeOfDay __instance) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((ScienceBirdTweaks.ThickDustClouds.Value || ScienceBirdTweaks.DustCloudsNoise.Value) && !(StartOfRound.Instance.currentLevel.PlanetName == "115 Wither")) { GameObject effectObject = TimeOfDay.Instance.effects[0].effectObject; if ((int)__instance.currentLevelWeather == 0 && (Object)(object)effectObject != (Object)null) { enableBuffer = __instance.effects[0].effectEnabled; transitionBuffer = __instance.effects[0].transitioning; __instance.effects[0].effectEnabled = false; __instance.effects[0].transitioning = transitionOverride; } } } [HarmonyPatch(typeof(TimeOfDay), "SetWeatherEffects")] [HarmonyPostfix] [HarmonyBefore(new string[] { "ScienceBird.Wither" })] private static void ChangeEffectObject(TimeOfDay __instance) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) GameObject effectObject = TimeOfDay.Instance.effects[0].effectObject; if ((!ScienceBirdTweaks.ThickDustClouds.Value && !ScienceBirdTweaks.DustCloudsNoise.Value) || StartOfRound.Instance.currentLevel.PlanetName == "115 Wither") { if (initialSet && (Object)(object)effectObject != (Object)null && effectObject.activeInHierarchy) { AudioSource componentInChildren = effectObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.Stop(); } LocalVolumetricFog component = effectObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.parameters.meanFreePath = 17f; } __instance.effects[0].lerpPosition = true; initialSet = false; } } else if ((int)__instance.currentLevelWeather == 0 && (Object)(object)effectObject != (Object)null) { __instance.effects[0].effectEnabled = enableBuffer; __instance.effects[0].transitioning = transitionBuffer; transitionOverride = true; if (initialSet) { enableBuffer = true; __instance.effects[0].lerpPosition = false; GameObject val = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("DustCloudsAmbience"); if ((Object)(object)val != (Object)null && (Object)(object)effectObject != (Object)null) { LocalVolumetricFog component2 = effectObject.GetComponent(); if ((Object)(object)component2 != (Object)null && ScienceBirdTweaks.ThickDustClouds.Value) { component2.parameters.meanFreePath = ScienceBirdTweaks.DustCloudsThickness.Value; } if (ScienceBirdTweaks.DustCloudsNoise.Value) { if (!Object.op_Implicit((Object)(object)effectObject.GetComponentInChildren())) { GameObject val2 = Object.Instantiate(val, Vector3.zero, Quaternion.identity); val2.transform.SetParent(effectObject.transform, false); } AudioSource componentInChildren2 = effectObject.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.Play(); } else { ScienceBirdTweaks.Logger.LogError((object)"Null dust clouds audio!"); } } } initialSet = false; } if (__instance.effects[0].effectEnabled && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && !GameNetworkManager.Instance.localPlayerController.isInsideFactory) { __instance.effects[0].transitioning = false; if ((Object)(object)__instance.effects[0].effectObject != (Object)null) { Vector3 val3 = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead) ? ((Component)StartOfRound.Instance.localPlayerController).transform.position : ((Component)StartOfRound.Instance.spectateCamera).transform.position); val3 += Vector3.up * 4f; effectObject.transform.position = val3; } } else if (!__instance.effects[0].transitioning) { transitionOverride = false; } } else if ((Object)(object)effectObject != (Object)null && effectObject.activeInHierarchy) { AudioSource componentInChildren3 = effectObject.GetComponentInChildren(); if ((Object)(object)componentInChildren3 != (Object)null) { componentInChildren3.Stop(); } LocalVolumetricFog component3 = effectObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.parameters.meanFreePath = 17f; } __instance.effects[0].lerpPosition = true; } } } [HarmonyPatch] public class DustSpaceClouds { [HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")] [HarmonyPostfix] [HarmonyPriority(0)] private static void AddSpaceToMapScreen(StartOfRound __instance) { if (ScienceBirdTweaks.DustSpaceClouds.Value) { string text = ((TMP_Text)__instance.screenLevelDescription).text; if (text.Contains("DustClouds")) { text = text.Replace("DustClouds", "Dust Clouds"); text = text.Replace("DustyClouds", "Dusty Clouds"); ((TMP_Text)__instance.screenLevelDescription).text = text; } } } [HarmonyPatch(typeof(Terminal), "LoadNewNode")] [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyAfter(new string[] { "mrov.terminalformatter" })] private static void AddSpaceToTerminal(Terminal __instance) { if (ScienceBirdTweaks.DustSpaceClouds.Value && __instance.currentText.Contains("DustClouds")) { __instance.currentText = __instance.currentText.Replace("DustClouds", "Dust Clouds"); __instance.currentText = __instance.currentText.Replace("DustyClouds", "Dusty Clouds"); __instance.screenText.text = __instance.currentText; } } } [HarmonyPatch] public class BigScrew { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void FindScrewsOnLoad(StartOfRound __instance) { if (!ScienceBirdTweaks.BigScrew.Value) { return; } GrabbableObject[] array = (from obj in Resources.FindObjectsOfTypeAll() where (Object)(object)obj.itemProperties != (Object)null && obj.itemProperties.itemName == "Big bolt" select obj).ToArray(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if ((Object)(object)((Component)val).gameObject.GetComponentInChildren() != (Object)null) { ((Component)val).gameObject.GetComponentInChildren().headerText = "Big screw"; } val.itemProperties.itemName = "Big screw"; } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void FindScrewsOnLoad(StartOfRound __instance, string sceneName) { if (!ScienceBirdTweaks.BigScrew.Value || !(sceneName == "SampleSceneRelay")) { return; } GrabbableObject[] array = (from obj in Resources.FindObjectsOfTypeAll() where (Object)(object)obj.itemProperties != (Object)null && obj.itemProperties.itemName == "Big bolt" select obj).ToArray(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if ((Object)(object)((Component)val).gameObject.GetComponentInChildren() != (Object)null) { ((Component)val).gameObject.GetComponentInChildren().headerText = "Big screw"; } val.itemProperties.itemName = "Big screw"; } } [HarmonyPatch(typeof(Terminal), "LoadNewNode")] [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyAfter(new string[] { "mrov.terminalformatter" })] private static void AddScrewToTerminal(Terminal __instance) { if (ScienceBirdTweaks.BigScrew.Value && __instance.currentText.ToLower().Contains("big bolt")) { __instance.currentText = __instance.currentText.Replace("Big bolt", "Big screw"); __instance.screenText.text = __instance.currentText; } } } [HarmonyPatch] public class BlackoutTriggerPatches { private static bool _doBlackout = false; public static bool doingHazardShutdown = false; public static bool doingHazardStartup = false; private static bool _inSwitchContext = false; private static float hazardWait = -1f; private static bool breakerDone = false; private static int oldMinSpawns = -1; public static AudioClip powerDownClip; public static void LoadAssets() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (ScienceBirdTweaks.BlackoutSFX.Value && (ScienceBirdTweaks.TrueBlackout.Value || ScienceBirdTweaks.BlackoutOnApparatusRemoval.Value)) { powerDownClip = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("PowerDown"); } } [HarmonyPatch(typeof(LungProp), "EquipItem")] [HarmonyPrefix] private static void OnApparatusGrab(LungProp __instance) { if (__instance.isLungDocked) { oldMinSpawns = RoundManager.Instance.minEnemiesToSpawn; if (ScienceBirdTweaks.BlackoutOnApparatusRemoval.Value) { _doBlackout = true; } if (ScienceBirdTweaks.DisableTrapsOnApparatusRemoval.Value) { doingHazardShutdown = true; } } } [HarmonyPatch(typeof(RoundManager), "PowerSwitchOnClientRpc")] [HarmonyPrefix] private static void LightsOnStart() { if (ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value) { hazardWait = 0.49f; doingHazardStartup = true; } } [HarmonyPatch(typeof(RoundManager), "PowerSwitchOffClientRpc")] [HarmonyPrefix] private static void LightsOffStart() { if (ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value && !doingHazardShutdown) { hazardWait = 0.49f; doingHazardShutdown = true; } } [HarmonyPatch(typeof(BreakerBox), "SwitchBreaker")] [HarmonyPostfix] private static void BreakerFinished(RoundManager __instance) { if (ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value && (doingHazardShutdown || doingHazardStartup)) { breakerDone = true; } } [HarmonyPatch(typeof(RoundManager), "Update")] [HarmonyPostfix] private static void ShutdownTimer() { if (!ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value || (!doingHazardShutdown && !doingHazardStartup)) { return; } if (hazardWait < 0f && breakerDone) { ScienceBirdTweaks.Logger.LogDebug((object)"Stopping hazard routine after wait!"); if (doingHazardShutdown) { doingHazardShutdown = false; } if (doingHazardStartup) { doingHazardStartup = false; } breakerDone = false; } else if (hazardWait > 0f) { hazardWait -= Time.deltaTime; } } [HarmonyPatch(typeof(HUDManager), "RadiationWarningHUD")] [HarmonyPrefix] public static void ApparatusNotifPatch(HUDManager __instance) { ScienceBirdTweaks.Logger.LogDebug((object)"Apparatus shutdown finished!"); doingHazardShutdown = false; if (((NetworkBehaviour)__instance).IsServer && (ScienceBirdTweaks.ApparatusSpawnChance.Value != 70 || ScienceBirdTweaks.ApparatusSpawnMin.Value != 2)) { if (Random.Range(0, 100) < ScienceBirdTweaks.ApparatusSpawnChance.Value && RoundManager.Instance.minEnemiesToSpawn < ScienceBirdTweaks.ApparatusSpawnMin.Value) { ScienceBirdTweaks.Logger.LogDebug((object)$"Increasing min spawns to {ScienceBirdTweaks.ApparatusSpawnMin.Value}"); RoundManager.Instance.minEnemiesToSpawn = ScienceBirdTweaks.ApparatusSpawnMin.Value; } else if (oldMinSpawns >= 0) { RoundManager.Instance.minEnemiesToSpawn = oldMinSpawns; } } oldMinSpawns = -1; } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPostfix] private static void ResetHazardFlag() { oldMinSpawns = -1; doingHazardShutdown = false; doingHazardStartup = false; } [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] private static void ResetOnLanding() { doingHazardShutdown = false; doingHazardStartup = false; } [HarmonyPatch(typeof(RoundManager), "FlickerPoweredLights")] [HarmonyPostfix] private static void FlickerPoweredLightsPostfix(RoundManager __instance) { if (!_doBlackout) { return; } if ((Object)(object)__instance == (Object)null) { ScienceBirdTweaks.Logger.LogWarning((object)"FlickerPoweredLightsPostfix called but __instance was null."); return; } try { ScienceBirdTweaks.Logger.LogDebug((object)("Calling BlackoutOverride for " + ((Object)((Component)__instance).gameObject).name + ".")); TrueBlackout.DoBlackout(disableSun: false); } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"Error executing BlackoutOverride after FlickerPoweredLights initiation: {arg}"); } _doBlackout = false; } [HarmonyPatch(typeof(TerminalAccessibleObject), "Start")] [HarmonyPostfix] public static void SetPowerSwitchable(TerminalAccessibleObject __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if ((ScienceBirdTweaks.DisableTrapsOnApparatusRemoval.Value || ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value || ScienceBirdTweaks.DisableTrapsOnTrueBlackout.Value) && !__instance.isBigDoor) { PowerSwitchable val = ((Component)__instance).gameObject.AddComponent(); OnSwitchPowerEvent val2 = new OnSwitchPowerEvent(); ((UnityEvent)(object)val2).AddListener((UnityAction)__instance.OnPowerSwitch); val.powerSwitchEvent = val2; } } [HarmonyPatch(typeof(TerminalAccessibleObject), "OnPowerSwitch")] [HarmonyPrefix] public static bool PowerSwitchPrefix(TerminalAccessibleObject __instance, bool switchedOn) { if ((!ScienceBirdTweaks.DisableTrapsOnApparatusRemoval.Value && !ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value && !ScienceBirdTweaks.DisableTrapsOnTrueBlackout.Value) || __instance.isBigDoor) { return true; } HazardShutdown(__instance, switchedOn); return false; } public static void HazardShutdown(TerminalAccessibleObject terminalObj, bool switchedOn) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if (!switchedOn && doingHazardShutdown && !terminalObj.isBigDoor) { Landmine component = ((Component)terminalObj).gameObject.GetComponent(); Turret component2 = ((Component)terminalObj).gameObject.GetComponent(); Transform parent = ((Component)terminalObj).gameObject.transform.parent; ((Graphic)terminalObj.mapRadarText).color = Color.gray; ((Graphic)terminalObj.mapRadarBox).color = Color.gray; if ((Object)(object)component != (Object)null) { component.ToggleMine(false); } else if ((Object)(object)component2 != (Object)null) { component2.ToggleTurretEnabled(false); } else if ((Object)(object)parent != (Object)null && Object.op_Implicit((Object)(object)((Component)parent).gameObject.GetComponentInChildren())) { SpikeRoofTrap componentInChildren = ((Component)parent).gameObject.GetComponentInChildren(); componentInChildren.ToggleSpikesEnabled(false); } terminalObj.inCooldown = true; ((MonoBehaviour)terminalObj).StopAllCoroutines(); } else if (switchedOn && ScienceBirdTweaks.DisableTrapsOnBreakerSwitch.Value && doingHazardStartup && !terminalObj.isBigDoor && terminalObj.inCooldown) { Landmine component3 = ((Component)terminalObj).gameObject.GetComponent(); Turret component4 = ((Component)terminalObj).gameObject.GetComponent(); Transform parent2 = ((Component)terminalObj).gameObject.transform.parent; ((Graphic)terminalObj.mapRadarText).color = Color.green; ((Graphic)terminalObj.mapRadarBox).color = Color.green; if ((Object)(object)component3 != (Object)null) { component3.ToggleMine(true); } else if ((Object)(object)component4 != (Object)null) { component4.ToggleTurretEnabled(true); } else if ((Object)(object)parent2 != (Object)null && Object.op_Implicit((Object)(object)((Component)parent2).gameObject.GetComponentInChildren())) { SpikeRoofTrap componentInChildren2 = ((Component)parent2).gameObject.GetComponentInChildren(); componentInChildren2.ToggleSpikesEnabled(true); } terminalObj.inCooldown = false; } } } [HarmonyPatch] public class BridgePatches { private static BridgeTriggerType2 bridge2; private static bool bridge1Present; private static bool bridge2Present; private static bool doneBridge1; private static bool doneBridge2; private static float startTime1; private static float startTime2; private static Animator bridge2Animator; private static int bridge2Count; [HarmonyPatch(typeof(BridgeTrigger), "BridgeFallClientRpc")] [HarmonyPostfix] private static void BridgeFall(BridgeTrigger __instance) { if (ScienceBirdTweaks.BridgeItemsFix.Value) { startTime1 = Time.realtimeSinceStartup; } } [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] [HarmonyPostfix] private static void BridgeCheckReset(BridgeTrigger __instance) { if (ScienceBirdTweaks.BridgeItemsFix.Value) { doneBridge1 = false; doneBridge2 = false; startTime1 = 0f; startTime2 = 0f; bridge2Count = 0; bridge2 = Object.FindObjectOfType(); if ((Object)(object)bridge2 != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Found bridge 2!"); bridge2Present = true; bridge2Animator = bridge2.animatedObjectTrigger.triggerAnimator; } if (Object.op_Implicit((Object)(object)Object.FindObjectOfType())) { ScienceBirdTweaks.Logger.LogDebug((object)"Found bridge 1!"); bridge1Present = true; } } } [HarmonyPatch(typeof(AnimatedObjectTrigger), "TriggerAnimation")] [HarmonyPostfix] private static void Bridge2AnimateServer(AnimatedObjectTrigger __instance) { if (((NetworkBehaviour)__instance).IsServer && ScienceBirdTweaks.BridgeItemsFix.Value && bridge2Present && (Object)(object)__instance.triggerAnimator == (Object)(object)bridge2Animator) { bridge2Count++; if (bridge2Count == 2) { startTime2 = Time.realtimeSinceStartup; } } } [HarmonyPatch(typeof(AnimatedObjectTrigger), "UpdateAnimTriggerClientRpc")] [HarmonyPostfix] private static void Bridge2AnimateClient(AnimatedObjectTrigger __instance) { if (!((NetworkBehaviour)__instance).IsServer && ScienceBirdTweaks.BridgeItemsFix.Value && bridge2Present && (Object)(object)__instance.triggerAnimator == (Object)(object)bridge2Animator) { bridge2Count++; if (bridge2Count == 2) { startTime2 = Time.realtimeSinceStartup; } } } [HarmonyPatch(typeof(RoundManager), "Update")] [HarmonyPostfix] private static void BridgeUpdates(RoundManager __instance) { if (!ScienceBirdTweaks.BridgeItemsFix.Value || (!bridge1Present && !bridge2Present)) { return; } if (startTime1 != 0f && Time.realtimeSinceStartup - startTime1 > 1.4f && !doneBridge1) { GrabbableObject[] array = Object.FindObjectsOfType(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (!val.isInFactory && !val.isHeld && !val.isHeldByEnemy && !val.isInElevator && !val.isInShipRoom && (Object)(object)((Component)val).transform.parent != (Object)null) { SetGrabbableFall(val); } } doneBridge1 = true; } if (startTime2 == 0f || !(Time.realtimeSinceStartup - startTime2 > 1.4f) || doneBridge2) { return; } GrabbableObject[] array3 = Object.FindObjectsOfType(); GrabbableObject[] array4 = array3; foreach (GrabbableObject val2 in array4) { if (!val2.isInFactory && !val2.isHeld && !val2.isHeldByEnemy && !val2.isInElevator && !val2.isInShipRoom && (Object)(object)((Component)val2).transform.parent != (Object)null) { SetGrabbableFall(val2); } } doneBridge2 = true; } public static void SetGrabbableFall(GrabbableObject grabbable) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Vector3 itemFloorPosition = grabbable.GetItemFloorPosition(default(Vector3)); Bounds bounds = StartOfRound.Instance.shipBounds.bounds; itemFloorPosition = (((Bounds)(ref bounds)).Contains(itemFloorPosition) ? StartOfRound.Instance.elevatorTransform.InverseTransformPoint(itemFloorPosition) : StartOfRound.Instance.propsContainer.InverseTransformPoint(itemFloorPosition)); if (!(Vector3.Distance(itemFloorPosition, ((Component)grabbable).transform.parent.InverseTransformPoint(((Component)grabbable).transform.position)) < 0.1f)) { grabbable.startFallingPosition = ((Component)grabbable).transform.parent.InverseTransformPoint(((Component)grabbable).transform.position); grabbable.fallTime = 0f; grabbable.hasHitGround = false; grabbable.reachedFloorTarget = false; grabbable.targetFloorPosition = itemFloorPosition; } } } [HarmonyPatch] internal class ButtonPanelPatches { private static bool spinnerAdded; public static GameObject panelPrefab; private static bool nullHandler; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializeInteractPrefab() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (!ScienceBirdTweaks.ClientsideMode.Value && (ScienceBirdTweaks.FloodlightRotation.Value || ScienceBirdTweaks.FancyPanel.Value)) { ScienceBirdTweaks.Logger.LogDebug((object)"Initializing button panel!"); panelPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("ShipFancyPanel"); NetworkManager.Singleton.AddNetworkPrefab(panelPrefab); } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void ReplaceButtonPanel(StartOfRound __instance, string sceneName) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ClientsideMode.Value || (!ScienceBirdTweaks.FloodlightRotation.Value && !ScienceBirdTweaks.FancyPanel.Value) || (Object)(object)panelPrefab == (Object)null || !(sceneName == "SampleSceneRelay")) { return; } GameObject val = GameObject.Find("Environment/HangarShip/ControlPanelWTexture"); GameObject val2 = GameObject.Find("Environment/HangarShip"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return; } if (((NetworkBehaviour)__instance).IsServer && !Object.op_Implicit((Object)(object)GameObject.Find("ShipFancyPanel(Clone)"))) { ScienceBirdTweaks.Logger.LogDebug((object)"Spawning new button panel..."); GameObject val3 = Object.Instantiate(panelPrefab, val.transform.position, val.transform.rotation); val3.GetComponent().Spawn(false); if (val3.GetComponent().TrySetParent(val2.transform, true)) { ScienceBirdTweaks.Logger.LogDebug((object)"Parented new panel to ship!"); } } ((Renderer)val.GetComponent()).enabled = false; } [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] [HarmonyPrefix] private static void OnDisconnect(GameNetworkManager __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && (ScienceBirdTweaks.FancyPanel.Value || ScienceBirdTweaks.FloodlightRotation.Value)) { GameObject val = GameObject.Find("Environment/HangarShip/ControlPanelWTexture"); if ((Object)(object)val != (Object)null) { ((Renderer)val.GetComponent()).enabled = true; } } } [HarmonyPatch(typeof(StartOfRound), "EndOfGameClientRpc")] [HarmonyPostfix] private static void ResetLights() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight1Set(on: false); ButtonPanelController.Instance.GreenLight2Set(on: false); ButtonPanelController.Instance.GreenLight3Set(on: false); ButtonPanelController.Instance.OrangeRoundSet(on: false); ButtonPanelController.Instance.OrangeTallSet(on: false); ButtonPanelController.Instance.RedLightSet(on: false); } } [HarmonyPatch(typeof(StartOfRound), "ResetShipFurniture")] [HarmonyPrefix] private static void OnResetShip(StartOfRound __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight1Set(on: false); ButtonPanelController.Instance.GreenLight2Set(on: false); ButtonPanelController.Instance.GreenLight3Set(on: false); ButtonPanelController.Instance.OrangeRoundSet(on: false); ButtonPanelController.Instance.OrangeTallSet(on: false); ButtonPanelController.Instance.RedLightSet(on: false); } } [HarmonyPatch(typeof(StartOfRound), "FirePlayersAfterDeadlineClientRpc")] [HarmonyPostfix] private static void FiredLights() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.OrangeTallSet(on: true); } } [HarmonyPatch(typeof(HangarShipDoor), "PlayDoorAnimation")] [HarmonyPrefix] private static void DoorLight(HangarShipDoor __instance, bool closed) { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && __instance.buttonsEnabled && !StartOfRound.Instance.inShipPhase && (Object)(object)ButtonPanelController.Instance != (Object)null) { if (closed && !__instance.shipDoorsAnimator.GetBool("Closed")) { ButtonPanelController.Instance.OrangeRoundSet(on: true); } else if (!closed && __instance.shipDoorsAnimator.GetBool("Closed")) { ButtonPanelController.Instance.OrangeRoundSet(on: false); } } } [HarmonyPatch(typeof(StartOfRound), "ChangeLevel")] [HarmonyPostfix] [HarmonyAfter(new string[] { "zigzag.randommoonfx" })] private static void StartRoute(StartOfRound __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null) && __instance.travellingToNewLevel) { ButtonPanelController.Instance.GreenLight1Set(on: true); } } [HarmonyPatch(typeof(StartOfRound), "ArriveAtLevel")] [HarmonyPostfix] private static void EndRoute() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight1Set(on: false); } } [HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")] [HarmonyPostfix] private static void OnStart(bool landingShip) { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && landingShip && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight3Set(on: true); } } [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] private static void OnLand() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight3Set(on: false); } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] private static void OnTakeoff() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.GreenLight2Set(on: true); } } [HarmonyPatch(typeof(HUDManager), "ReadDialogue")] [HarmonyPostfix] private static void LeavingDialogue() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null) && TimeOfDay.Instance.shipLeavingAlertCalled) { ButtonPanelController.Instance.RedLightSet(on: true); } } [HarmonyPatch(typeof(ShipTeleporter), "PressButtonEffects")] [HarmonyPostfix] private static void OnTeleport() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.BlueLight1Set(on: true); ButtonPanelController.Instance.SetLightAfterDelay(0, 5f, on: false); } } [HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorClientRpc")] [HarmonyPostfix] private static void OnTransmit() { if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.FancyPanel.Value && !((Object)(object)ButtonPanelController.Instance == (Object)null)) { ButtonPanelController.Instance.BlueLight2Set(on: true); ButtonPanelController.Instance.SetLightAfterDelay(1, 4f, on: false); } } } [HarmonyPatch] public class ClientShipItemsPatch { [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] [HarmonyPrefix] private static void ClientConnectSync(StartOfRound __instance) { if (ScienceBirdTweaks.ClientShipItems.Value && __instance.inShipPhase) { GrabbableObject[] array = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { val.fallTime = 1f; val.hasHitGround = true; val.scrapPersistedThroughRounds = true; val.isInElevator = true; val.isInShipRoom = true; } } } } [HarmonyPatch] public class ConfigReassignmentPatch { public static Dictionary<(string, string), (string, string)> entryDict = new Dictionary<(string, string), (string, string)> { { ("9. Blackout", "Apparatus Hazard Blackout"), ("9. Blackout", "Apparatus Hazard Shutdown") }, { ("9. Blackout", "Breaker Hazard Blackout"), ("9. Blackout", "Breaker Hazard Shutdown") }, { ("9. Blackout", "Apparatus Hazard Shutdown"), ("3. General Tweaks", "Apparatus Hazard Shutdown") }, { ("9. Blackout", "Breaker Hazard Shutdown"), ("3. General Tweaks", "Breaker Hazard Shutdown") }, { ("9. Blackout", "Apparatus Increased Enemy Spawn Chance"), ("3. General Tweaks", "Apparatus Increased Enemy Spawn Chance") }, { ("9. Blackout", "Apparatus Minimum Enemy Spawns"), ("3. General Tweaks", "Apparatus Minimum Enemy Spawns") }, { ("Ship Tweaks", "Rotating Floodlight"), ("2. Ship Additions", "Rotating Floodlight") }, { ("Ship Tweaks", "Rotate Floodlight Upon Landing"), ("2. Ship Additions", "Rotate Floodlight Upon Landing") }, { ("Ship Tweaks", "Ship Floodlight Rotation Speed"), ("2. Ship Additions", "Ship Floodlight Rotation Speed") }, { ("Ship Tweaks", "Ship Floodlight Angle"), ("2. Ship Additions", "Ship Floodlight Angle") }, { ("Ship Tweaks", "Ship Floodlight Range"), ("2. Ship Additions", "Ship Floodlight Range") }, { ("3. General Tweaks", "Monitor Transition Fix"), ("3. General Tweaks", "Ship Monitor Fixes") }, { ("A. Mod Tweaks", "LLL Unlock Syncing"), ("X. Mod Tweaks", "LLL - Unlock Syncing") }, { ("A. Mod Tweaks", "Wesley Moons Video Tape Skip"), ("X. Mod Tweaks", "Wesleys Moons - Video Tape Skip") }, { ("A. Mod Tweaks", "ShipWindowsBeta Shutter Fix"), ("X. Mod Tweaks", "ShipWindows - Shutter Fix") }, { ("A. Mod Tweaks", "ShipWindowsBeta Shutter Sound Effect"), ("X. Mod Tweaks", "ShipWindows - Shutter Sound Effect") }, { ("A. Mod Tweaks", "Weather Tweaks Announcement Change"), ("X. Mod Tweaks", "Weather Tweaks - Announcement Change") }, { ("A. Mod Tweaks", "Smart Cupboard Mrov Terminal Stock"), ("X. Mod Tweaks", "SSS Smart Cupboard + Mrov Terminal Stock") }, { ("Mod Tweaks", "LLL Unlock Syncing"), ("X. Mod Tweaks", "LLL - Unlock Syncing") }, { ("Mod Tweaks", "Wesley Moons Video Tape Skip"), ("X. Mod Tweaks", "Wesleys Moons - Video Tape Skip") }, { ("Mod Tweaks", "ShipWindowsBeta Shutter Fix"), ("X. Mod Tweaks", "ShipWindows - Shutter Fix") }, { ("Mod Tweaks", "ShipWindowsBeta Shutter Sound Effect"), ("X. Mod Tweaks", "ShipWindows - Shutter Sound Effect") }, { ("Mod Tweaks", "Weather Tweaks Announcement Change"), ("X. Mod Tweaks", "Weather Tweaks - Announcement Change") }, { ("Mod Tweaks", "Smart Cupboard Mrov Terminal Stock"), ("X. Mod Tweaks", "SSS Smart Cupboard + Mrov Terminal Stock") } }; public static Dictionary sectionDict = new Dictionary { { "Ship Tweaks", "1 i. Ship Tweaks" }, { "Ship Tweaks Collider Sizes", "1 ii. Ship Tweaks Collider Sizes" }, { "Ship Tweaks Removals", "1 iii. Ship Tweaks Removals" }, { "General Tweaks", "3. General Tweaks" }, { "Gameplay Tweaks", "4. Enemy Tweaks" }, { "Zap Gun & Hazards", "5. Zap Gun & Hazards" }, { "Better Dust Clouds", "6. Better Dust Clouds" }, { "Selective Scrap Keeping", "7. Selective Scrap Keeping" }, { "Shotgun QOL", "8. Shotgun QOL" }, { "Blackout", "9. Blackout" }, { "Mod Tweaks", "X. Mod Tweaks" }, { "A. Mod Tweaks", "X. Mod Tweaks" }, { "B. Interior Scrap Bonus", "Y. Interior Scrap Bonus" }, { "C. Technical", "Z. Technical" }, { "A. Player Cam Tweaks", "A. Head Cam Tweaks" } }; [HarmonyPatch(typeof(QuickMenuManager), "Start")] [HarmonyPostfix] private static void ConfigOrphanReassignment(QuickMenuManager __instance) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown ConfigEntryBase[] configEntries = ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.GetConfigEntries(); ConfigEntryBase[] array = configEntries; foreach (ConfigEntryBase val in array) { } PropertyInfo property = ((object)((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary dictionary = (Dictionary)property.GetValue(((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config, null); List list = new List(dictionary.Keys); foreach (ConfigDefinition item in list) { string value3; if (entryDict.TryGetValue((item.Section, item.Key), out (string, string) value)) { ConfigDefinition val2 = new ConfigDefinition(item.Section, item.Key); ConfigDefinition newConfigDef = new ConfigDefinition(value.Item1, value.Item2); if (dictionary.TryGetValue(val2, out var value2)) { MigrateOrphanValues(val2, newConfigDef, value2, dictionary, configEntries); } } else if (sectionDict.TryGetValue(item.Section, out value3)) { ConfigDefinition val3 = new ConfigDefinition(item.Section, item.Key); ConfigDefinition newConfigDef2 = new ConfigDefinition(value3, item.Key); if (dictionary.TryGetValue(val3, out var value4)) { MigrateOrphanValues(val3, newConfigDef2, value4, dictionary, configEntries); } } } if (ScienceBirdTweaks.ClearOrphans.Value) { Dictionary dictionary2 = (Dictionary)property.GetValue(((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config, null); dictionary.Clear(); ScienceBirdTweaks.ClearOrphans.Value = false; } ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.Save(); } private static void MigrateOrphanValues(ConfigDefinition orphanConfigDef, ConfigDefinition newConfigDef, string valueString, Dictionary orphanedEntries, ConfigEntryBase[] entryArray) { ConfigDefinition newConfigDef2 = newConfigDef; object valueFromString = GetValueFromString(valueString); if (valueFromString == null) { return; } ConfigEntry val4 = default(ConfigEntry); if (valueFromString is bool value) { ConfigEntry val = default(ConfigEntry); if (entryArray.Any((ConfigEntryBase x) => x.Definition == newConfigDef2 && x.BoxedValue.GetType() == typeof(bool) && (bool)x.BoxedValue == (bool)x.DefaultValue) && ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.TryGetEntry(newConfigDef2, ref val)) { val.Value = value; orphanedEntries.Remove(orphanConfigDef); } } else if (valueFromString is float num) { ConfigEntry val2 = default(ConfigEntry); ConfigEntry val3 = default(ConfigEntry); if (entryArray.Any((ConfigEntryBase x) => x.Definition == newConfigDef2 && x.BoxedValue.GetType() == typeof(float) && (float)x.BoxedValue == (float)x.DefaultValue) && ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.TryGetEntry(newConfigDef2, ref val2)) { val2.Value = num; orphanedEntries.Remove(orphanConfigDef); } else if (entryArray.Any((ConfigEntryBase x) => x.Definition == newConfigDef2 && x.BoxedValue.GetType() == typeof(int) && (int)x.BoxedValue == (int)x.DefaultValue) && Mathf.Abs(num - Mathf.Floor(num + 1E-06f)) < 1E-07f && ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.TryGetEntry(newConfigDef2, ref val3)) { val3.Value = Mathf.FloorToInt(num + 1E-06f); orphanedEntries.Remove(orphanConfigDef); } } else if (valueFromString is string value2 && entryArray.Any((ConfigEntryBase x) => x.Definition == newConfigDef2 && x.BoxedValue.GetType() == typeof(string) && (string)x.BoxedValue == (string)x.DefaultValue) && ((BaseUnityPlugin)ScienceBirdTweaks.Instance).Config.TryGetEntry(newConfigDef2, ref val4)) { val4.Value = value2; orphanedEntries.Remove(orphanConfigDef); } } private static object GetValueFromString(string configValue) { if (bool.TryParse(configValue, out var result)) { return result; } if (float.TryParse(configValue, out var result2)) { return result2; } return configValue; } } [HarmonyPatch] public class CruiserPatches { [HarmonyPatch(typeof(ClipboardItem), "Update")] [HarmonyPostfix] private static void UpdatePatch(ClipboardItem __instance) { if (ScienceBirdTweaks.RemoveCruiserClipboard.Value && __instance.truckManual) { ScienceBirdTweaks.Logger.LogDebug((object)"Removing cruiser clipboard!"); Object.Destroy((Object)(object)((Component)__instance).gameObject); } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void CruiserPrefabPatch(GameNetworkManager __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (!ScienceBirdTweaks.SmokeFix.Value) { return; } Material material = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SmokeParticle"); VehicleController[] array = Resources.FindObjectsOfTypeAll(); VehicleController[] array2 = array; foreach (VehicleController val in array2) { ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); ParticleSystem[] array3 = componentsInChildren; foreach (ParticleSystem val2 in array3) { ParticleSystemRenderer component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).material != (Object)null && (((Object)((Renderer)component).material).name == "Default-Particle (Instance)" || ((Object)((Renderer)component).material).name == "Default-ParticleSystem (Instance)")) { ScienceBirdTweaks.Logger.LogDebug((object)"Found cruiser target particle!"); ((Renderer)component).material = material; } } } JetpackItem[] array4 = Resources.FindObjectsOfTypeAll(); JetpackItem[] array5 = array4; foreach (JetpackItem val3 in array5) { ParticleSystem[] componentsInChildren2 = ((Component)val3).GetComponentsInChildren(true); ParticleSystem[] array6 = componentsInChildren2; foreach (ParticleSystem val4 in array6) { ParticleSystemRenderer component2 = ((Component)val4).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)((Renderer)component2).material != (Object)null && (((Object)((Renderer)component2).material).name == "Default-Particle (Instance)" || ((Object)((Renderer)component2).material).name == "Default-ParticleSystem (Instance)")) { ScienceBirdTweaks.Logger.LogDebug((object)"Found jetpack target particle!"); ((Renderer)component2).material = material; } } } } } [HarmonyPatch] public class DebugMode { private static string GetObjectPath(GameObject obj) { StringBuilder stringBuilder = new StringBuilder(((Object)obj).name); Transform parent = obj.transform.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } [HarmonyPatch(typeof(Terminal), "LoadNewNodeIfAffordable")] [HarmonyPostfix] private static void OnTerminalBuy(Terminal __instance, TerminalNode node) { if (ScienceBirdTweaks.DebugMode.Value && node.buyItemIndex != -1 && node.buyItemIndex != -7) { ItemDropship val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null && (Object)(object)val.terminalScript != (Object)null) { ScienceBirdTweaks.Logger.LogInfo((object)$"Buying item, count: {val.terminalScript.orderedItemsFromTerminal.Count}, ship delivering: {val.deliveringOrder}"); } else { ScienceBirdTweaks.Logger.LogWarning((object)"Null terminal script!"); } } } [HarmonyPatch(typeof(EclipseWeather), "OnEnable")] [HarmonyPostfix] private static void OnEclipsed(EclipseWeather __instance) { if (ScienceBirdTweaks.DebugMode.Value) { ScienceBirdTweaks.Logger.LogInfo((object)"Doing eclipsed spawns!"); } } [HarmonyPatch(typeof(Terminal), "QuitTerminal")] [HarmonyPostfix] private static void OnExitTerminalFix(Terminal __instance) { if (ScienceBirdTweaks.DebugMode.Value) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && localPlayerController.throwingObject) { ScienceBirdTweaks.Logger.LogInfo((object)"Fixing player throwing!"); localPlayerController.throwingObject = false; } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPostfix] private static void SuitTooltip(PlayerControllerB __instance) { if (ScienceBirdTweaks.DebugMode.Value && ((TMP_Text)__instance.cursorTip).text != "" && ((TMP_Text)__instance.cursorTip).text.Contains("_Suit")) { ((TMP_Text)__instance.cursorTip).text = ((TMP_Text)__instance.cursorTip).text.Replace("_Suit", " suit"); ((TMP_Text)__instance.cursorTip).text = ((TMP_Text)__instance.cursorTip).text.Replace("WineRed", " Wine red"); } } [HarmonyPatch(typeof(PlayerControllerB), "StopHoldInteractionOnTrigger")] [HarmonyPostfix] private static void OnInteractFail(PlayerControllerB __instance) { if (ScienceBirdTweaks.DebugMode.Value) { } } public static void ObjectDebugger(object obj, string tag) { if (obj != null) { Type type = obj.GetType(); PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { object value = propertyInfo.GetValue(obj, null); ScienceBirdTweaks.Logger.LogDebug((object)$"({tag}) PROPERTY: {propertyInfo.Name} - {value}"); } FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { object value2 = fieldInfo.GetValue(obj); ScienceBirdTweaks.Logger.LogDebug((object)$"({tag}) FIELD: {fieldInfo.Name} - {value2}"); } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void FixNoiseSuppression(StartOfRound __instance) { if (ScienceBirdTweaks.DebugMode.Value) { VoiceSettings.Instance.BackgroundSoundRemovalEnabled = false; } } } [HarmonyPatch] public class ElevatorJinglePatch { internal static Random clipRandom; internal static bool butteryPresent; [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void CheckButtery(StartOfRound __instance) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name == "HalloweenElevator") { butteryPresent = true; break; } } } [HarmonyPatch(typeof(MineshaftElevatorController), "Update")] [HarmonyPrefix] private static void SetJingleClip(MineshaftElevatorController __instance) { if (!butteryPresent && ScienceBirdTweaks.OldHalloweenElevatorMusic.Value && !((Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)(object)__instance) && __instance.elevatorHalloweenClips.Length == __instance.elevatorHalloweenClipsLoop.Length && __instance.elevatorHalloweenClips.Length != 0 && __instance.elevatorHalloweenClipsLoop.Length != 0 && __instance.playMusic && !__instance.elevatorJingleMusic.isPlaying) { if (clipRandom == null) { clipRandom = new Random(StartOfRound.Instance.randomMapSeed); } int num = clipRandom.Next(0, __instance.elevatorHalloweenClips.Length); if (__instance.elevatorMovingDown) { __instance.elevatorJingleMusic.clip = __instance.elevatorHalloweenClips[num]; } else { __instance.elevatorJingleMusic.clip = __instance.elevatorHalloweenClipsLoop[num]; } } } [HarmonyPatch(typeof(MineshaftElevatorController), "OnEnable")] [HarmonyPrefix] private static void SetJingleRandom(MineshaftElevatorController __instance) { if (!butteryPresent && ScienceBirdTweaks.OldHalloweenElevatorMusic.Value) { clipRandom = new Random(StartOfRound.Instance.randomMapSeed); } } } [HarmonyPatch] public class LeviathanPatches { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void OnStart(StartOfRound __instance) { if (ScienceBirdTweaks.LeviathanSurfacePatch.Value) { ScienceBirdTweaks.Logger.LogDebug((object)"Replacing surface tags!"); string[] second = ScienceBirdTweaks.LeviathanNaturalSurfaces.Value.Replace(", ", ",").Split(","); string[] naturalSurfaceTags = __instance.naturalSurfaceTags.Concat(second).ToArray(); __instance.naturalSurfaceTags = naturalSurfaceTags; } } [HarmonyPatch(typeof(SandWormAI), "ShakePlayerCameraInProximity")] [HarmonyPrefix] private static void GroundTransitionPatch(SandWormAI __instance, Vector3 pos) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.LeviathanQuicksand.Value) { Vector3 position = ((Component)__instance.hitGroundParticle).transform.position; if (pos == ((Component)__instance).transform.position) { position = ((Component)__instance.emergeFromGroundParticle2).transform.position; } if (position.y > -80f) { Object.Instantiate(RoundManager.Instance.quicksandPrefab, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); } } } } [HarmonyPatch] public class CoilheadElevatorPatch { private static Matrix4x4 matrix; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void Initialize(PlayerControllerB __instance) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.CoilheadElevatorFix.Value) { Vector4 val = default(Vector4); ((Vector4)(ref val))..ctor(0f, 0f, 1f, 0f); Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor(0f, 1f, 0f, 0f); Vector4 val3 = default(Vector4); ((Vector4)(ref val3))..ctor(-1f, 0f, 0f, 0f); Vector4 zero = Vector4.zero; matrix = new Matrix4x4(val, val2, val3, zero); } } [HarmonyPatch(typeof(PlayerControllerB), "HasLineOfSightToPosition")] [HarmonyPostfix] private static void HasLineOfSightPatch(PlayerControllerB __instance, Vector3 pos, float width, int range, float proximityAwareness, ref bool __result) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.CoilheadElevatorFix.Value && (Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)null && !((NetworkBehaviour)__instance).IsOwner && (Object)(object)__instance.physicsParent != (Object)null && ((Object)((Component)__instance.physicsParent).gameObject).name == "AnimContainer") { Vector3 val = Vector4.op_Implicit(matrix * Vector4.op_Implicit(((Component)__instance.playerEye).transform.forward)); float num = Vector3.Distance(((Component)__instance).transform.position, pos); RaycastHit val2 = default(RaycastHit); if (num < (float)range && (Vector3.Angle(val, pos - ((Component)__instance.gameplayCamera).transform.position) < width || num < proximityAwareness) && !Physics.Linecast(((Component)__instance.playerEye).transform.position, pos, ref val2, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1)) { __result = true; } else { __result = false; } } } [HarmonyPatch(typeof(PlayerControllerB), "LineOfSightToPositionAngle")] [HarmonyPostfix] private static void LineOfSightToPosPatch(PlayerControllerB __instance, Vector3 pos, int range, float proximityAwareness, ref float __result) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.CoilheadElevatorFix.Value && (Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)null && !((NetworkBehaviour)__instance).IsOwner && (Object)(object)__instance.physicsParent != (Object)null && ((Object)((Component)__instance.physicsParent).gameObject).name == "AnimContainer") { Vector3 val = Vector4.op_Implicit(matrix * Vector4.op_Implicit(((Component)__instance.playerEye).transform.forward)); if (Vector3.Distance(((Component)__instance).transform.position, pos) < (float)range && !Physics.Linecast(((Component)__instance.playerEye).transform.position, pos, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1)) { __result = Vector3.Angle(val, pos - ((Component)__instance.gameplayCamera).transform.position); } else { __result = -361f; } } } } [HarmonyPatch] public class CentipedePatch { public static bool multiplayerSecondChanceGiven = false; private static int maxHealth = 100; private static int damageAccumulated = 0; private static bool subtractInterval = false; [HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void GetMaxHealth(RoundManager __instance) { if (!(ScienceBirdTweaks.CentipedeMode.Value == "Vanilla")) { damageAccumulated = 0; maxHealth = GameNetworkManager.Instance.localPlayerController.health; ScienceBirdTweaks.Logger.LogDebug((object)$"Found max health: {maxHealth}"); } } [HarmonyPatch(typeof(CentipedeAI), "Update")] [HarmonyPrefix] private static void CentipedeClearDamage(CentipedeAI __instance) { if (!(ScienceBirdTweaks.CentipedeMode.Value == "Vanilla") && ScienceBirdTweaks.CentipedeMode.Value == "Fixed Damage" && !((Object)(object)__instance.clingingToPlayer == (Object)null) && __instance.clingingToPlayer.isPlayerDead) { subtractInterval = false; damageAccumulated = 0; } } [HarmonyPatch(typeof(CentipedeAI), "DamagePlayerOnIntervals")] [HarmonyPrefix] private static void CentipedeDamage(CentipedeAI __instance, out float __state) { //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) __state = __instance.damagePlayerInterval; if (ScienceBirdTweaks.CentipedeMode.Value == "Vanilla") { return; } if (__instance.damagePlayerInterval <= 0f && !__instance.inDroppingOffPlayerAnim) { if (((EnemyAI)__instance).stunNormalizedTimer > 0f || (((ScienceBirdTweaks.CentipedeMode.Value == "Second Chance" && !multiplayerSecondChanceGiven) || (StartOfRound.Instance.connectedPlayersAmount <= 0 && !__instance.singlePlayerSecondChanceGiven && ScienceBirdTweaks.CentipedeMode.Value != "Fixed Damage")) && __instance.clingingToPlayer.health <= ScienceBirdTweaks.CentipedeSecondChanceThreshold.Value)) { ScienceBirdTweaks.Logger.LogDebug((object)"Giving second chance!"); if (StartOfRound.Instance.connectedPlayersAmount <= 0) { __instance.singlePlayerSecondChanceGiven = true; } else { multiplayerSecondChanceGiven = true; } __instance.inDroppingOffPlayerAnim = true; __instance.StopClingingServerRpc(false); } else if (damageAccumulated < Mathf.RoundToInt((float)maxHealth * ScienceBirdTweaks.CentipedeFixedDamage.Value) || ScienceBirdTweaks.CentipedeMode.Value != "Fixed Damage" || __instance.clingingToPlayer.criticallyInjured) { if (ScienceBirdTweaks.CentipedeMode.Value == "Fixed Damage") { damageAccumulated += 10; ScienceBirdTweaks.Logger.LogDebug((object)$"Accumulated damage: {damageAccumulated}"); } __instance.clingingToPlayer.DamagePlayer(10, true, true, (CauseOfDeath)5, 0, false, default(Vector3)); __instance.damagePlayerInterval = 2f; } else { ScienceBirdTweaks.Logger.LogDebug((object)"Dropping off player"); __instance.inDroppingOffPlayerAnim = true; __instance.StopClingingServerRpc(false); damageAccumulated = 0; } } else { __instance.damagePlayerInterval -= Time.deltaTime; } __state = __instance.damagePlayerInterval; } [HarmonyPatch(typeof(CentipedeAI), "DamagePlayerOnIntervals")] [HarmonyPostfix] private static void CentipedeDamagePostfix(CentipedeAI __instance, float __state) { if (!(ScienceBirdTweaks.CentipedeMode.Value == "Vanilla")) { __instance.damagePlayerInterval = __state; } } } [HarmonyPatch] public class TulipSnakePatch { [HarmonyPatch(typeof(FlowerSnakeEnemy), "MakeChuckleClientRpc")] [HarmonyPrefix] private static bool ChuckleOverride(FlowerSnakeEnemy __instance) { if (!ScienceBirdTweaks.TulipSnakeMuteLaugh.Value) { return true; } if ((Object)(object)__instance.clingingToPlayer != (Object)null) { ((EnemyAI)__instance).isInsidePlayerShip = __instance.clingingToPlayer.isInHangarShipRoom; } RoundManager.PlayRandomClip(((EnemyAI)__instance).creatureVoice, ((EnemyAI)__instance).enemyType.audioClips, true, 1f, 0, 5); return false; } } [HarmonyPatch] public class ManeaterPatches { private static Vector3 startPos; private static Vector3 storedPos; private static bool donePositionFix = true; private static bool owner = false; [HarmonyPatch(typeof(CaveDwellerAI), "HitEnemy")] [HarmonyPrefix] private static void InterruptAnimation(CaveDwellerAI __instance) { if (ScienceBirdTweaks.ManeaterTransformInterrupt.Value && ((EnemyAI)__instance).inSpecialAnimation && __instance.growthMeter > 1f) { donePositionFix = false; ScienceBirdTweaks.Logger.LogDebug((object)"Exited early!"); ((EnemyAI)__instance).inSpecialAnimation = false; ((Behaviour)((EnemyAI)__instance).agent).enabled = true; } } [HarmonyPatch(typeof(CaveDwellerAI), "StartTransformationAnim")] [HarmonyPrefix] private static void GetStartPos(CaveDwellerAI __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ManeaterTransformInterrupt.Value) { startPos = ((Component)__instance).transform.position; } } [HarmonyPatch(typeof(CaveDwellerAI), "Update")] [HarmonyPrefix] private static void GetPos(CaveDwellerAI __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ManeaterTransformInterrupt.Value) { storedPos = ((Component)__instance).transform.position; } } [HarmonyPatch(typeof(CaveDwellerAI), "LateUpdate")] [HarmonyPostfix] private static void FixPos(CaveDwellerAI __instance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ManeaterTransformInterrupt.Value && !donePositionFix && Vector3.Distance(storedPos, ((Component)__instance).transform.position) > 1.5f && ((Component)__instance).transform.position == startPos) { ((EnemyAI)__instance).agent.speed = 17f; ((Component)__instance).transform.position = storedPos; donePositionFix = true; } } [HarmonyPatch(typeof(CaveDwellerAI), "DoNonBabyUpdateLogic")] [HarmonyPrefix] private static void OwnershipCheck(CaveDwellerAI __instance) { if (ScienceBirdTweaks.ManeaterAttackFix.Value) { if (((NetworkBehaviour)__instance).IsOwner && !owner) { __instance.screamTimer = __instance.screamTime; } owner = ((NetworkBehaviour)__instance).IsOwner; } } [HarmonyPatch(typeof(CaveDwellerAI), "DoNonBabyUpdateLogic")] [HarmonyPostfix] private static void DoorSpeedPatch(CaveDwellerAI __instance) { if (ScienceBirdTweaks.ManeaterFastDoors.Value) { switch (((EnemyAI)__instance).currentBehaviourStateIndex) { case 1: case 2: ((EnemyAI)__instance).openDoorSpeedMultiplier = 2f; ((EnemyAI)__instance).openDoorSpeedMultiplier = 2f; break; case 3: ((EnemyAI)__instance).openDoorSpeedMultiplier = 3f; break; } } } [HarmonyPatch(typeof(CaveDwellerAI), "DoBabyAIInterval")] [HarmonyPrefix] private static void BabyAIPrefix(CaveDwellerAI __instance, out GrabbableObject __state) { __state = null; if (ScienceBirdTweaks.KiwiManeaterScream.Value && (Object)(object)__instance.observingScrap != (Object)null) { __state = __instance.observingScrap; } } [HarmonyPatch(typeof(CaveDwellerAI), "DoBabyAIInterval")] [HarmonyPostfix] private static void BabyAIPostfix(CaveDwellerAI __instance, GrabbableObject __state) { if (!ScienceBirdTweaks.KiwiManeaterScream.Value) { return; } if ((Object)(object)__instance.observingScrap != (Object)null && __instance.eatingScrap) { GrabbableObject observingScrap = __instance.observingScrap; KiwiBabyItem val = (KiwiBabyItem)(object)((observingScrap is KiwiBabyItem) ? observingScrap : null); if (val != null && val.currentAnimation != 5) { val.currentAnimation = 5; if (!val.eggAudio.isPlaying || (Object)(object)val.eggAudio.clip != (Object)(object)val.screamAudio) { val.eggAudio.clip = val.screamAudio; val.eggAudio.Play(); } val.babyAnimator.SetInteger("babyAnimation", 5); } } if ((Object)(object)__instance.observingScrap != (Object)(object)__state && (Object)(object)__state != (Object)null) { KiwiBabyItem val2 = (KiwiBabyItem)(object)((__state is KiwiBabyItem) ? __state : null); if (val2 != null) { ResetKiwi(val2); } } } [HarmonyPatch(typeof(CaveDwellerAI), "StopObserving")] [HarmonyPrefix] private static void StopObservingCheck(CaveDwellerAI __instance) { if (ScienceBirdTweaks.KiwiManeaterScream.Value && (Object)(object)__instance.observingScrap != (Object)null) { GrabbableObject observingScrap = __instance.observingScrap; KiwiBabyItem val = (KiwiBabyItem)(object)((observingScrap is KiwiBabyItem) ? observingScrap : null); if (val != null) { ResetKiwi(val); } } } private static void ResetKiwi(KiwiBabyItem kiwi) { if (kiwi.currentAnimation == 5) { kiwi.currentAnimation = 4; kiwi.eggAudio.Stop(); kiwi.babyAnimator.SetInteger("babyAnimation", 4); } } } [HarmonyPatch] public class OldBirdPatch { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void OldBirdPrefabPatch(GameNetworkManager __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (!ScienceBirdTweaks.SmokeFix.Value) { return; } Material material = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("SmokeParticle"); RadMechAI[] array = Resources.FindObjectsOfTypeAll().ToArray(); RadMechAI[] array2 = array; foreach (RadMechAI val in array2) { ParticleSystem[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren(true); ParticleSystem[] array3 = componentsInChildren; foreach (ParticleSystem val2 in array3) { ParticleSystemRenderer component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).material != (Object)null && (((Object)((Renderer)component).material).name == "Default-Particle (Instance)" || ((Object)((Renderer)component).material).name == "Default-ParticleSystem (Instance)")) { ScienceBirdTweaks.Logger.LogDebug((object)("Found old bird target particle on " + ((Object)((Component)val2).gameObject).name + "!")); ((Renderer)component).material = material; } } } GameObject[] array4 = (from x in Resources.FindObjectsOfTypeAll() where ((Object)x).name == "LargeExplosionEffect" select x).ToArray(); GameObject[] array5 = array4; foreach (GameObject val3 in array5) { ParticleSystem[] componentsInChildren2 = val3.GetComponentsInChildren(true); ParticleSystem[] array6 = componentsInChildren2; foreach (ParticleSystem val4 in array6) { ParticleSystemRenderer component2 = ((Component)val4).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)((Renderer)component2).material != (Object)null && (((Object)((Renderer)component2).material).name == "Default-Particle (Instance)" || ((Object)((Renderer)component2).material).name == "Default-ParticleSystem (Instance)")) { ScienceBirdTweaks.Logger.LogDebug((object)"Found explosion target particle!"); ((Renderer)component2).material = material; } } } } } [HarmonyPatch] public class FallRotationPatch { [HarmonyPatch(typeof(GrabbableObject), "FallWithCurve")] [HarmonyPostfix] private static void AfterFall(GrabbableObject __instance) { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.itemProperties == (Object)null) { return; } try { if (!ScienceBirdTweaks.FallingRotationFix.Value || !(__instance.startFallingPosition.y - __instance.targetFloorPosition.y > 5f)) { return; } float num = Mathf.Clamp(StartOfRound.Instance.objectFallToGroundCurveNoBounce.Evaluate(__instance.fallTime), 0f, 1f); if (num < 1f) { if (__instance.floorYRot == -1) { ((Component)__instance).transform.rotation = Quaternion.Lerp(((Component)__instance).transform.rotation, Quaternion.Euler(__instance.itemProperties.restingRotation.x, ((Component)__instance).transform.eulerAngles.y, __instance.itemProperties.restingRotation.z), num * 0.3f); } else { ((Component)__instance).transform.rotation = Quaternion.Lerp(((Component)__instance).transform.rotation, Quaternion.Euler(__instance.itemProperties.restingRotation.x, (float)(__instance.floorYRot + __instance.itemProperties.floorYOffset) + 90f, __instance.itemProperties.restingRotation.z), num * 0.3f); } } else { __instance.fallTime = 1.02f; } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"Exception on fall rotation: {arg}"); } } } [HarmonyPatch] public class FixedShipObjectsPatches { private static bool destroyCord = false; public static GameObject furniturePrefab; public static List idBlacklist = new List(); public static int[] vanillaIDs = new int[21] { 5, 6, 9, 10, 12, 13, 14, 17, 18, 19, 20, 21, 22, 23, 27, 28, 29, 30, 31, 32, 33 }; public static List moddedIDs; public static List failedIDs = new List(); public static string moddedListMode = "blacklist"; [HarmonyPatch(typeof(StartOfRound), "PositionSuitsOnRack")] [HarmonyPostfix] private static void ParentSuits(StartOfRound __instance) { if (!ScienceBirdTweaks.FixedSuitRack.Value || !((NetworkBehaviour)__instance).IsServer) { return; } GameObject val = GameObject.Find("/Environment/HangarShip"); if (!((Object)(object)val != (Object)null)) { return; } ScienceBirdTweaks.Logger.LogDebug((object)"Parenting suits to ship!"); UnlockableSuit[] array = Object.FindObjectsOfType(); UnlockableSuit[] array2 = array; foreach (UnlockableSuit val2 in array2) { GameObject gameObject = ((Component)val2).gameObject; NetworkObject component = gameObject.GetComponent(); if (!component.TrySetParent(val.transform, true)) { ScienceBirdTweaks.Logger.LogError((object)"Failed to parent suit to ship!"); } } } private static void DestroyCord() { GameObject val = GameObject.Find("/Teleporter(Clone)/ButtonContainer/LongCord") ?? GameObject.Find("/Environment/HangarShip/Furniture(Clone)/Teleporter(Clone)/ButtonContainer/LongCord") ?? GameObject.Find("/Environment/HangarShip/Teleporter(Clone)/ButtonContainer/LongCord"); if ((Object)(object)val != (Object)null) { destroyCord = false; Object.Destroy((Object)(object)val); } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializePrefab() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (ScienceBirdTweaks.FixedShipObjects.Value && !ScienceBirdTweaks.ClientsideMode.Value && !ScienceBirdTweaks.AlternateFixLogic.Value) { ScienceBirdTweaks.Logger.LogDebug((object)"Initializing furniture holder!"); furniturePrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("Furniture"); NetworkManager.Singleton.AddNetworkPrefab(furniturePrefab); } } public static void SetupFurniture(StartOfRound round) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)round).IsServer) { return; } GameObject val = GameObject.Find("/Environment/HangarShip"); if ((Object)(object)val == (Object)null || ScienceBirdTweaks.ClientsideMode.Value || ScienceBirdTweaks.AlternateFixLogic.Value) { return; } GameObject val2 = Object.Instantiate(furniturePrefab, Vector3.zero, Quaternion.identity); if ((Object)(object)val2 != (Object)null && !val2.GetComponent().IsSpawned) { val2.GetComponent().Spawn(false); GameObject val3 = GameObject.Find("Furniture(Clone)"); if (val3.GetComponent().TrySetParent(val.transform, true)) { ScienceBirdTweaks.Logger.LogDebug((object)"Parented furniture holder to ship!"); } else { ScienceBirdTweaks.Logger.LogError((object)"Failed parenting furniture holder!"); } } else { ScienceBirdTweaks.Logger.LogDebug((object)"Furniture network already spawned!"); } } private static void ParentFurniture(StartOfRound round, int index) { if (!((NetworkBehaviour)round).IsServer) { return; } GameObject val = GameObject.Find("/Environment/HangarShip"); if ((Object)(object)val == (Object)null) { return; } if (!ScienceBirdTweaks.OnlyFixDefault.Value && ScienceBirdTweaks.ModdedListMode.Value != "Don't Use List" && ScienceBirdTweaks.ModdedUnlockableList.Value != "" && (moddedIDs == null || moddedIDs.Count <= 0)) { moddedIDs = new List(); string[] array = ScienceBirdTweaks.ModdedUnlockableList.Value.Replace(", ", ",").Split(","); string[] array2 = array; foreach (string name in array2) { UnlockableItem val2 = round.unlockablesList.unlockables.Find((UnlockableItem x) => x.unlockableName.ToLower() == name.ToLower()); if (val2 != null) { moddedIDs.Add(round.unlockablesList.unlockables.IndexOf(val2)); } } } if (ScienceBirdTweaks.ClientsideMode.Value || ScienceBirdTweaks.AlternateFixLogic.Value) { if (ScienceBirdTweaks.OnlyFixDefault.Value && Array.IndexOf(vanillaIDs, index) == -1) { return; } if (!ScienceBirdTweaks.OnlyFixDefault.Value && !vanillaIDs.Contains(index) && moddedIDs != null && moddedIDs.Count > 0) { if (ScienceBirdTweaks.ModdedListMode.Value == "Whitelist" && !moddedIDs.Contains(index)) { return; } ScienceBirdTweaks.Logger.LogDebug((object)$"Whitelisted index {index}!"); if (ScienceBirdTweaks.ModdedListMode.Value == "Blacklist" && moddedIDs.Contains(index)) { ScienceBirdTweaks.Logger.LogDebug((object)$"Blacklisted index {index}!"); return; } } if (idBlacklist.Contains(index)) { return; } UnlockableItem val3 = round.unlockablesList.unlockables[index]; if (val3 == null || !val3.spawnPrefab || !((Object)(object)val3.prefabObject != (Object)null)) { return; } GameObject val4 = GameObject.Find(((Object)val3.prefabObject).name + "(Clone)"); if ((Object)(object)val4.transform.parent != (Object)null && (Object)(object)val4.transform.parent == (Object)(object)val.transform) { return; } NetworkObject[] componentsInChildren = val4.GetComponentsInChildren(); NetworkObject[] array3 = componentsInChildren; foreach (NetworkObject val5 in array3) { if (!val5.IsSpawned) { ScienceBirdTweaks.Logger.LogError((object)("Network object not spawned yet, failing to parent! (" + ((Object)val4).name + ")")); if (!failedIDs.Contains(index)) { failedIDs.Add(index); } return; } } NetworkObject component = val4.GetComponent(); if (!((Object)(object)component != (Object)null) || !component.IsSpawned) { return; } if (component.TrySetParent(val.transform, true)) { ScienceBirdTweaks.Logger.LogDebug((object)("Parented furniture object " + ((Object)val4).name + "!")); return; } ScienceBirdTweaks.Logger.LogError((object)("Failed to parent " + ((Object)val4).name + "!")); if (!idBlacklist.Contains(index)) { idBlacklist.Add(index); } return; } GameObject val6 = GameObject.Find("/Environment/HangarShip/Furniture(Clone)"); if ((Object)(object)val6 == (Object)null) { SetupFurniture(round); } val6 = GameObject.Find("/Environment/HangarShip/Furniture(Clone)"); if ((Object)(object)val6 == (Object)null) { ScienceBirdTweaks.Logger.LogError((object)"Unable to resolve null furniture object!"); } else { if (ScienceBirdTweaks.OnlyFixDefault.Value && Array.IndexOf(vanillaIDs, index) == -1) { return; } if (!ScienceBirdTweaks.OnlyFixDefault.Value && !vanillaIDs.Contains(index) && moddedIDs != null && moddedIDs.Count > 0) { if (ScienceBirdTweaks.ModdedListMode.Value == "Whitelist" && !moddedIDs.Contains(index)) { return; } ScienceBirdTweaks.Logger.LogDebug((object)$"Whitelisted index {index}!"); if (ScienceBirdTweaks.ModdedListMode.Value == "Blacklist" && moddedIDs.Contains(index)) { ScienceBirdTweaks.Logger.LogDebug((object)$"Blacklisted index {index}!"); return; } } if (idBlacklist.Contains(index)) { return; } UnlockableItem val7 = round.unlockablesList.unlockables[index]; if (val7 == null || !val7.spawnPrefab || !((Object)(object)val7.prefabObject != (Object)null)) { return; } GameObject val8 = GameObject.Find(((Object)val7.prefabObject).name + "(Clone)"); if ((Object)(object)val8.transform.parent != (Object)null && (Object)(object)val8.transform.parent == (Object)(object)val6.transform) { return; } NetworkObject[] componentsInChildren2 = val8.GetComponentsInChildren(); NetworkObject[] array4 = componentsInChildren2; foreach (NetworkObject val9 in array4) { if (!val9.IsSpawned) { ScienceBirdTweaks.Logger.LogError((object)("Network object not spawned yet, failing to parent! (" + ((Object)val8).name + ")")); if (!failedIDs.Contains(index)) { failedIDs.Add(index); } return; } } NetworkObject component2 = val8.GetComponent(); if (!((Object)(object)component2 != (Object)null) || !component2.IsSpawned || !((NetworkBehaviour)round).IsServer) { return; } if (component2.TrySetParent(val6.transform, true)) { ScienceBirdTweaks.Logger.LogDebug((object)("Parented furniture object " + ((Object)val8).name + "!")); return; } ScienceBirdTweaks.Logger.LogError((object)("Failed to parent " + ((Object)val8).name + "!")); if (!idBlacklist.Contains(index)) { idBlacklist.Add(index); } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void OnLoad(StartOfRound __instance) { if (failedIDs.Count <= 0) { return; } foreach (int failedID in failedIDs) { ParentFurniture(__instance, failedID); } failedIDs.Clear(); } [HarmonyPatch(typeof(StartOfRound), "BuyShipUnlockableClientRpc")] [HarmonyPostfix] private static void OnBuy(StartOfRound __instance, int unlockableID) { if (unlockableID == 5 && !((NetworkBehaviour)__instance).IsServer) { destroyCord = true; } } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPostfix] private static void OnUpdate(StartOfRound __instance) { if (destroyCord) { DestroyCord(); } } [HarmonyPatch(typeof(StartOfRound), "SpawnUnlockable")] [HarmonyPostfix] private static void OnSpawn(StartOfRound __instance, int unlockableIndex) { if (ScienceBirdTweaks.FixedShipObjects.Value) { ParentFurniture(__instance, unlockableIndex); } if (ScienceBirdTweaks.RemoveTeleporterCord.Value) { DestroyCord(); } } [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] [HarmonyPostfix] private static void OnClientSync(StartOfRound __instance) { if (ScienceBirdTweaks.RemoveTeleporterCord.Value) { DestroyCord(); } } [HarmonyPatch(typeof(StartOfRound), "ResetShipFurniture")] [HarmonyPrefix] private static void ResetParentedObjects(StartOfRound __instance) { if (!ScienceBirdTweaks.FixedShipObjects.Value || !((NetworkBehaviour)__instance).IsServer || ScienceBirdTweaks.ClientsideMode.Value || ScienceBirdTweaks.AlternateFixLogic.Value) { return; } GameObject val = GameObject.Find("/Environment/HangarShip/Furniture(Clone)"); if (!((Object)(object)val != (Object)null)) { return; } AutoParentToShip[] componentsInChildren = val.GetComponentsInChildren(); AutoParentToShip[] array = componentsInChildren; foreach (AutoParentToShip val2 in array) { GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject.transform.parent != (Object)null && (Object)(object)gameObject.transform.parent == (Object)(object)val.transform) { NetworkObject component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { Transform val3 = null; component.TrySetParent(val3, true); ScienceBirdTweaks.Logger.LogDebug((object)("Un-parented furniture object " + ((Object)gameObject).name + "!")); } } } val.GetComponent().Despawn(true); Object.Destroy((Object)(object)val); } } [HarmonyPatch] public class FurniturePrefabPatches { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void FurnitureTagPatch(GameNetworkManager __instance) { //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.ApplianceInteractionFixes.Value) { return; } AutoParentToShip[] array = (from x in Resources.FindObjectsOfTypeAll() where x.unlockableID == 28 || x.unlockableID == 30 select x).ToArray(); AutoParentToShip[] array2 = array; foreach (AutoParentToShip val in array2) { Transform transform = ((Component)val).gameObject.transform; switch (val.unlockableID) { case 28: { Transform val5 = transform.Find("MicrowaveBody"); if ((Object)(object)val5 != (Object)null) { ((Component)val5).gameObject.layer = 8; } break; } case 30: { Transform[] array3 = (Transform[])(object)new Transform[2] { transform.Find("FridgeBody"), transform.Find("ObjectPlacements") }; if ((Object)(object)array3[0] != (Object)null) { Transform[] componentsInChildren = ((Component)array3[0]).GetComponentsInChildren(); foreach (Transform val2 in componentsInChildren) { if (((Object)((Component)val2).gameObject).name != "Cube" && ((Object)((Component)val2).gameObject).name != "FridgeMagnets (1)" && ((Component)val2).gameObject.layer != 9) { ((Component)val2).gameObject.layer = 8; } } } if (!((Object)(object)array3[1] != (Object)null)) { break; } Transform[] componentsInChildren2 = ((Component)array3[1]).GetComponentsInChildren(); foreach (Transform val3 in componentsInChildren2) { if (((Object)((Component)val3).gameObject).name.Contains("Cube") && Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent())) { BoxCollider component = ((Component)val3).gameObject.GetComponent(); BoxCollider val4 = ((Component)val3).gameObject.AddComponent(); ((Collider)val4).isTrigger = false; val4.center = component.center; val4.size = component.size; } } break; } } } } } [HarmonyPatch] internal static class KeepScrapPatches { public static bool _isInTargetContext; private static bool _isInsideResetShipFurnitureCall; public static bool extraLogs; public static void Initialize() { extraLogs = ScienceBirdTweaks.ExtraLogs.Value; string[] array = ScienceBirdTweaks.PreventedDespawnList.Value.Replace(" ", "").Split(","); DespawnPrevention.ClearBlacklist(); string[] array2 = array; foreach (string itemIdentifier in array2) { DespawnPrevention.AddToBlacklist(itemIdentifier); } string[] array3 = ScienceBirdTweaks.WorthlessDisplayTextBlacklist.Value.Replace(" ", "").Split(","); CustomScanText.ClearBlacklist(); string[] array4 = array3; foreach (string itemIdentifier2 in array4) { CustomScanText.AddToBlacklist(itemIdentifier2); } ScienceBirdTweaks.Logger.LogInfo((object)"Finished populating scrap keeping blacklists."); } [HarmonyPatch(typeof(StartOfRound), "ResetShipFurniture")] [HarmonyPrefix] private static void EnterResetShipContextPrefix() { if (!DespawnPrevention.IsBlacklistEmpty() || ScienceBirdTweaks.PreventWorthlessDespawn.Value) { _isInsideResetShipFurnitureCall = true; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)"Entered ResetShipFurniture Context."); } } } [HarmonyPatch(typeof(StartOfRound), "ResetShipFurniture")] [HarmonyFinalizer] private static void ExitResetShipContextFinalizer(Exception __exception) { _isInsideResetShipFurnitureCall = false; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)"Exited ResetShipFurniture Context."); } if (__exception != null) { ScienceBirdTweaks.Logger.LogError((object)$"Exception occurred within ResetShipFurniture: {__exception}"); } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] private static void EnterTargetDespawnContextPrefix() { if (((!DespawnPrevention.IsBlacklistEmpty() && ScienceBirdTweaks.UsePreventDespawnList.Value) || ScienceBirdTweaks.PreventWorthlessDespawn.Value) && !_isInsideResetShipFurnitureCall) { _isInTargetContext = true; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)"Entered Despawn Prevention Target Context."); } } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyFinalizer] private static void ExitTargetDespawnContextFinalizer(Exception __exception) { if ((DespawnPrevention.IsBlacklistEmpty() || !ScienceBirdTweaks.UsePreventDespawnList.Value) && !ScienceBirdTweaks.PreventWorthlessDespawn.Value) { return; } if (!_isInsideResetShipFurnitureCall) { _isInTargetContext = false; if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)"Exited Despawn Prevention Target Context."); } } if (__exception != null) { ScienceBirdTweaks.Logger.LogError((object)$"Exception occurred within DespawnPropsAtEndOfRound: {__exception}"); } } [HarmonyPatch(typeof(NetworkObject), "Despawn", new Type[] { typeof(bool) })] [HarmonyPrefix] private static bool CheckDespawnPreventionPrefix(NetworkObject __instance) { if (!_isInTargetContext) { return true; } if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) && (((Component)__instance).GetComponent().isInShipRoom || ((Component)__instance).GetComponent().isInElevator)) { return !DespawnPrevention.ShouldPreventDespawn(__instance); } return true; } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPostfix] private static void UpdateSubtextOnValueSet(GrabbableObject __instance, int setValueTo) { try { if (setValueTo > 0) { return; } switch (CustomScanText.DoSetSubtext(__instance)) { case 0: if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("DiscardItem Postfix: Conditions not met for item '" + ((Object)__instance).name + "', skipping custom text override.")); } break; case 1: ScienceBirdTweaks.Logger.LogDebug((object)"Setting subtext..."); CustomScanText.SetSubtext(__instance, ScienceBirdTweaks.CustomWorthlessDisplayText.Value); break; case 2: ScienceBirdTweaks.Logger.LogDebug((object)"Resetting subtext..."); CustomScanText.ResetSubtext(__instance); break; } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"Exception in SetScrapValue Postfix patch: {arg}"); } } [HarmonyPatch(typeof(GrabbableObject), "DiscardItemOnClient")] [HarmonyPostfix] private static void UpdateScanNodeSubtextOnValueDiscardLocal(GrabbableObject __instance) { if (ScienceBirdTweaks.CustomWorthlessDisplayText.Value == "") { return; } try { switch (CustomScanText.DoSetSubtext(__instance)) { case 0: if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("DiscardItem Postfix: Conditions not met for item '" + ((Object)__instance).name + "', skipping custom text override.")); } break; case 1: case 2: if (!__instance.itemProperties.syncDiscardFunction) { __instance.DiscardItemRpc(); } break; } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"Exception in DiscardItem Postfix patch: {arg}"); } } [HarmonyPatch(typeof(GrabbableObject), "DiscardItem")] [HarmonyPostfix] private static void UpdateScanNodeSubtextOnValueDiscard(GrabbableObject __instance) { if (ScienceBirdTweaks.CustomWorthlessDisplayText.Value == "") { return; } try { switch (CustomScanText.DoSetSubtext(__instance)) { case 0: if (extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("DiscardItem Postfix: Conditions not met for item '" + ((Object)__instance).name + "', skipping custom text override.")); } break; case 1: CustomScanText.SetSubtext(__instance, ScienceBirdTweaks.CustomWorthlessDisplayText.Value); break; case 2: CustomScanText.ResetSubtext(__instance); break; } } catch (Exception arg) { ScienceBirdTweaks.Logger.LogError((object)$"Exception in DiscardItem Postfix patch: {arg}"); } } } public static class CustomScanText { private static readonly HashSet _textBlacklist = new HashSet(); public static void AddToBlacklist(string itemIdentifier) { if (!string.IsNullOrEmpty(itemIdentifier)) { _textBlacklist.Add(itemIdentifier); if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("Added '" + itemIdentifier + "' to item text blacklist.")); } } } public static void ClearBlacklist() { _textBlacklist.Clear(); if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)"Cleared item text blacklist."); } } public static bool IsStaticallyBlacklisted(string? itemName) { if (string.IsNullOrEmpty(itemName)) { return false; } return _textBlacklist.Contains(itemName); } public static int DoSetSubtext(GrabbableObject targetObject) { if (ScienceBirdTweaks.CustomWorthlessDisplayText.Value == "") { return 0; } if (targetObject.scrapValue > 0 || (Object)(object)targetObject.itemProperties == (Object)null || !targetObject.itemProperties.isScrap) { if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + ((Object)targetObject).name + "' is not a valid zero value scrap item, skipping custom text override.")); } return 0; } if (!targetObject.isInShipRoom) { if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + ((Object)targetObject).name + "' is not in ship room, resetting custom text.")); } return 2; } if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + ((Object)targetObject).name + "' is in ship room, checking conditions for custom text override.")); } if (targetObject.isHeld && (Object)(object)targetObject.playerHeldBy != (Object)null && !targetObject.playerHeldBy.isInHangarShipRoom) { if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + ((Object)targetObject).name + "' is held outside ship, skipping custom text override.")); } return 0; } if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + ((Object)targetObject).name + "' is in ship, checking conditions for custom text override.")); } string text = targetObject.itemProperties?.itemName; if (!string.IsNullOrEmpty(text) && IsStaticallyBlacklisted(text)) { if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("SetScrapValue Postfix: Item '" + text + "' is statically blacklisted, skipping custom text override.")); } return 0; } return 1; } public static void SetSubtext(GrabbableObject targetObject, string customText) { ScanNodeProperties componentInChildren = ((Component)targetObject).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = customText; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("SetScrapValue Postfix: Applied custom text '" + customText + "' to ScanNode for '" + ((Object)targetObject).name + "'.")); } } } public static void ResetSubtext(GrabbableObject targetObject) { ScanNodeProperties componentInChildren = ((Component)targetObject).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = $"Value: ${targetObject.scrapValue}"; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("ResetSubtext: Cleared custom text for '" + ((Object)targetObject).name + "'.")); } } } } public static class DespawnPrevention { private static readonly HashSet _despawnBlacklist = new HashSet(); public static void AddToBlacklist(string itemIdentifier) { if (!string.IsNullOrEmpty(itemIdentifier)) { _despawnBlacklist.Add(itemIdentifier); if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("Added '" + itemIdentifier + "' to despawn blacklist.")); } } } public static void RemoveFromBlacklist(string itemIdentifier) { if (_despawnBlacklist.Remove(itemIdentifier) && KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("Removed '" + itemIdentifier + "' from despawn blacklist.")); } } public static void ClearBlacklist() { _despawnBlacklist.Clear(); if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)"Cleared despawn blacklist."); } } public static bool IsBlacklistEmpty() { return _despawnBlacklist.Count == 0; } public static bool IsStaticallyBlacklisted(string? itemName) { if (string.IsNullOrEmpty(itemName)) { return false; } return _despawnBlacklist.Contains(itemName); } public static bool ShouldPreventDespawn(NetworkObject networkObjectInstance) { if ((Object)(object)networkObjectInstance == (Object)null) { return false; } GrabbableObject component = ((Component)networkObjectInstance).GetComponent(); if ((Object)(object)component == (Object)null) { return false; } string text = component.itemProperties?.itemName; bool flag = (Object)(object)component.itemProperties != (Object)null && component.itemProperties.isScrap; int scrapValue = component.scrapValue; bool flag2 = component.isHeld && (Object)(object)component.playerHeldBy != (Object)null && component.playerHeldBy.isInHangarShipRoom; bool isInShipRoom = component.isInShipRoom; bool flag3 = false; bool flag4 = false; string value = ScienceBirdTweaks.CustomWorthlessDisplayText.Value; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)string.Format("Checking Despawn: Item='{0}', Name='{1}', Value=${2}, IsScrap={3}, IsHeld={4}, IsInShip={5}", text ?? "N/A", ((Object)component).name, scrapValue, flag, flag2, isInShipRoom)); } if (ScienceBirdTweaks.UsePreventDespawnList.Value && !string.IsNullOrEmpty(text) && _despawnBlacklist.Contains(text)) { flag3 = true; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Item '" + text + "' is on static blacklist.")); } } else if (ScienceBirdTweaks.PreventWorthlessDespawn.Value && flag && scrapValue <= 0) { flag3 = true; if (value != "") { flag4 = true; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Item '" + (text ?? ((Object)component).name) + "' is zero-value scrap and will have custom text applied.")); } } if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Item '" + (text ?? ((Object)component).name) + "' is zero-value scrap.")); } } else if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Item '" + (text ?? ((Object)component).name) + "' does not meet any protection criteria.")); } if (flag3) { if (flag2 || isInShipRoom) { ScienceBirdTweaks.Logger.LogDebug((object)("Preventing despawn for '" + (text ?? ((Object)component).name) + "' because it meets criteria AND is held or in ship.")); if (ScienceBirdTweaks.ZeroDespawnPreventedItems.Value && flag && scrapValue > 0) { if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)$"Attempting to set scrap value of '{text ?? ((Object)component).name}' to zero (Current: {scrapValue})..."); } component.SetScrapValue(0); } if (flag4) { ScanNodeProperties componentInChildren = ((Component)component).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = value; if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogInfo((object)("Applied custom text for '" + (text ?? ((Object)component).name) + "' to '" + value + "'.")); } } } return true; } if (KeepScrapPatches.extraLogs) { ScienceBirdTweaks.Logger.LogDebug((object)("Allowing despawn for '" + (text ?? ((Object)component).name) + "' because although it meets criteria, it is not held or in ship.")); } return false; } return false; } } [HarmonyPatch] public class MaskDropPatches { public static GameObject tragedyPrefab; public static GameObject comedyPrefab; public static GameObject oniPrefab; public static GameObject maskScriptPrefab; public static bool patchingMask; public static Dictionary maskBuffer; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializePrefab() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (ScienceBirdTweaks.DropMasks.Value && !ScienceBirdTweaks.ClientsideMode.Value) { maskScriptPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("MaskDropScript"); NetworkManager.Singleton.AddNetworkPrefab(maskScriptPrefab); } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void InitializeAssets(StartOfRound __instance) { if (ScienceBirdTweaks.DropMasks.Value && !ScienceBirdTweaks.ClientsideMode.Value) { FindMaskPrefabs(doOniCheck: true); maskBuffer = new Dictionary(); MaskDropScript.activeMasks = new List(); } } private static void FindMaskPrefabs(bool doOniCheck = false) { if ((Object)(object)tragedyPrefab == (Object)null) { GrabbableObject[] array = (from x in Resources.FindObjectsOfTypeAll() where x is HauntedMaskItem && (Object)(object)x.itemProperties != (Object)null && x.itemProperties.itemName == "Tragedy" select x).ToArray(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent()) && ((Component)val).gameObject.GetComponent().PrefabIdHash != 0) { ScienceBirdTweaks.Logger.LogDebug((object)"Found tragedy!"); tragedyPrefab = ((Component)val).gameObject; break; } } } if ((Object)(object)comedyPrefab == (Object)null) { GrabbableObject[] array3 = (from x in Resources.FindObjectsOfTypeAll() where x is HauntedMaskItem && (Object)(object)x.itemProperties != (Object)null && x.itemProperties.itemName == "Comedy" select x).ToArray(); GrabbableObject[] array4 = array3; foreach (GrabbableObject val2 in array4) { if (Object.op_Implicit((Object)(object)((Component)val2).gameObject.GetComponent()) && ((Component)val2).gameObject.GetComponent().PrefabIdHash != 0) { ScienceBirdTweaks.Logger.LogDebug((object)"Found comedy!"); comedyPrefab = ((Component)val2).gameObject; break; } } } if (!doOniCheck || !((Object)(object)oniPrefab == (Object)null)) { return; } GrabbableObject[] array5 = (from x in Resources.FindObjectsOfTypeAll() where x is HauntedMaskItem && (Object)(object)x.itemProperties != (Object)null && x.itemProperties.itemName == "OniMask" select x).ToArray(); GrabbableObject[] array6 = array5; foreach (GrabbableObject val3 in array6) { if (Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent()) && ((Component)val3).gameObject.GetComponent().PrefabIdHash != 0) { ScienceBirdTweaks.Logger.LogDebug((object)"Found oni!"); oniPrefab = ((Component)val3).gameObject; break; } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "KillEnemy")] [HarmonyPostfix] private static void OnMaskDeath(MaskedPlayerEnemy __instance, bool destroy) { //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.DropMasks.Value || !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponentInChildren()) || ScienceBirdTweaks.ClientsideMode.Value || destroy) { return; } GameObject gameObject = ((Component)(from x in ((Component)__instance).gameObject.GetComponentsInChildren() where ((Component)x).gameObject.activeInHierarchy select x).First()).gameObject; GameObject val = (Object.op_Implicit((Object)(object)gameObject.transform.Find("Mesh")) ? ((Component)gameObject.transform.Find("Mesh")).gameObject : null); if ((Object)(object)val == (Object)null && ((Object)gameObject).name == "HeadOni") { val = gameObject; } if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent() == (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)$"Null mesh! {val}"); return; } GameObject prefab = null; MaskDropScript maskDropScript = Object.FindObjectOfType(); if (((NetworkBehaviour)__instance).IsServer) { MeshRenderer component = val.GetComponent(); switch (((Object)((Renderer)component).material).name) { case "ComedyMaskMat (Instance)": FindMaskPrefabs(); prefab = comedyPrefab; break; case "TragedyMaskMat (Instance)": FindMaskPrefabs(); prefab = tragedyPrefab; break; case "oni (Instance)": FindMaskPrefabs(doOniCheck: true); prefab = oniPrefab; break; } if ((Object)(object)maskDropScript == (Object)null) { GameObject val2 = Object.Instantiate(maskScriptPrefab, Vector3.zero, Quaternion.identity); val2.GetComponent().Spawn(false); } } maskDropScript = Object.FindObjectOfType(); if ((Object)(object)maskDropScript != (Object)null) { maskDropScript.PrepareMaskDropCoroutine(prefab, val); } } [HarmonyPatch(typeof(HauntedMaskItem), "DiscardItem")] [HarmonyPrefix] private static bool MaskDropSyncClient(HauntedMaskItem __instance) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.DropMasks.Value || maskBuffer == null || (Object)(object)((Component)__instance).GetComponent() == (Object)null || ScienceBirdTweaks.ClientsideMode.Value) { return true; } if (patchingMask && (Object)(object)__instance.previousPlayerHeldBy == (Object)null && maskBuffer.TryGetValue((int)((Component)__instance).GetComponent().NetworkObjectId, out var value)) { MaskDropSync(__instance, (int)((Component)__instance).GetComponent().NetworkObjectId, value.Item1, value.Item2, value.Item3); return false; } return true; } public static void MaskDropSync(HauntedMaskItem maskGrabbable, int maskId, Vector3 targetPos, Quaternion targetRot, int scrapValue) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) ScienceBirdTweaks.Logger.LogDebug((object)$"Spawning mask with pos: {targetPos}, rot: {((Quaternion)(ref targetRot)).eulerAngles}"); ((Component)maskGrabbable).gameObject.transform.position = targetPos; ((Component)maskGrabbable).gameObject.transform.rotation = targetRot; ((GrabbableObject)maskGrabbable).fallTime = 1.1f; ((GrabbableObject)maskGrabbable).startFallingPosition = ((Component)maskGrabbable).gameObject.transform.position; ((GrabbableObject)maskGrabbable).targetFloorPosition = ((Component)maskGrabbable).gameObject.transform.position; ((GrabbableObject)maskGrabbable).hasHitGround = true; ((GrabbableObject)maskGrabbable).reachedFloorTarget = true; ((GrabbableObject)maskGrabbable).SetScrapValue(scrapValue); if (maskBuffer.Count <= 1) { patchingMask = false; } } [HarmonyPatch(typeof(HauntedMaskItem), "LateUpdate")] [HarmonyPostfix] private static void FixMaskPosition(HauntedMaskItem __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.DropMasks.Value && maskBuffer != null && !((Object)(object)((Component)__instance).GetComponent() == (Object)null) && !ScienceBirdTweaks.ClientsideMode.Value && (Object)(object)__instance.previousPlayerHeldBy == (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null && maskBuffer.TryGetValue((int)((Component)__instance).GetComponent().NetworkObjectId, out var value)) { ((Component)__instance).gameObject.transform.position = value.Item1; ((Component)__instance).gameObject.transform.rotation = value.Item2; } } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPrefix] private static void MaskPickup(PlayerControllerB __instance, bool grabValidated, NetworkObjectReference grabbedObject) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!(ScienceBirdTweaks.DropMasks.Value && grabValidated) || ScienceBirdTweaks.ClientsideMode.Value) { return; } NetworkObjectReference val = grabbedObject; NetworkObject val2 = default(NetworkObject); if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { return; } GrabbableObject component = ((Component)val2).GetComponent(); if (Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent()) && maskBuffer.TryGetValue((int)((Component)component).GetComponent().NetworkObjectId, out var _)) { ScienceBirdTweaks.Logger.LogDebug((object)$"Removing mask from buffer! {maskBuffer.Count}, {patchingMask}"); maskBuffer.Remove((int)((Component)component).GetComponent().NetworkObjectId); if (maskBuffer.Count <= 0) { patchingMask = false; } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetMaskGlow")] [HarmonyPrefix] private static bool SetGlowPrefix(MaskedPlayerEnemy __instance) { if (__instance.maskEyesGlow == null) { return false; } return true; } } [HarmonyPatch] public class MonitorPatches { public static bool inSetLineContext = false; public static Vector3 currentPos = Vector3.zero; public static List entrancePositions = new List(); [HarmonyPatch(typeof(StartOfRound), "SwitchMapMonitorPurpose")] [HarmonyPostfix] private static void DisplayInfoFix(StartOfRound __instance, bool displayInfo) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.LocalCam.Value) { if (ScienceBirdTweaks.TrueLocalCam.Value && !PlayerCamPatches.internalCamDisable && displayInfo) { PlayerCamPatches.SetCamBias(on: false, -100); } else if (ScienceBirdTweaks.TrueLocalCam.Value && PlayerCamPatches.internalCamDisable && !displayInfo && (Object)(object)__instance.mapScreen.targetedPlayer != (Object)null && (Object)(object)__instance.mapScreen.targetedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { PlayerCamPatches.SetCamBias(on: true, -100); } PlayerCamPatches.internalCamDisable = displayInfo; } if (ScienceBirdTweaks.MonitorTransitionFix.Value && displayInfo) { if ((Object)(object)__instance.currentLevel.videoReel == (Object)null) { __instance.screenLevelVideoReel.clip = __instance.currentLevel.videoReel; } ((Component)__instance.mapScreen.cam).transform.position = new Vector3(0f, 100f, 0f); __instance.mapScreen.mapCamera.nearClipPlane = -0.96f; __instance.mapScreen.mapCamera.farClipPlane = 7.52f; __instance.radarCanvas.planeDistance = -0.93f; FixVideoReelBG(__instance); } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnConnectionClients(StartOfRound __instance) { FixVideoReelBG(__instance); } [HarmonyPatch(typeof(StartOfRound), "ArriveAtLevel")] [HarmonyPostfix] private static void OnNewLevel(StartOfRound __instance) { FixVideoReelBG(__instance); } private static void FixVideoReelBG(StartOfRound round) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.LocalCam.Value) { if (!PlayerCamPatches.internalCamDisable && ScienceBirdTweaks.TrueLocalCam.Value) { PlayerCamPatches.SetCamBias(on: false, -100); } PlayerCamPatches.internalCamDisable = true; } if (!ScienceBirdTweaks.MonitorTransitionFix.Value || !((Object)(object)round.currentLevel != (Object)null) || !((Object)(object)round.currentLevel.videoReel != (Object)null)) { return; } float num = (float)round.currentLevel.videoReel.width / (float)round.currentLevel.videoReel.height; float num2 = 0.38f / (num * 0.2651163f) * 0.975f; GameObject gameObject = ((Component)round.screenLevelVideoReel).gameObject; if ((Object)(object)gameObject != (Object)null && (Object)(object)gameObject.transform.GetChild(0) != (Object)null) { RectTransform component = ((Component)gameObject.transform.GetChild(0)).GetComponent(); if ((Object)(object)component != (Object)null) { ((Transform)component).localScale = new Vector3(1f, num2, 1f); } } } [HarmonyPatch(typeof(RoundManager), "SetExitIDs")] [HarmonyPostfix] public static void EntranceSetup(RoundManager __instance) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.RadarPathAllExits.Value) { return; } entrancePositions.Clear(); entrancePositions = (from x in Object.FindObjectsOfType(false) where !x.isEntranceToBuilding select x.entrancePoint.position).ToList(); if (RoundManager.Instance.currentDungeonType == 4 && (Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)null) { Vector3 item = MyCollections.MaxBy((IEnumerable)entrancePositions, (Func)((Vector3 x) => x.y)); entrancePositions[entrancePositions.IndexOf(item)] = RoundManager.Instance.currentMineshaftElevator.elevatorBottomPoint.position; } } [HarmonyPatch(typeof(ManualCameraRenderer), "SetLineToExitFromRadarTarget")] [HarmonyPrefix] private static bool SetLinePrefix(ManualCameraRenderer __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.RadarPathAllExits.Value && __instance.screenEnabledOnLocalClient) { inSetLineContext = true; currentPos = ((Component)__instance.mapCamera).transform.position - Vector3.up * 3.75f; if (RoundManager.Instance.currentDungeonType == 4 && (Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)null) { SetLineReplacement(__instance); return false; } } return true; } [HarmonyPatch(typeof(ManualCameraRenderer), "SetLineToExitFromRadarTarget")] [HarmonyPostfix] private static void SetLinePostfix(ManualCameraRenderer __instance) { inSetLineContext = false; } private static void SetLineReplacement(ManualCameraRenderer cam) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) if (!cam.screenEnabledOnLocalClient || cam.playerIsInCaves) { ((Renderer)cam.lineFromRadarTargetToExit).enabled = false; return; } if (cam.targetedPlayer.isPlayerDead && ((Object)(object)cam.targetedPlayer.deadBody == (Object)null || !((Component)cam.targetedPlayer.deadBody).gameObject.activeSelf || cam.targetedPlayer.deadBody.isInShip || cam.targetedPlayer.deadBody.bodyParts[0].position.y > -50f)) { ((Renderer)cam.lineFromRadarTargetToExit).enabled = false; } if (!cam.targetedPlayer.isInsideFactory) { ((Renderer)cam.lineFromRadarTargetToExit).enabled = false; return; } ((Renderer)cam.lineFromRadarTargetToExit).enabled = true; if (cam.updateLineInterval > 0f) { cam.updateLineInterval -= Time.deltaTime; cam.dottedLineOffset -= Time.deltaTime; ((Renderer)cam.lineFromRadarTargetToExit).material.SetTextureOffset("_UnlitColorMap", new Vector2(cam.dottedLineOffset, 0f)); cam.lineFromRadarTargetToExit.SetPosition(0, ((Component)cam.mapCamera).transform.position - Vector3.up * 2.5f); return; } Vector3 val = Vector3.zero; Vector3 val2 = currentPos; float num = 1000000f; int num2 = -1; for (int i = 0; i < entrancePositions.Count; i++) { Vector3 val3 = val2 - entrancePositions[i]; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; num2 = i; } } if (num2 >= 0) { val = entrancePositions[num2]; } if (val == Vector3.zero || !NavMesh.CalculatePath(((Component)cam.mapCamera).transform.position - Vector3.up * 3.75f, val, -1, cam.path1)) { return; } if (cam.path1.corners.Length > 50) { cam.setLineIntervalTo = 2f; } else if (cam.path1.corners.Length < 36) { cam.setLineIntervalTo = 0.4f; } if (cam.path1.corners.Length != 0) { cam.lineFromRadarTargetToExit.positionCount = Mathf.Min(cam.path1.corners.Length, 20); for (int j = 0; j < cam.lineFromRadarTargetToExit.positionCount; j++) { ref Vector3 reference = ref cam.path1.corners[j]; reference += Vector3.up * 1.25f; } cam.lineFromRadarTargetToExit.SetPositions(cam.path1.corners); } cam.updateLineInterval = cam.setLineIntervalTo; } [HarmonyPatch(typeof(RoundManager), "FindMainEntrancePosition")] [HarmonyPostfix] private static void EntrancePosPatch(RoundManager __instance, ref Vector3 __result) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.RadarPathAllExits.Value || !inSetLineContext) { return; } inSetLineContext = false; Vector3 val = currentPos; float num = 1000000f; int num2 = -1; for (int i = 0; i < entrancePositions.Count; i++) { Vector3 val2 = val - entrancePositions[i]; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; num2 = i; } } if (num2 >= 0) { __result = entrancePositions[num2]; } } } [HarmonyPatch] public class MoonFixes { public static Material originalQuicksand; public static Material aquatisQuicksand; public static Material defaultTerrainHD; private static bool flag; private static bool done; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void OnStart(StartOfRound __instance) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown Material[] array = (from x in Resources.FindObjectsOfTypeAll() where ((Object)x).name == "DefaultHDTerrainMaterial" select x).ToArray(); if (array != null && array.Length != 0) { defaultTerrainHD = array.First(); } if (!ScienceBirdTweaks.ClientsideMode.Value) { aquatisQuicksand = (Material)ScienceBirdTweaks.TweaksAssets.LoadAsset("AquatisQuicksandTexture"); } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void OnLoad(StartOfRound __instance, string sceneName) { if (!ScienceBirdTweaks.ClientsideMode.Value && (Object)(object)originalQuicksand == (Object)null && (Object)(object)RoundManager.Instance != (Object)null) { DecalProjector componentInChildren = RoundManager.Instance.quicksandPrefab.GetComponentInChildren(); originalQuicksand = componentInChildren.material; } } [HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")] [HarmonyPrefix] [HarmonyPriority(0)] private static void ChangeOverride(RoundManager __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && (StartOfRound.Instance.currentLevel.PlanetName == "112 Aquatis" || StartOfRound.Instance.currentLevel.PlanetName == "2 Ganimedes" || StartOfRound.Instance.currentLevel.PlanetName == "43 Orion")) { flag = true; DecalProjector componentInChildren = __instance.quicksandPrefab.GetComponentInChildren(); componentInChildren.material = aquatisQuicksand; } } [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] [HarmonyPrefix] private static void TerrainFix(RoundManager __instance) { if (done) { return; } done = true; if (StartOfRound.Instance.currentLevel.PlanetName == "2 Ganimedes" && (Object)(object)defaultTerrainHD != (Object)null) { Terrain[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { array[i].materialTemplate = defaultTerrainHD; array[i].renderingLayerMask = 1797u; } } else if (StartOfRound.Instance.currentLevel.PlanetName == "85 Rend") { GameObject val = GameObject.Find("Environment/CompletedRendTerrain"); if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)val.GetComponent())) { ((Renderer)val.GetComponent()).renderingLayerMask = 1797u; } } } [HarmonyPatch(typeof(animatedSun), "Start")] [HarmonyPostfix] private static void OnStart(animatedSun __instance) { done = false; if (ScienceBirdTweaks.ForceSunShadows.Value && (Object)(object)TimeOfDay.Instance != (Object)null) { __instance.directLight.shadows = (LightShadows)1; } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] private static void EndOfRound(RoundManager __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && flag) { DecalProjector componentInChildren = __instance.quicksandPrefab.GetComponentInChildren(); componentInChildren.material = originalQuicksand; flag = false; } } } [HarmonyPatch] public class NullItemPatches { public static GameObject itemReplacementPrefab; public static float startTime; private static bool spawned; public static bool triggered; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void RegisterPrefab(StartOfRound __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (ScienceBirdTweaks.ReplaceNullItems.Value && !ScienceBirdTweaks.ClientsideMode.Value) { itemReplacementPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("SBTNullFixScript"); NetworkManager.Singleton.AddNetworkPrefab(itemReplacementPrefab); } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void SpawnScript(StartOfRound __instance) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.ReplaceNullItems.Value && !ScienceBirdTweaks.ClientsideMode.Value && ((NetworkBehaviour)__instance).IsServer && !Object.op_Implicit((Object)(object)GameObject.Find("SBTNullFixScript(Clone)"))) { GameObject val = Object.Instantiate(itemReplacementPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } [HarmonyPatch(typeof(StartOfRound), "ChangeLevel")] [HarmonyPostfix] private static void OnChangeLevel(StartOfRound __instance) { if (ScienceBirdTweaks.ReplaceNullItems.Value && !ScienceBirdTweaks.ClientsideMode.Value) { startTime = Time.realtimeSinceStartup; } } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPostfix] private static void FixInterval(StartOfRound __instance) { if (ScienceBirdTweaks.ReplaceNullItems.Value && !ScienceBirdTweaks.ClientsideMode.Value && startTime != 0f && Time.realtimeSinceStartup - startTime > 0.5f) { startTime = 0f; FixGrabbables(__instance); } } private static void FixGrabbables(StartOfRound round) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) GrabbableObject[] array = (from x in Object.FindObjectsOfType() where (Object)(object)x.itemProperties == (Object)null select x).ToArray(); if (array.Length == 0) { return; } if (((NetworkBehaviour)round).IsServer && !Object.op_Implicit((Object)(object)GameObject.Find("SBTNullFixScript(Clone)"))) { GameObject val = Object.Instantiate(itemReplacementPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } Dictionary brokenNameDict = new Dictionary(); GrabbableObject[] array2 = array; foreach (GrabbableObject val2 in array2) { string key = Regex.Replace(((Object)((Component)val2).gameObject).name, "\\(Clone\\)$", ""); brokenNameDict.Add(key, val2); } Item[] array3 = (from x in Resources.FindObjectsOfTypeAll() where (Object)(object)x.spawnPrefab != (Object)null && brokenNameDict.Keys.Contains(((Object)x.spawnPrefab).name) && x.spawnPrefab.GetComponent().PrefabIdHash != 0 select x).ToArray(); Item[] array4 = array3; foreach (Item val3 in array4) { if (!brokenNameDict.TryGetValue(((Object)val3.spawnPrefab).name, out GrabbableObject value)) { continue; } if (((NetworkBehaviour)round).IsServer) { Transform elevatorTransform = StartOfRound.Instance.elevatorTransform; GameObject val4 = Object.Instantiate(val3.spawnPrefab, ((Component)value).transform.position, Quaternion.identity); GrabbableObject component = val4.GetComponent(); component.itemUsedUp = value.itemUsedUp; int scrapValue = -1; if (component.itemProperties.isScrap) { scrapValue = value.scrapValue; component.SetScrapValue(scrapValue); } component.isInShipRoom = true; component.isInElevator = true; component.isInFactory = false; ((Component)component).gameObject.GetComponent().Spawn(false); ((Component)component).gameObject.transform.SetParent(elevatorTransform, true); Transform transform = ((Component)component).transform; transform.position += Vector3.up * 0.5f; BridgePatches.SetGrabbableFall(component); NullItemScript.Instance.SpawnReplacementObjectClientRpc(NetworkObjectReference.op_Implicit(((Component)component).gameObject.GetComponent()), scrapValue, ((Component)component).transform.position, component.startFallingPosition, component.targetFloorPosition, component.itemUsedUp, ((Component)component).transform.rotation, inShip: true, inElev: true, inFactory: false); } int num = -1; if ((value.isHeld || value.isPocketed) && (Object)(object)value.playerHeldBy != (Object)null) { num = Array.IndexOf(value.playerHeldBy.ItemSlots, value); if (num >= 0) { value.playerHeldBy.DestroyItemInSlot(num); } } else { Object.Destroy((Object)(object)((Component)value).gameObject); } brokenNameDict.Remove(((Object)val3.spawnPrefab).name); } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartTriggerReset(StartOfRound __instance) { triggered = false; } [HarmonyPatch(typeof(GrabbableObject), "Update")] [HarmonyPrefix] private static void ItemErrorDebug(GrabbableObject __instance) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.FixNaNColliders.Value && !triggered && !ScienceBirdTweaks.ClientsideMode.Value && IsInvalidTransform(((Component)__instance).transform)) { triggered = true; ScienceBirdTweaks.Logger.LogError((object)"-----------------------------------------------------------------"); ScienceBirdTweaks.Logger.LogError((object)("COLLIDER ERRORS DETECTED ON: " + ((Object)((Component)__instance).gameObject).name + " (path: " + GetObjectPath(((Component)__instance).gameObject) + ")")); ScienceBirdTweaks.Logger.LogError((object)"-----------------------------------------------------------------"); Collider[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren(); Collider[] array = componentsInChildren; foreach (Collider val in array) { ScienceBirdTweaks.Logger.LogWarning((object)$"Check for {GetObjectPath(((Component)val).gameObject)} - Transform corrupt: {IsInvalidTransform(((Component)val).gameObject.transform)}; Collider corrupt: {IsInvalidCollider(val)}"); } ScienceBirdTweaks.Logger.LogInfo((object)"Attempting fix..."); if ((Object)(object)NullItemScript.Instance != (Object)null) { NullItemScript.Instance.RequestReplacementObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } } } private static bool IsInvalidTransform(Transform itemTransform) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) return float.IsNaN(itemTransform.position.x) || float.IsInfinity(itemTransform.position.x) || float.IsNaN(itemTransform.position.y) || float.IsInfinity(itemTransform.position.y) || float.IsNaN(itemTransform.position.z) || float.IsInfinity(itemTransform.position.z) || float.IsNaN(itemTransform.localScale.x) || float.IsInfinity(itemTransform.localScale.x) || float.IsNaN(itemTransform.localScale.y) || float.IsInfinity(itemTransform.localScale.y) || float.IsNaN(itemTransform.localScale.z) || float.IsInfinity(itemTransform.localScale.z); } private static bool IsInvalidCollider(Collider itemCollider) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = itemCollider.bounds; int result; if (!float.IsNaN(((Bounds)(ref bounds)).max.x)) { bounds = itemCollider.bounds; if (!float.IsInfinity(((Bounds)(ref bounds)).max.x)) { bounds = itemCollider.bounds; if (!float.IsNaN(((Bounds)(ref bounds)).max.y)) { bounds = itemCollider.bounds; if (!float.IsInfinity(((Bounds)(ref bounds)).max.y)) { bounds = itemCollider.bounds; if (!float.IsNaN(((Bounds)(ref bounds)).max.z)) { bounds = itemCollider.bounds; if (!float.IsInfinity(((Bounds)(ref bounds)).max.z)) { bounds = itemCollider.bounds; if (!float.IsNaN(((Bounds)(ref bounds)).min.x)) { bounds = itemCollider.bounds; if (!float.IsInfinity(((Bounds)(ref bounds)).min.x)) { bounds = itemCollider.bounds; if (!float.IsNaN(((Bounds)(ref bounds)).min.y)) { bounds = itemCollider.bounds; if (!float.IsInfinity(((Bounds)(ref bounds)).min.y)) { bounds = itemCollider.bounds; if (!float.IsNaN(((Bounds)(ref bounds)).min.z)) { bounds = itemCollider.bounds; result = (float.IsInfinity(((Bounds)(ref bounds)).min.z) ? 1 : 0); goto IL_014f; } } } } } } } } } } } result = 1; goto IL_014f; IL_014f: return (byte)result != 0; } private static string GetObjectPath(GameObject obj) { StringBuilder stringBuilder = new StringBuilder(((Object)obj).name); Transform parent = obj.transform.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } } [HarmonyPatch] public class OccupancyPatch { public static List posterMats; public static int playerCount; public static void LoadAssets() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown posterMats = new List(); posterMats.Add(null); posterMats.Add(null); posterMats.Add(null); posterMats.Add(null); string text = ""; if (ScienceBirdTweaks.OccupancyScribble.Value) { text = "x"; } for (int i = 4; i <= 17; i++) { posterMats.Add((Material)ScienceBirdTweaks.TweaksAssets.LoadAsset($"Poster{i}" + text)); } } public static void UpdatePoster(StartOfRound round) { if (!ScienceBirdTweaks.DynamicOccupancySign.Value && ScienceBirdTweaks.OccupancyFixedValue.Value == "None") { return; } playerCount = round.connectedPlayersAmount + 1; GameObject val = GameObject.Find("HangarShip/Plane.001"); if ((Object)(object)val == (Object)null) { return; } Material[] materials = ((Renderer)val.GetComponent()).materials; if (ScienceBirdTweaks.OccupancyFixedValue.Value != "None") { if (ScienceBirdTweaks.OccupancyFixedValue.Value == "Infinite") { materials[0] = posterMats[17]; } else { int index = int.Parse(ScienceBirdTweaks.OccupancyFixedValue.Value); materials[0] = posterMats[index]; } } else if (playerCount > 4 && playerCount < 17) { materials[0] = posterMats[playerCount]; } else if (playerCount <= 4) { materials[0] = posterMats[4]; } else { materials[0] = posterMats[17]; } ((Renderer)val.GetComponent()).materials = materials; } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void OnInitialLoad(StartOfRound __instance) { UpdatePoster(__instance); } [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] [HarmonyPostfix] private static void OnConnectionServer(StartOfRound __instance) { UpdatePoster(__instance); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnConnectionClients(StartOfRound __instance) { UpdatePoster(__instance); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPostfix] private static void OnDisconnection(StartOfRound __instance) { UpdatePoster(__instance); } } [HarmonyPatch] public class PlayerCamPatches { private static bool setupDone = false; private static readonly Vector2[] textBoxSizes = (Vector2[])(object)new Vector2[5] { new Vector2(100f, 26f), new Vector2(100f, 36f), new Vector2(100f, 46f), new Vector2(100f, 56f), new Vector2(100f, 66f) }; public static float[] yOffsets = new float[1]; public static Dictionary nameShortcuts = new Dictionary(); public static List grabbedRadarTargets; public static int[] grabbedIndices = new int[1] { -1 }; public static TextMeshProUGUI[] nameText; public static Image[] nameBG; private static float camRotX = ScienceBirdTweaks.PlayerCamAngleX.Value; private static float camRotY = ScienceBirdTweaks.PlayerCamAngleY.Value; private static float camPosF = ScienceBirdTweaks.PlayerCamPosHorizontal.Value; private static float camPosY = ScienceBirdTweaks.PlayerCamPosVertical.Value; public static ManualCameraRenderer twoRadarCam; private static List radarCamData = new List(); public static bool internalCamDisable = false; private static bool alterPlayerCam = false; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void StartReset(StartOfRound __instance) { nameText = null; nameBG = null; twoRadarCam = null; setupDone = false; radarCamData.Clear(); } [HarmonyPatch(typeof(ManualCameraRenderer), "Start")] [HarmonyPostfix] private static void PlayerCamOverride(ManualCameraRenderer __instance) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.PlayerCamAngleX.Value != 0f || ScienceBirdTweaks.PlayerCamAngleY.Value != 0f || ScienceBirdTweaks.PlayerCamPosHorizontal.Value != 0f || ScienceBirdTweaks.PlayerCamPosVertical.Value != 0f) { alterPlayerCam = true; } if (ScienceBirdTweaks.LocalCam.Value && ScienceBirdTweaks.TrueLocalCam.Value && (Object)(object)__instance.cam == (Object)(object)__instance.mapCamera && (Object)(object)__instance.headMountedCam != (Object)null && !ScienceBirdTweaks.ClientsideMode.Value) { GameObject gameObject = ((Component)__instance.headMountedCam).gameObject; HDAdditionalCameraData component = gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { __instance.headMountedCam.cullingMask = 599463771; component.customRenderingSettings = true; FrameSettingsOverrideMask renderingPathCustomFrameSettingsOverrideMask = component.renderingPathCustomFrameSettingsOverrideMask; ((BitArray128)(ref renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true; ((BitArray128)(ref renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true; ((BitArray128)(ref renderingPathCustomFrameSettingsOverrideMask.mask))[62u] = true; ((BitArray128)(ref renderingPathCustomFrameSettingsOverrideMask.mask))[63u] = true; component.renderingPathCustomFrameSettingsOverrideMask = renderingPathCustomFrameSettingsOverrideMask; FrameSettings renderingPathCustomFrameSettings = component.renderingPathCustomFrameSettings; renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2; renderingPathCustomFrameSettings.lodBias = 0.5f; renderingPathCustomFrameSettings.maximumLODLevelMode = (MaximumLODLevelMode)2; renderingPathCustomFrameSettings.maximumLODLevel = 1; component.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; radarCamData.Add(component); } } } [HarmonyPatch(typeof(PlayerControllerB), "UpdateSpecialAnimationValue")] [HarmonyPrefix] private static void OnPlayerSpawn(PlayerControllerB __instance, bool specialAnimation) { if (ScienceBirdTweaks.LocalCam.Value && ScienceBirdTweaks.TrueLocalCam.Value && !setupDone && !specialAnimation && (Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController && !ScienceBirdTweaks.ClientsideMode.Value) { ((Component)__instance.thisPlayerModelArms).gameObject.layer = 5; LODGroup componentInChildren = ((Component)__instance.meshContainer).gameObject.GetComponentInChildren(); LOD[] lODs = componentInChildren.GetLODs(); ((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)3; ((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; lODs[0].renderers = (Renderer[])(object)new Renderer[1] { (Renderer)__instance.thisPlayerModelLOD1 }; lODs[1].renderers = (Renderer[])(object)new Renderer[1] { (Renderer)__instance.thisPlayerModel }; componentInChildren.SetLODs(lODs); setupDone = true; } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] private static void BeforePlayersRevive(RoundManager __instance) { setupDone = false; } public static void SetCamBias(bool on, int camIndex) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < radarCamData.Count; i++) { if ((i == camIndex || camIndex == -100) && (Object)(object)radarCamData[i] != (Object)null) { FrameSettings renderingPathCustomFrameSettings = radarCamData[i].renderingPathCustomFrameSettings; if (on) { renderingPathCustomFrameSettings.lodBias = 0.5f; renderingPathCustomFrameSettings.maximumLODLevel = 1; } else { renderingPathCustomFrameSettings.lodBias = 1f; renderingPathCustomFrameSettings.maximumLODLevel = 0; } radarCamData[i].renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; } } } [HarmonyPatch(typeof(StartOfRound), "SwitchMapMonitorPurpose")] [HarmonyPostfix] private static void OnRadarEnable(StartOfRound __instance, bool displayInfo) { if (ScienceBirdTweaks.zaggyPresent && (Object)(object)twoRadarCam == (Object)null) { twoRadarCam = ((Component)Object.FindObjectOfType()).GetComponent(); yOffsets = new float[2]; grabbedIndices = new int[2] { -1, -1 }; if (nameText == null || nameText.Length == 1) { GameObject val = GameObject.Find("GameSystems/ItemSystems/TerminalMapScreenUI/MonitoringPlayerUIContainer/PlayerBeingMonitored"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = val.GetComponent(); if ((Object)(object)component != (Object)null) { nameText = (TextMeshProUGUI[])(object)new TextMeshProUGUI[2] { StartOfRound.Instance.mapScreenPlayerName, component }; } } } if (nameBG == null || nameBG.Length == 1) { GameObject val2 = GameObject.Find("GameSystems/ItemSystems/TerminalMapScreenUI/MonitoringPlayerUIContainer/PlayerBeingMonitoredBG"); if ((Object)(object)val2 != (Object)null) { Image component2 = val2.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; nameBG = (Image[])(object)new Image[2] { StartOfRound.Instance.mapScreenPlayerNameBG, component2 }; } } } } if (nameText == null) { nameText = (TextMeshProUGUI[])(object)new TextMeshProUGUI[1] { StartOfRound.Instance.mapScreenPlayerName }; } if (nameBG == null) { nameBG = (Image[])(object)new Image[1] { StartOfRound.Instance.mapScreenPlayerNameBG }; } } public static void SetBoxPos(int index, bool withCam) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (nameText.Length == nameBG.Length) { ((Transform)((TMP_Text)nameText[index]).rectTransform).localPosition = new Vector3(-140f, (withCam ? (-8f) : (-100f)) + yOffsets[index], 0f); ((Transform)((Graphic)nameBG[index]).rectTransform).localPosition = new Vector3(-140f, (withCam ? (-8f) : (-100f)) + yOffsets[index], 1f); } } [HarmonyPatch(typeof(ManualCameraRenderer), "LateUpdate")] [HarmonyPostfix] private static void CamUpdate(ManualCameraRenderer __instance) { //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: 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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !((Object)(object)__instance.headMountedCam != (Object)null) || (Object)(object)__instance.cam != (Object)(object)__instance.mapCamera || nameText == null || (Object)(object)nameText[0] == (Object)null) { return; } int index = 0; if (ScienceBirdTweaks.zaggyPresent && (Object)(object)__instance == (Object)(object)twoRadarCam) { index = 1; if (nameText.Length <= 1 || (Object)(object)nameText[1] == (Object)null) { return; } } if (ScienceBirdTweaks.PlayerCamClipping.Value > 0f && __instance.headMountedCam.farClipPlane != 11f + ScienceBirdTweaks.PlayerCamClipping.Value) { __instance.headMountedCam.farClipPlane = 11f + ScienceBirdTweaks.PlayerCamClipping.Value; } if ((ScienceBirdTweaks.HideLocalCam.Value || ScienceBirdTweaks.HideAllCams.Value) && !StartOfRound.Instance.inShipPhase && (Object)(object)__instance.targetedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && !__instance.overrideRadarCameraOnAlways) { if ((Object)(object)__instance.localPlayerPlaceholder != (Object)null) { ((Behaviour)__instance.localPlayerPlaceholder).enabled = false; } if ((Object)(object)__instance.headMountedCamUI != (Object)null) { ((Behaviour)__instance.headMountedCamUI).enabled = false; SetBoxPos(index, withCam: false); } return; } if (ScienceBirdTweaks.HideAllCams.Value) { if ((Object)(object)__instance.headMountedCamUI != (Object)null) { ((Behaviour)__instance.headMountedCamUI).enabled = false; } SetBoxPos(index, withCam: false); return; } if (!internalCamDisable && ScienceBirdTweaks.LocalCam.Value && !ScienceBirdTweaks.ClientsideMode.Value && !ScienceBirdTweaks.HideAllCams.Value && !ScienceBirdTweaks.HideLocalCam.Value && !StartOfRound.Instance.inShipPhase && (Object)(object)__instance.targetedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.targetedPlayer.isPlayerDead && __instance.targetedPlayer.isPlayerControlled && !__instance.overrideRadarCameraOnAlways) { __instance.enableHeadMountedCam = true; if ((Object)(object)__instance.headMountedCamUI != (Object)null) { ((Behaviour)__instance.headMountedCamUI).enabled = true; } if ((Object)(object)__instance.localPlayerPlaceholder != (Object)null && ((Behaviour)__instance.localPlayerPlaceholder).enabled) { ((Behaviour)__instance.localPlayerPlaceholder).enabled = false; } if ((Object)(object)__instance.headMountedCamTarget != (Object)null) { ((Component)__instance.headMountedCam).transform.position = ((Component)__instance.headMountedCamTarget).transform.position + __instance.headMountedCamTarget.up * 0.237f + __instance.headMountedCamTarget.forward * 0.1f; ((Component)__instance.headMountedCam).transform.rotation = ((Component)__instance.headMountedCamTarget).transform.rotation; ((Component)__instance.headMountedCam).transform.Rotate(14.656f, -4.93f, 0f, (Space)1); if (__instance.targetedPlayer.isInsideFactory) { __instance.headMountedCamData.clearColorMode = (ClearColorMode)1; } else { __instance.headMountedCamData.clearColorMode = (ClearColorMode)0; } } } if (internalCamDisable || !__instance.enableHeadMountedCam || __instance.playerIsInCaves || !((Object)(object)__instance.headMountedCamTarget != (Object)null)) { return; } SetBoxPos(index, withCam: true); if (ScienceBirdTweaks.SprintCam.Value && (Object)(object)__instance.targetedPlayer != (Object)null) { if (!((Object)(object)__instance.targetedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) || !__instance.targetedPlayer.isSprinting) { AnimatorStateInfo currentAnimatorStateInfo = __instance.targetedPlayer.playerBodyAnimator.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("Sprinting")) { goto IL_04af; } } ((Component)__instance.headMountedCam).transform.Rotate(15f, 180f, 0f, (Space)1); Transform transform = ((Component)__instance.headMountedCam).transform; transform.position += __instance.headMountedCamTarget.up * -0.05f + __instance.headMountedCamTarget.forward * 0.3f; return; } goto IL_04af; IL_04af: if (alterPlayerCam) { ((Component)__instance.headMountedCam).transform.Rotate(camRotX, camRotY, 0f, (Space)1); Transform transform2 = ((Component)__instance.headMountedCam).transform; transform2.position += __instance.headMountedCamTarget.up * camPosY + __instance.headMountedCamTarget.forward * camPosF; } } [HarmonyPatch(typeof(ManualCameraRenderer), "SwitchRadarTargetClientRpc")] [HarmonyPrefix] public static void RadarTargets(ManualCameraRenderer __instance, int switchToIndex) { if (ScienceBirdTweaks.ImprovedTextBox.Value && (Object)(object)__instance.cam == (Object)(object)__instance.mapCamera && __instance.radarTargets != null && __instance.radarTargets.Count > 0) { grabbedRadarTargets = __instance.radarTargets; grabbedIndices[0] = switchToIndex; } } [HarmonyPatch(typeof(ManualCameraRenderer), "updateMapTarget")] [HarmonyPrefix] public static void UpdateMapTargetPrefix(ManualCameraRenderer __instance, int setRadarTargetIndex, bool calledFromRPC) { if (!ScienceBirdTweaks.LocalCam.Value || !ScienceBirdTweaks.TrueLocalCam.Value || ScienceBirdTweaks.ClientsideMode.Value || !((Object)(object)__instance.cam == (Object)(object)__instance.mapCamera) || __instance.radarTargets == null || __instance.radarTargets.Count <= 0) { return; } int num = setRadarTargetIndex; if (__instance.radarTargets.Count <= num) { num = __instance.radarTargets.Count - 1; } if (!calledFromRPC) { for (int i = 0; i < __instance.radarTargets.Count; i++) { if (__instance.radarTargets[num] == null) { num = (num + 1) % __instance.radarTargets.Count; continue; } PlayerControllerB component = ((Component)__instance.radarTargets[num].transform).gameObject.GetComponent(); if ((Object)(object)component == (Object)null || component.isPlayerControlled || component.isPlayerDead || (Object)(object)component.redirectToEnemy != (Object)null) { break; } num = (num + 1) % __instance.radarTargets.Count; } } if (__instance.targetTransformIndex == num) { return; } int targetTransformIndex = __instance.targetTransformIndex; if (targetTransformIndex == num || __instance.radarTargets[num] == null) { return; } if ((Object)(object)((Component)__instance.radarTargets[targetTransformIndex].transform).gameObject.GetComponent() == (Object)(object)GameNetworkManager.Instance.localPlayerController) { SetCamBias(on: false, ((Object)(object)__instance == (Object)(object)twoRadarCam) ? 1 : 0); return; } PlayerControllerB component2 = ((Component)__instance.radarTargets[num].transform).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2 == (Object)(object)GameNetworkManager.Instance.localPlayerController) { SetCamBias(on: true, ((Object)(object)__instance == (Object)(object)twoRadarCam) ? 1 : 0); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void UpdateMapTargetPatch(ManualCameraRenderer __instance, bool __result) { if (ScienceBirdTweaks.ImprovedTextBox.Value && !__result && !StartOfRound.Instance.inShipPhase && nameText != null) { NameBoxUpdate(); } } [HarmonyPatch(typeof(ManualCameraRenderer), "UpdateRadarTargetName")] [HarmonyPostfix] public static void RadarNameUpdatePatch(ManualCameraRenderer __instance) { if (ScienceBirdTweaks.ImprovedTextBox.Value && !StartOfRound.Instance.inShipPhase && nameText != null && (Object)(object)__instance.headMountedCam != (Object)null) { ScienceBirdTweaks.Logger.LogInfo((object)"NAME BOX SHOULD BE UPDATED"); grabbedRadarTargets = __instance.radarTargets; grabbedIndices[0] = __instance.targetTransformIndex; NameBoxUpdate(); } } public static void NameBoxUpdate() { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) ManualCameraRenderer[] array = (ManualCameraRenderer[])(object)new ManualCameraRenderer[1] { StartOfRound.Instance.mapScreen }; if ((Object)(object)twoRadarCam != (Object)null) { array = (ManualCameraRenderer[])(object)new ManualCameraRenderer[2] { StartOfRound.Instance.mapScreen, twoRadarCam }; } for (int i = 0; i < nameText.Length; i++) { if ((Object)(object)nameText[i] == (Object)null) { continue; } if (i == 1 && grabbedIndices[1] != array[1].targetTransformIndex) { grabbedIndices[1] = array[1].targetTransformIndex; } string text = "Player"; if (grabbedRadarTargets == null || grabbedIndices[i] < 0 || grabbedIndices[i] >= grabbedRadarTargets.Count || grabbedRadarTargets[grabbedIndices[i]] == null) { break; } text = grabbedRadarTargets[grabbedIndices[i]].name; string text2 = text; if (nameShortcuts.TryGetValue(text, out string value)) { text = value; } else { if (text.Length > 11) { string[] array2 = text.Split(" "); string[] array3 = array2; foreach (string text3 in array3) { if (text3.Length > 11) { string newValue = Regex.Replace(text3, "[A-Z]", " $0"); text2 = text.Replace(text3, newValue); } } } ScienceBirdTweaks.Logger.LogDebug((object)("Assigning shortcut: " + text + " > " + text2)); nameShortcuts.Add(text, text2); } int num = Mathf.Clamp(Mathf.FloorToInt((float)text.Length / 11f), 0, 4); ((TMP_Text)nameText[i]).fontSizeMin = 15f; ((TMP_Text)nameText[i]).lineSpacing = -9.6f; ((TMP_Text)nameText[i]).text = text; if ((Object)(object)((TMP_Text)nameText[i]).rectTransform == (Object)null || (Object)(object)((Graphic)nameBG[i]).rectTransform == (Object)null) { break; } ((TMP_Text)nameText[i]).rectTransform.sizeDelta = textBoxSizes[num]; ((Graphic)nameBG[i]).rectTransform.sizeDelta = textBoxSizes[num]; yOffsets[i] = (textBoxSizes[num].y - 26f) / 2f; } } } [HarmonyPatch] public class PlayerDeathPatches { public static AudioClip globalDeathSFX; public static AudioClip HUDWarning; public static GameObject questionMark; public static ShipTeleporter teleporter; public static AutoTeleportScript teleportScript; public static List usedPlayerIDs = new List(); public static float startTime = 0f; public static GameObject teleportScriptPrefab; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializeAssets() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (!ScienceBirdTweaks.ClientsideMode.Value && ScienceBirdTweaks.PlayGlobalDeathSFX.Value) { globalDeathSFX = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("GlobalDeathSound"); } if (!ScienceBirdTweaks.ClientsideMode.Value && (ScienceBirdTweaks.UnrecoverableNotification.Value || ScienceBirdTweaks.AutoTeleportBody.Value || ScienceBirdTweaks.PlayGlobalDeathSFX.Value)) { HUDWarning = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("HUDWarningSFX"); questionMark = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("QuestionMarkObj"); teleportScriptPrefab = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("AutoTeleportScript"); NetworkManager.Singleton.AddNetworkPrefab(teleportScriptPrefab); } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void SpawnTeleportScript(StartOfRound __instance, string sceneName) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.ClientsideMode.Value && (ScienceBirdTweaks.AutoTeleportBody.Value || ScienceBirdTweaks.UnrecoverableNotification.Value || ScienceBirdTweaks.PlayGlobalDeathSFX.Value) && (Object)(object)teleportScript == (Object)null && ((NetworkBehaviour)__instance).IsServer) { GameObject val = Object.Instantiate(teleportScriptPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); teleportScript = val.GetComponent(); } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")] [HarmonyPostfix] private static void OnPlayerDeath(PlayerControllerB __instance, int playerId) { if (ScienceBirdTweaks.ClientsideMode.Value || (!ScienceBirdTweaks.AutoTeleportBody.Value && !ScienceBirdTweaks.PlayGlobalDeathSFX.Value && !ScienceBirdTweaks.UnrecoverableNotification.Value) || usedPlayerIDs.Contains(playerId)) { return; } usedPlayerIDs.Add(playerId); startTime = Time.realtimeSinceStartup; if ((ScienceBirdTweaks.AutoTeleportBody.Value || ScienceBirdTweaks.PlayGlobalDeathSFX.Value) && (Object)(object)teleportScript == (Object)null) { teleportScript = Object.FindObjectOfType(); } if (ScienceBirdTweaks.PlayGlobalDeathSFX.Value) { teleportScript.StartSFXRoutine(playerId); } if (!ScienceBirdTweaks.AutoTeleportBody.Value || !ShipTeleporter.hasBeenSpawnedThisSession) { return; } if ((Object)(object)teleporter == (Object)null) { ShipTeleporter[] array = (from x in Object.FindObjectsOfType() where !x.isInverseTeleporter select x).ToArray(); if (array.Length != 0) { teleporter = array.First(); } } if ((Object)(object)teleporter != (Object)null) { teleportScript.StartTeleportRoutine(teleporter, playerId); } } [HarmonyPatch(typeof(RoundManager), "Update")] [HarmonyPostfix] private static void ClearListAfterTime(RoundManager __instance) { if (startTime != 0f && Time.realtimeSinceStartup - startTime > 5f) { startTime = 0f; usedPlayerIDs.Clear(); } } [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] private static void ClearListOnRevive(StartOfRound __instance) { usedPlayerIDs.Clear(); if ((Object)(object)teleportScript != (Object)null) { teleportScript.playerQueue.Clear(); } } [HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")] [HarmonyPostfix] private static void OnBeamUp(PlayerControllerB __instance) { PlayerControllerB __instance2 = __instance; if (ScienceBirdTweaks.ClientsideMode.Value || !ScienceBirdTweaks.UnrecoverableNotification.Value || !ShipTeleporter.hasBeenSpawnedThisSession || !__instance2.isPlayerDead || StartOfRound.Instance.inShipPhase || __instance2.shipTeleporterId == -1) { return; } if ((Object)(object)teleporter == (Object)null) { ShipTeleporter[] array = (from x in Object.FindObjectsOfType() where !x.isInverseTeleporter select x).ToArray(); if (array.Length != 0) { teleporter = array.First(); } } if ((Object)(object)teleporter != (Object)null && Array.Exists(teleporter.playersBeingTeleported, (int x) => x == (int)__instance2.playerClientId)) { if ((Object)(object)teleportScript == (Object)null) { teleportScript = Object.FindObjectOfType(); } if ((Object)(object)teleportScript != (Object)null) { teleportScript.DisplayBoxAfterCheck((int)__instance2.playerClientId); } } } } [HarmonyPatch] public class PlayerPatches { [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPostfix] private static void OnDamaged(PlayerControllerB __instance) { if (ScienceBirdTweaks.CrouchDamageAnimation.Value && (Object)(object)__instance.playerBodyAnimator != (Object)null && (__instance.playerBodyAnimator.GetBool("crouching") || __instance.isCrouching)) { __instance.playerBodyAnimator.ResetTrigger("Damage"); } } [HarmonyPatch(typeof(PlayerControllerB), "SetObjectAsNoLongerHeld")] [HarmonyPostfix] private static void OnDrop(PlayerControllerB __instance) { if (ScienceBirdTweaks.ZeroWeightCheck.Value && __instance.ItemSlots.All((GrabbableObject x) => (Object)(object)x == (Object)null) && (Object)(object)__instance.ItemOnlySlot == (Object)null && __instance.carryWeight != 1f) { ScienceBirdTweaks.Logger.LogDebug((object)"Weight detected with no items in inventory! Resetting weight."); __instance.carryWeight = 1f; if (__instance.enemiesOnPerson > 0) { __instance.carryWeight += 0.03f * (float)__instance.enemiesOnPerson; } } } } [HarmonyPatch] public class RemoveShipObjectsPatches { private static void DestroyObject(string objectString, bool soft = false) { GameObject val = GameObject.Find("/Environment/HangarShip/" + objectString); if ((Object)(object)val != (Object)null) { if (soft) { val.SetActive(false); } else { Object.Destroy((Object)(object)val); } } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void OnInitialLoad(StartOfRound __instance) { TryRemovals(); } [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] [HarmonyPostfix] private static void OnConnectionServer(StartOfRound __instance) { TryRemovals(); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnConnectionClients(StartOfRound __instance) { TryRemovals(); } private static void TryRemovals() { if (ScienceBirdTweaks.RemoveClipboard.Value) { DestroyObject("ClipboardManual"); } if (ScienceBirdTweaks.RemoveStickyNote.Value) { DestroyObject("StickyNoteItem"); } if (ScienceBirdTweaks.RemoveLongTube.Value) { DestroyObject("BezierCurve"); } if (ScienceBirdTweaks.RemoveGenerator.Value) { DestroyObject("DoorGenerator"); } if (ScienceBirdTweaks.RemoveHelmet.Value) { DestroyObject("ScavengerModelSuitParts/Circle.001"); } if (ScienceBirdTweaks.RemoveOxygenTanks.Value) { DestroyObject("ScavengerModelSuitParts/Circle.002"); } if (ScienceBirdTweaks.RemoveBoots.Value) { DestroyObject("ScavengerModelSuitParts/Circle.004"); } if (ScienceBirdTweaks.RemoveAirFilter.Value) { DestroyObject("ShipModels2b/AirFilterThing"); } if (ScienceBirdTweaks.RemoveMonitorWires.Value) { DestroyObject("WallCords"); } if (ScienceBirdTweaks.RemoveBatteries.Value) { DestroyObject("SmallDetails/BatteryPack"); DestroyObject("SmallDetails/BatterySingle"); DestroyObject("SmallDetails/BatterySingle (1)"); DestroyObject("SmallDetails/BatterySingle (2)"); } if (ScienceBirdTweaks.RemoveExteriorCam.Value) { GameObject val = GameObject.Find("/Environment/HangarShip/Cameras/FrontDoorSecurityCam"); if ((Object)(object)val != (Object)null) { MeshRenderer component = val.GetComponent(); Camera componentInChildren = val.GetComponentInChildren(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = false; } } } if (ScienceBirdTweaks.RemoveInteriorCam.Value) { GameObject val2 = GameObject.Find("/Environment/HangarShip/ShipModels2b/MonitorWall/Cube"); if ((Object)(object)val2 != (Object)null) { MeshRenderer component2 = val2.GetComponent(); if (((Renderer)component2).sharedMaterials.Length == 3) { Material[] materials = ((Renderer)component2).materials; materials[2] = materials[1]; ((Renderer)component2).materials = materials; } } } if (!ScienceBirdTweaks.RemoveDoorMonitor.Value) { return; } GameObject val3 = GameObject.Find("/Environment/HangarShip/ShipModels2b/MonitorWall/SingleScreen"); if ((Object)(object)val3 != (Object)null) { MeshRenderer component3 = val3.GetComponent(); Light componentInChildren2 = val3.GetComponentInChildren(); if ((Object)(object)component3 != (Object)null) { ((Renderer)component3).enabled = false; } if ((Object)(object)componentInChildren2 != (Object)null) { ((Behaviour)componentInChildren2).enabled = false; } } } } [HarmonyPatch] public class ScanHighlightPatches { public static List scanned = new List(); public static Dictionary highlights = new Dictionary(); public static Material greenHologramMat; public static Material greenHologramMat0; public static Material greenHologramMat1; public static Material greenHologramMat2; public static Material greenHologramMat3; public static Material greenHologramMat4; public static Material blueHologramMat; public static Material blueHologramMat0; public static Material blueHologramMat1; public static Material blueHologramMat2; public static Material blueHologramMat3; public static Material blueHologramMat4; private static bool fullEffect = false; private static readonly HashSet keepTypes = new HashSet { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer) }; private static readonly HashSet disableTypes = new HashSet { typeof(AudioSource), typeof(Light), typeof(HDAdditionalLightData), typeof(SkinnedMeshRenderer), typeof(Animator) }; private static readonly Vector3 scaleFactorUp = new Vector3(1.02f, 1.02f, 1.02f); private static readonly Vector3 scaleFactorDown = new Vector3(0.960784f, 0.960784f, 0.960784f); [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] [HarmonyPrefix] private static void OnGrabItem(GrabbableObject __instance) { if (!(ScienceBirdTweaks.ScanHighlights.Value == "Disabled")) { GameObject value2; if (!ScienceBirdTweaks.test2Present && highlights.TryGetValue(__instance, out GameObject value)) { Object.Destroy((Object)(object)value); scanned.Remove(__instance); highlights.Remove(__instance); } else if (ScienceBirdTweaks.test2Present && GoodItemScanPatches.highlights.TryGetValue(__instance, out value2)) { Object.Destroy((Object)(object)value2); GoodItemScanPatches.scanned.Remove(__instance); GoodItemScanPatches.highlights.Remove(__instance); } } } [HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")] [HarmonyPrefix] private static void PutItemInBeltBag(BeltBagItem __instance, GrabbableObject gObject) { if (!(ScienceBirdTweaks.ScanHighlights.Value == "Disabled") && !((Object)(object)gObject == (Object)null)) { GameObject value2; if (!ScienceBirdTweaks.test2Present && highlights.TryGetValue(gObject, out GameObject value)) { Object.Destroy((Object)(object)value); scanned.Remove(gObject); highlights.Remove(gObject); } else if (ScienceBirdTweaks.test2Present && GoodItemScanPatches.highlights.TryGetValue(gObject, out value2)) { Object.Destroy((Object)(object)value2); GoodItemScanPatches.scanned.Remove(gObject); GoodItemScanPatches.highlights.Remove(gObject); } } } [HarmonyPatch(typeof(QuickMenuManager), "Start")] [HarmonyPostfix] private static void MaterialSetupOnStart(QuickMenuManager __instance) { if (!(ScienceBirdTweaks.ScanHighlights.Value == "Disabled") && (Object)(object)HUDManager.Instance != (Object)null) { MaterialSetup(HUDManager.Instance.hologramMaterial, 0); MaterialSetup(HUDManager.Instance.hologramMaterial, 1); } } public static void MaterialSetup(Material holoMat, int index) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0082: 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_009e: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown switch (index) { case 0: { fullEffect = ScienceBirdTweaks.ScanHighlights.Value == "Enabled (Full)"; Texture2D val8 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex"); Texture2D val9 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex0"); Texture2D val10 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex1"); Texture2D val11 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex2"); Texture2D val12 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex3"); Texture2D val13 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTex4"); greenHologramMat = new Material(holoMat); greenHologramMat.SetVector("_MainColor", new Vector4(0f, 0f, 0f, 0f)); greenHologramMat.SetVector("_FresnelColor", new Vector4(0f, 0f, 0f, 0f)); LocalKeyword val14 = default(LocalKeyword); ((LocalKeyword)(ref val14))..ctor(greenHologramMat.shader, "_DISABLE_SSR_TRANSPARENT"); bool flag2 = true; greenHologramMat.SetLocalKeyword(val14, false); greenHologramMat.SetFloat("_ScrollSpeed", 0.04f); greenHologramMat.SetTexture("_HologramScanlines", (Texture)(object)val8); if (fullEffect) { greenHologramMat0 = new Material(greenHologramMat); greenHologramMat0.SetTexture("_HologramScanlines", (Texture)(object)val9); greenHologramMat1 = new Material(greenHologramMat); greenHologramMat1.SetTexture("_HologramScanlines", (Texture)(object)val10); greenHologramMat2 = new Material(greenHologramMat); greenHologramMat2.SetTexture("_HologramScanlines", (Texture)(object)val11); greenHologramMat3 = new Material(greenHologramMat); greenHologramMat3.SetTexture("_HologramScanlines", (Texture)(object)val12); greenHologramMat4 = new Material(greenHologramMat); greenHologramMat4.SetTexture("_HologramScanlines", (Texture)(object)val13); } else { greenHologramMat0 = greenHologramMat; } break; } case 1: { fullEffect = ScienceBirdTweaks.ScanHighlights.Value == "Enabled (Full)"; Texture2D val = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue"); Texture2D val2 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue0"); Texture2D val3 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue1"); Texture2D val4 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue2"); Texture2D val5 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue3"); Texture2D val6 = (Texture2D)ScienceBirdTweaks.TweaksAssets.LoadAsset("HologramTexBlue4"); blueHologramMat = new Material(holoMat); blueHologramMat.SetVector("_MainColor", new Vector4(0f, 0f, 0f, 0f)); blueHologramMat.SetVector("_FresnelColor", new Vector4(0f, 0f, 0f, 0f)); LocalKeyword val7 = default(LocalKeyword); ((LocalKeyword)(ref val7))..ctor(blueHologramMat.shader, "_DISABLE_SSR_TRANSPARENT"); bool flag = true; blueHologramMat.SetLocalKeyword(val7, false); blueHologramMat.SetFloat("_ScrollSpeed", 0.04f); blueHologramMat.SetTexture("_HologramScanlines", (Texture)(object)val); if (fullEffect) { blueHologramMat0 = new Material(blueHologramMat); blueHologramMat0.SetTexture("_HologramScanlines", (Texture)(object)val2); blueHologramMat1 = new Material(blueHologramMat); blueHologramMat1.SetTexture("_HologramScanlines", (Texture)(object)val3); blueHologramMat2 = new Material(blueHologramMat); blueHologramMat2.SetTexture("_HologramScanlines", (Texture)(object)val4); blueHologramMat3 = new Material(blueHologramMat); blueHologramMat3.SetTexture("_HologramScanlines", (Texture)(object)val5); blueHologramMat4 = new Material(blueHologramMat); blueHologramMat4.SetTexture("_HologramScanlines", (Texture)(object)val6); } else { blueHologramMat0 = blueHologramMat; } break; } } } [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")] [HarmonyPostfix] private static void OnScanUpdate(HUDManager __instance) { if (!(ScienceBirdTweaks.ScanHighlights.Value == "Disabled") && !ScienceBirdTweaks.test2Present) { if ((Object)(object)greenHologramMat == (Object)null) { MaterialSetup(__instance.hologramMaterial, 0); } if ((Object)(object)blueHologramMat == (Object)null) { MaterialSetup(__instance.hologramMaterial, 1); } List collection = ComputeNewScannedObjects(highlights, scanned, __instance.scanNodes.Values.ToList()); scanned = new List(collection); } } public static List ComputeNewScannedObjects(Dictionary highlightDict, List scannedObjects, List scanNodeList) { List list = new List(); foreach (ScanNodeProperties scanNode in scanNodeList) { if ((Object)(object)scanNode == (Object)null) { continue; } GameObject gameObject = ((Component)scanNode).gameObject; GrabbableObject componentInParent = gameObject.GetComponentInParent(); while ((Object)(object)componentInParent == (Object)null && (Object)(object)gameObject.transform.parent != (Object)null) { gameObject = ((Component)gameObject.transform.parent).gameObject; componentInParent = gameObject.GetComponentInParent(); } if (!((Object)(object)componentInParent != (Object)null) || Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponentInChildren()) || ((Object)(object)componentInParent.itemProperties != (Object)null && (componentInParent.itemProperties.itemId == 16 || componentInParent.itemProperties.itemId == 5 || componentInParent.itemProperties.itemId == 4 || componentInParent.itemProperties.itemName == "Hypercube"))) { continue; } if (!scannedObjects.Contains(componentInParent)) { bool blue = false; if (scanNode.nodeType == 0) { blue = true; } GameObject value = DuplicateRenderersWithMaterial(((Component)componentInParent).gameObject, blue); highlightDict.Add(componentInParent, value); } list.Add(componentInParent); } List list2 = scannedObjects.Except(list).ToList(); if (list2.Count > 0) { for (int i = 0; i < list2.Count; i++) { if (highlightDict.TryGetValue(list2[i], out GameObject value2)) { Object.Destroy((Object)(object)value2); highlightDict.Remove(list2[i]); } } } return list; } public static GameObject DuplicateRenderersWithMaterial(GameObject sourceObject, bool blue) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(sourceObject, sourceObject.transform.position, sourceObject.transform.rotation, sourceObject.transform.parent); ((Object)val).name = ((Object)sourceObject).name + "_ScanMesh"; Component[] componentsInChildren = val.GetComponentsInChildren(true); Component[] array = componentsInChildren; foreach (Component val2 in array) { if (!((Object)(object)val2 != (Object)null) || keepTypes.Contains(((object)val2).GetType())) { continue; } GrabbableObject val3 = (GrabbableObject)(object)((val2 is GrabbableObject) ? val2 : null); if (val3 != null) { val3.radarIcon = null; } if (disableTypes.Contains(((object)val2).GetType())) { Behaviour val4 = (Behaviour)(object)((val2 is Behaviour) ? val2 : null); if (val4 != null) { val4.enabled = false; continue; } } Object.DestroyImmediate((Object)(object)val2); } Renderer[] componentsInChildren2 = val.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren2.Length; j++) { if (((Component)componentsInChildren2[j]).gameObject.layer != 22) { Material[] array2 = (Material[])(object)new Material[componentsInChildren2[j].materials.Length]; for (int k = 0; k < array2.Length; k++) { array2[k] = (blue ? blueHologramMat0 : greenHologramMat0); } componentsInChildren2[j].materials = array2; } } val.transform.localScale = Vector3.Scale(val.transform.localScale, scaleFactorUp); Renderer[] array3 = componentsInChildren2; if (fullEffect) { GameObject val5 = Object.Instantiate(val, val.transform.position, val.transform.rotation, val.transform); val5.transform.localScale = scaleFactorDown; array3 = val5.GetComponentsInChildren(); for (int l = 0; l < array3.Length; l++) { if (((Component)array3[l]).gameObject.layer != 22) { Material[] array4 = (Material[])(object)new Material[array3[l].materials.Length]; for (int m = 0; m < array4.Length; m++) { array4[m] = (blue ? blueHologramMat0 : greenHologramMat0); } array3[l].materials = array4; } } } ScanHighlight scanHighlight = val.AddComponent(); scanHighlight.full = fullEffect; scanHighlight.parentTransform = sourceObject.transform; scanHighlight.renderers = componentsInChildren2; scanHighlight.extraRenderers = array3; scanHighlight.blue = blue; return val; } } [HarmonyPatch] public class ScrapListPatches { public static List itemsToMute = new List(); public static List animatedItemList = new List(); public static List itemDayBlacklist = new List(); [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void MuteItems(GameNetworkManager __instance) { if (ScienceBirdTweaks.SingleItemBlacklist.Value != "") { itemDayBlacklist = ScienceBirdTweaks.SingleItemBlacklist.Value.Replace(", ", ",").Split(",").ToList(); itemDayBlacklist = itemDayBlacklist.ConvertAll((string x) => x.ToLower()); ScienceBirdTweaks.Logger.LogDebug((object)"Setting single item blacklist!"); } if (!(ScienceBirdTweaks.MuteScrapList.Value != "")) { return; } itemsToMute = ScienceBirdTweaks.MuteScrapList.Value.Replace(", ", ",").Split(",").ToList(); itemsToMute = itemsToMute.ConvertAll((string x) => x.ToLower()); ScienceBirdTweaks.Logger.LogDebug((object)"Muting items!"); MuteAnimated(); MutePeriodic(); if (itemsToMute.Contains("clock")) { itemsToMute.Remove("clock"); MuteClock(); } if (itemsToMute.Contains("heart")) { itemsToMute.Remove("heart"); MuteHeart(); } foreach (string item in itemsToMute) { Item[] array = Resources.FindObjectsOfTypeAll(); Item[] array2 = array; foreach (Item val in array2) { if (val.itemName.ToLower() == item && (Object)(object)val.spawnPrefab != (Object)null) { AudioSource[] componentsInChildren = val.spawnPrefab.GetComponentsInChildren(); AudioSource[] array3 = componentsInChildren; foreach (AudioSource val2 in array3) { val2.loop = false; } } } } } public static void MuteAnimated() { AnimatedItem[] array = Resources.FindObjectsOfTypeAll(); AnimatedItem[] array2 = array; foreach (AnimatedItem val in array2) { if (itemsToMute.Contains(((GrabbableObject)val).itemProperties.itemName.ToLower())) { animatedItemList.Add(((GrabbableObject)val).itemProperties.itemName.ToLower()); val.grabAudio = null; val.dropAudio = null; val.noiseLoudness = 0f; val.noiseRange = 0f; itemsToMute.Remove(((GrabbableObject)val).itemProperties.itemName.ToLower()); } } } public static void MutePeriodic() { RandomPeriodicAudioPlayer[] array = (from x in Resources.FindObjectsOfTypeAll() where Object.op_Implicit((Object)(object)((Component)x).gameObject.GetComponent()) && itemsToMute.Contains(((Component)x).gameObject.GetComponent().itemProperties.itemName.ToLower()) select x).ToArray(); RandomPeriodicAudioPlayer[] array2 = array; foreach (RandomPeriodicAudioPlayer val in array2) { val.audioChancePercent = 0f; itemsToMute.Remove(((Component)val).gameObject.GetComponent().itemProperties.itemName.ToLower()); } } public static void MuteClock() { ClockProp[] array = Resources.FindObjectsOfTypeAll(); ClockProp[] array2 = array; foreach (ClockProp val in array2) { val.tickAudio.volume = 0f; } } public static void MuteHeart() { LoopShapeKey[] array = Resources.FindObjectsOfTypeAll(); LoopShapeKey[] array2 = array; foreach (LoopShapeKey val in array2) { AudioSource repeatingAudioSource = val.repeatingAudioSource; if ((Object)(object)repeatingAudioSource != (Object)null) { repeatingAudioSource.mute = true; } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void AnimatedItemExtraCheck(StartOfRound __instance, string sceneName) { if (ScienceBirdTweaks.MuteScrapList.Value == "" || !(sceneName == "SampleSceneRelay")) { return; } AnimatedItem[] array = Resources.FindObjectsOfTypeAll(); AnimatedItem[] array2 = array; foreach (AnimatedItem val in array2) { if (animatedItemList.Contains(((GrabbableObject)val).itemProperties.itemName.ToLower()) && ((Object)(object)val.grabAudio != (Object)null || (Object)(object)val.dropAudio != (Object)null || val.noiseLoudness != 0f || val.noiseRange != 0f)) { ScienceBirdTweaks.Logger.LogDebug((object)"Fixing animated item!"); val.grabAudio = null; val.dropAudio = null; val.noiseLoudness = 0f; val.noiseRange = 0f; } } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPrefix] private static void ScrapGenerationPrefix(RoundManager __instance) { if (ScienceBirdTweaks.SingleItemBlacklist.Value == "" || itemDayBlacklist.Count <= 0) { return; } for (int i = 0; i < __instance.currentLevel.spawnableScrap.Count; i++) { Item spawnableItem = __instance.currentLevel.spawnableScrap[i].spawnableItem; if ((Object)(object)spawnableItem != (Object)null && itemDayBlacklist.Contains(spawnableItem.itemName.ToLower())) { if (spawnableItem.twoHanded) { itemDayBlacklist.Remove(spawnableItem.itemName.ToLower()); } else { spawnableItem.twoHanded = true; } } } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] private static void ScrapGenerationPostfix(RoundManager __instance) { if (ScienceBirdTweaks.SingleItemBlacklist.Value == "" || itemDayBlacklist.Count <= 0) { return; } for (int i = 0; i < __instance.currentLevel.spawnableScrap.Count; i++) { Item spawnableItem = __instance.currentLevel.spawnableScrap[i].spawnableItem; if ((Object)(object)spawnableItem != (Object)null && itemDayBlacklist.Contains(spawnableItem.itemName.ToLower())) { spawnableItem.twoHanded = false; } } } } [HarmonyPatch] public class ShipCollisionPatches { public static bool doTeleporter; public static bool doInverse; [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void ReplaceRailingCollision(StartOfRound __instance, string sceneName) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown if (!ScienceBirdTweaks.ConsistentCatwalkCollision.Value || !(sceneName != "SampleSceneRelay") || !(sceneName != "MainMenu")) { return; } GameObject val = GameObject.Find("CatwalkShip"); if ((Object)(object)val != (Object)null) { GameObject val2 = (GameObject)ScienceBirdTweaks.TweaksAssets.LoadAsset("CatwalkShipAltered"); MeshFilter componentInChildren = val2.GetComponentInChildren(); MeshCollider component = val.GetComponent(); if ((Object)(object)componentInChildren != (Object)null) { component.sharedMesh = componentInChildren.sharedMesh; } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void ExtendLeverCollision(StartOfRound __instance, string sceneName) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.LargerLeverCollision.Value) { return; } StartMatchLever val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Extending lever collider..."); BoxCollider component = ((Component)val).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.size = ScienceBirdTweaks.ConfigLeverSize; } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void DestroyBottomCollision(StartOfRound __instance, string sceneName) { if (!ScienceBirdTweaks.BegoneBottomCollision.Value || !(sceneName != "SampleSceneRelay") || !(sceneName != "MainMenu")) { return; } GameObject val = GameObject.Find("Environment/HangarShip/ShipBottomColliders"); if ((Object)(object)val != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Destroying bottom colliders..."); BoxCollider[] componentsInChildren = val.GetComponentsInChildren(); BoxCollider[] array = componentsInChildren; foreach (BoxCollider val2 in array) { ((Collider)val2).enabled = false; } } GameObject val3 = GameObject.Find("Environment/HangarShip/Cube"); if ((Object)(object)val3 != (Object)null) { BoxCollider component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = false; } } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnConnectionClients(StartOfRound __instance) { if (ScienceBirdTweaks.TinyTeleporterCollision.Value) { if (Object.op_Implicit((Object)(object)GameObject.Find("Teleporter(Clone)/AnimContainer/PlacementCollider"))) { doTeleporter = true; } if (Object.op_Implicit((Object)(object)GameObject.Find("InverseTeleporter(Clone)/AnimContainer/PlacementCollider"))) { doInverse = true; } } } [HarmonyPatch(typeof(StartOfRound), "BuyShipUnlockableClientRpc")] [HarmonyPostfix] private static void TeleporterBuildOnBuy(StartOfRound __instance, int unlockableID) { if (ScienceBirdTweaks.TinyTeleporterCollision.Value && !((NetworkBehaviour)__instance).IsServer) { switch (unlockableID) { case 5: doTeleporter = true; break; case 19: doInverse = true; break; } } } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPostfix] private static void OnUpdate(StartOfRound __instance) { if (ScienceBirdTweaks.TinyTeleporterCollision.Value) { if (doTeleporter) { TeleporterBuildCollision(); doTeleporter = false; } else if (doInverse) { TeleporterBuildCollision(); doInverse = false; } } } private static void TeleporterBuildCollision() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Teleporter(Clone)/AnimContainer/PlacementCollider"); GameObject val2 = GameObject.Find("InverseTeleporter(Clone)/AnimContainer/PlacementCollider"); if ((Object)(object)val != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Fixing teleporter build collision..."); BoxCollider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.size = ScienceBirdTweaks.ConfigTeleporterSize; } } if ((Object)(object)val2 != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Fixing inverse teleporter build collision..."); BoxCollider component2 = val2.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.size = ScienceBirdTweaks.ConfigTeleporterSize; } } } [HarmonyPatch(typeof(StartOfRound), "SpawnUnlockable")] [HarmonyPostfix] private static void TeleporterBuildOnSpawn(StartOfRound __instance, int unlockableIndex) { if (ScienceBirdTweaks.TinyTeleporterCollision.Value) { switch (unlockableIndex) { case 5: doTeleporter = true; break; case 19: doInverse = true; break; } } } } [HarmonyPatch(typeof(StartOfRound))] internal class ShipFloodlightsPatch { private static bool spinnerAdded; public static GameObject interactPrefab; private static bool nullHandler; [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] private static void OnShipLand(StartOfRound __instance) { if (ScienceBirdTweaks.FloodlightRotation.Value && ScienceBirdTweaks.FloodlightRotationOnLand.Value && spinnerAdded) { ShipFloodlightController shipFloodlightController = Object.FindObjectOfType(); if ((Object)(object)shipFloodlightController != (Object)null) { shipFloodlightController.StartSpinning(); } } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] public static void AddSpinnerComponentPatch(StartOfRound __instance) { if (ScienceBirdTweaks.FloodlightRotation.Value || ScienceBirdTweaks.TrueBlackout.Value) { if (!spinnerAdded && (Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); spinnerAdded = true; ScienceBirdTweaks.Logger.LogInfo((object)"ShipFloodlightController component added."); } else if (spinnerAdded) { ScienceBirdTweaks.Logger.LogDebug((object)"ShipFloodlightController already added, skipping."); } else if ((Object)(object)((Component)__instance).gameObject.GetComponent() != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"ShipFloodlightController component already exists on StartOfRound object but wasn't tracked. Marking as added."); spinnerAdded = true; } } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void ResetSpinnerFlagPatch() { if (ScienceBirdTweaks.FloodlightRotation.Value) { ScienceBirdTweaks.Logger.LogDebug((object)"Disconnect detected, resetting spinnerAdded flag."); spinnerAdded = false; } } [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] [HarmonyPostfix] private static void OnDestroyResetSpinnerFlagPatch() { if (ScienceBirdTweaks.FloodlightRotation.Value) { ScienceBirdTweaks.Logger.LogDebug((object)"StartOfRound OnDestroy, resetting spinnerAdded flag."); spinnerAdded = false; } } [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] private static void ResetLightsOnLoadPatch(StartOfRound __instance) { if (!ScienceBirdTweaks.FloodlightRotation.Value) { return; } ScienceBirdTweaks.Logger.LogDebug((object)"Ship reached orbit, attempting to reset floodlights."); if ((Object)(object)__instance == (Object)null) { ScienceBirdTweaks.Logger.LogError((object)"ResetLightsOnLoadPatch: __instance is null!"); return; } ShipFloodlightController component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)"Found ShipFloodlightController. Calling ResetFloodlightLights()."); component.ResetFloodlightLights(); } else { ScienceBirdTweaks.Logger.LogDebug((object)"ShipFloodlightController component not found on StartOfRound object during ResetLightsOnLoadPatch. Cannot reset lights."); } } } [HarmonyPatch] public class ShotgunTooltipPatches { public static string safetyOnText; public static string safetyOffText; public static string reloadString; public static string ammoString0; public static string ammoString1; public static string ammoString2; public static string ejectCheckString; public static bool showAmmo; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializeAssets() { if (ScienceBirdTweaks.ShotgunMasterDisable.Value) { return; } Item val = (from x in Resources.FindObjectsOfTypeAll() where x.itemName == "Shotgun" select x).First(); if ((Object)(object)val != (Object)null) { if (val.toolTips != null && val.toolTips.Length == 3) { safetyOnText = ScienceBirdTweaks.SafetyOnString.Value + " " + val.toolTips[2].Remove(0, val.toolTips[2].IndexOf(":")); safetyOffText = ScienceBirdTweaks.SafetyOffString.Value + " " + val.toolTips[2].Remove(0, val.toolTips[2].IndexOf(":")); reloadString = "Reload " + val.toolTips[1].Remove(0, val.toolTips[1].IndexOf(":")); ammoString0 = "( )( ) Fire " + val.toolTips[0].Remove(0, val.toolTips[0].IndexOf(":")); ammoString1 = "(O)( ) Fire " + val.toolTips[0].Remove(0, val.toolTips[0].IndexOf(":")); ammoString2 = "(O)(O) Fire " + val.toolTips[0].Remove(0, val.toolTips[0].IndexOf(":")); val.toolTips[2] = safetyOnText; } else { safetyOnText = ScienceBirdTweaks.SafetyOnString.Value + " : [Q]"; safetyOffText = ScienceBirdTweaks.SafetyOffString.Value + " : [Q]"; reloadString = "Reload : [E]"; ammoString0 = "( )( ) Fire : [RMB]"; ammoString1 = "(O)( ) Fire : [RMB]"; ammoString2 = "(O)(O) Fire : [RMB]"; } } else { safetyOnText = ScienceBirdTweaks.SafetyOnString.Value + " : [Q]"; safetyOffText = ScienceBirdTweaks.SafetyOffString.Value + " : [Q]"; reloadString = "Reload : [E]"; ammoString0 = "( )( ) Fire : [RMB]"; ammoString1 = "(O)( ) Fire : [RMB]"; ammoString2 = "(O)(O) Fire : [RMB]"; } showAmmo = ScienceBirdTweaks.ShowAmmo.Value; ejectCheckString = (ScienceBirdTweaks.DoAmmoCheck.Value ? "Open chambers : [E]" : "Eject shells : [Hold E]"); } [HarmonyPatch(typeof(ShotgunItem), "SetControlTipsForItem")] [HarmonyPostfix] public static void TooltipSet(ShotgunItem __instance) { if (!ScienceBirdTweaks.ShotgunMasterDisable.Value && __instance.gunCompatibleAmmoID == 211) { TooltipUpdate(__instance); } } [HarmonyPatch(typeof(ShotgunItem), "SetSafetyControlTip")] [HarmonyPostfix] public static void SafetySet(ShotgunItem __instance) { if (ScienceBirdTweaks.ShotgunMasterDisable.Value || __instance.gunCompatibleAmmoID != 211 || !ShotgunPatches.HasValidHolder(__instance)) { return; } string text = ((!__instance.safetyOn) ? safetyOffText : safetyOnText); if (((NetworkBehaviour)__instance).IsOwner) { ScienceBirdTweaks.Logger.LogDebug((object)$"Safety: {__instance.safetyOn}, setting text to {text}"); int num = 3; if (ShotgunPatches.unloadEnabled && __instance.shellsLoaded <= 0 && !ShotgunPatches.ammoCheck && !ShotgunPatches.AllowedToEject(__instance)) { num = 2; } HUDManager.Instance.ChangeControlTip(num, text, false); } TooltipUpdate(__instance); } [HarmonyPatch(typeof(ShotgunItem), "ReloadGunEffectsClientRpc")] [HarmonyPostfix] public static void PostReload(ShotgunItem __instance) { if (!ScienceBirdTweaks.ShotgunMasterDisable.Value && __instance.gunCompatibleAmmoID == 211) { ScienceBirdTweaks.Logger.LogDebug((object)"Reload ended, updating tooltip!"); TooltipUpdate(__instance); } } [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyPostfix] public static void PostShot(ShotgunItem __instance) { if (!ScienceBirdTweaks.ShotgunMasterDisable.Value && __instance.gunCompatibleAmmoID == 211) { ScienceBirdTweaks.Logger.LogDebug((object)"Shot fired, updating tooltip!"); TooltipUpdate(__instance); } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] public static void OnSwitch(PlayerControllerB __instance, GrabbableObject fillSlotWithItem) { if (!ScienceBirdTweaks.ShotgunMasterDisable.Value) { ShotgunItem val = null; if ((Object)(object)fillSlotWithItem != (Object)null && Object.op_Implicit((Object)(object)((Component)fillSlotWithItem).GetComponent())) { val = ((Component)fillSlotWithItem).GetComponent(); } else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && Object.op_Implicit((Object)(object)((Component)__instance.currentlyHeldObjectServer).GetComponent())) { val = ((Component)__instance.currentlyHeldObjectServer).GetComponent(); } if ((Object)(object)val != (Object)null) { TooltipUpdate(val); } } } public static void TooltipUpdate(ShotgunItem shotgun) { if (ScienceBirdTweaks.ShotgunMasterDisable.Value || !ShotgunPatches.HasValidHolder(shotgun, strict: false) || shotgun.gunCompatibleAmmoID != 211 || !((NetworkBehaviour)shotgun).IsOwner) { return; } string[] toolTips = ((GrabbableObject)shotgun).itemProperties.toolTips; if (showAmmo) { switch (shotgun.shellsLoaded) { case 0: toolTips[0] = ammoString0; break; case 1: toolTips[0] = ammoString1; break; case 2: toolTips[0] = ammoString2; break; } } if (shotgun.safetyOn) { toolTips[2] = safetyOnText; } else { toolTips[2] = safetyOffText; } if (ShotgunPatches.unloadEnabled || ShotgunPatches.ammoCheck) { if (ShotgunPatches.AmmoInInventory(shotgun) && shotgun.shellsLoaded < 2) { toolTips[1] = reloadString; } else if (shotgun.shellsLoaded > 0 || ShotgunPatches.ammoCheck) { toolTips[1] = ejectCheckString; } else { toolTips[1] = toolTips[2]; toolTips[2] = ""; } } HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)shotgun).itemProperties); } } [HarmonyPatch] public class ShotgunPatches { public static GameObject shellPrefab; public static AudioClip inspectSFX; public static bool unloadEnabled; public static bool ammoCheck; public static float startTime; public static bool shellRegistered; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void InitializeAssets() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown if (ScienceBirdTweaks.ClientsideMode.Value || ScienceBirdTweaks.ShotgunMasterDisable.Value) { return; } unloadEnabled = ScienceBirdTweaks.UnloadShells.Value; ammoCheck = ScienceBirdTweaks.DoAmmoCheck.Value; GrabbableObject[] array = (from x in Resources.FindObjectsOfTypeAll() where x is ShotgunItem select x).ToArray(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (ScienceBirdTweaks.PickUpGunOrbit.Value) { val.itemProperties.canBeGrabbedBeforeGameStart = true; } if (unloadEnabled || ammoCheck) { inspectSFX = (AudioClip)ScienceBirdTweaks.TweaksAssets.LoadAsset("ShotgunInspectAudio"); ((Component)val).gameObject.AddComponent(); } } if (!unloadEnabled && !ScienceBirdTweaks.PickUpShellsOrbit.Value) { return; } GrabbableObject[] array3 = (from x in Resources.FindObjectsOfTypeAll() where x is GunAmmo select x).ToArray(); GrabbableObject[] array4 = array3; foreach (GrabbableObject val2 in array4) { if ((Object)(object)val2.itemProperties == (Object)null || val2.itemProperties.itemName != "Ammo" || val2.itemProperties.itemId != 17) { continue; } if (ScienceBirdTweaks.PickUpShellsOrbit.Value) { val2.itemProperties.canBeGrabbedBeforeGameStart = true; } if (unloadEnabled && (Object)(object)((Component)val2).gameObject.GetComponent() != (Object)null) { if (((Component)val2).gameObject.GetComponent().PrefabIdHash != 0) { shellRegistered = true; ScienceBirdTweaks.Logger.LogDebug((object)"Found shell!"); shellPrefab = ((Component)val2).gameObject; break; } ScienceBirdTweaks.Logger.LogDebug((object)"No shell found on initialization!"); shellRegistered = false; } } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void ShellPrefabCheck(StartOfRound __instance, string sceneName) { if (ScienceBirdTweaks.ClientsideMode.Value || ScienceBirdTweaks.ShotgunMasterDisable.Value || !unloadEnabled || !(sceneName == "SampleSceneRelay") || (!((Object)(object)shellPrefab == (Object)null) && NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(shellPrefab))) { return; } GrabbableObject[] array = (from x in Resources.FindObjectsOfTypeAll() where x is GunAmmo select x).ToArray(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if ((Object)(object)((Component)val).gameObject.GetComponent() != (Object)null) { if (((Component)val).gameObject.GetComponent().PrefabIdHash != 0) { ScienceBirdTweaks.Logger.LogDebug((object)"Found shell!"); shellRegistered = true; shellPrefab = ((Component)val).gameObject; break; } ScienceBirdTweaks.Logger.LogDebug((object)"No shell found on load!"); shellRegistered = false; } } } public static bool AmmoInInventory(ShotgunItem shotgun) { for (int i = 0; i < ((GrabbableObject)shotgun).playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)((GrabbableObject)shotgun).playerHeldBy.ItemSlots[i] == (Object)null)) { GrabbableObject obj = ((GrabbableObject)shotgun).playerHeldBy.ItemSlots[i]; GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null); if ((Object)(object)val != (Object)null && val.ammoType == shotgun.gunCompatibleAmmoID) { return true; } } } return false; } public static bool AllowedToEject(ShotgunItem shotgun) { return unloadEnabled && (!AmmoInInventory(shotgun) || shotgun.shellsLoaded >= 2) && shotgun.shellsLoaded > 0; } public static bool HasValidHolder(ShotgunItem shotgun, bool strict = true) { return (Object)(object)shotgun != (Object)null && (Object)(object)((GrabbableObject)shotgun).playerHeldBy != (Object)null && (!strict || (((GrabbableObject)shotgun).isHeld && !((GrabbableObject)shotgun).isPocketed)) && !((GrabbableObject)shotgun).isHeldByEnemy; } public static bool LocalPlayerNotInteracting(ShotgunItem shotgun) { return ((NetworkBehaviour)shotgun).IsOwner && HUDManager.Instance.holdFillAmount <= 0f && ((TMP_Text)((GrabbableObject)shotgun).playerHeldBy.cursorTip).text == ""; } [HarmonyPatch(typeof(GrabbableObject), "ItemInteractLeftRightOnClient")] [HarmonyPrefix] private static void InteractPrefix(GrabbableObject __instance, bool right) { if (!(!ScienceBirdTweaks.ClientsideMode.Value && !ScienceBirdTweaks.ShotgunMasterDisable.Value && (unloadEnabled || ammoCheck) && Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) && right) || ((Component)__instance).GetComponent().isReloading || (AmmoInInventory(((Component)__instance).GetComponent()) && ((Component)__instance).GetComponent().shellsLoaded < 2)) { return; } ShotgunItem component = ((Component)__instance).GetComponent(); if (component.gunCompatibleAmmoID != 211) { return; } bool doEject = AllowedToEject(component); if (LocalPlayerNotInteracting(component)) { if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).GetComponent().StartHolding(((Component)__instance).GetComponent(), doEject, ammoCheck); } else { ScienceBirdTweaks.Logger.LogError((object)"No shotgun script found!"); } } } [HarmonyPatch(typeof(GrabbableObject), "Start")] [HarmonyPostfix] private static void ShellRotationPatch(GrabbableObject __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && !ScienceBirdTweaks.ShotgunMasterDisable.Value && Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { __instance.floorYRot = Random.Range(0, 360); } } [HarmonyPatch(typeof(ShotgunItem), "StopUsingGun")] [HarmonyPostfix] public static void StopUsingGunPrefix(ShotgunItem __instance) { if (!ScienceBirdTweaks.ClientsideMode.Value && !ScienceBirdTweaks.ShotgunMasterDisable.Value && __instance.gunCompatibleAmmoID == 211 && (ammoCheck || unloadEnabled)) { PlayerControllerB val = ((GrabbableObject)__instance).playerHeldBy ?? __instance.previousPlayerHeldBy; if (ammoCheck) { val.playerBodyAnimator.speed = 1f; __instance.gunAudio.Stop(); __instance.gunAnimator.SetBool("Reloading", false); val.playerBodyAnimator.SetBool("ReloadShotgun", false); } __instance.isReloading = false; if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { ((Component)__instance).gameObject.GetComponent().fill = 0f; ((MonoBehaviour)((Component)__instance).gameObject.GetComponent()).StopAllCoroutines(); } } } } [HarmonyPatch] public class StartingMoonPatch { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void OnStart(StartOfRound __instance) { string moon = Regex.Replace(ScienceBirdTweaks.StartingMoon.Value, "^.?\\d+\\s", ""); if (moon == "Experimentation" || moon == "") { return; } SelectableLevel[] array = (from x in Resources.FindObjectsOfTypeAll() where Regex.Replace(x.PlanetName, "^.?\\d+\\s", "") == moon select x).ToArray(); if (array.Length != 0) { SelectableLevel val = array.First(); if ((Object)(object)val != (Object)null) { ScienceBirdTweaks.Logger.LogDebug((object)$"New start level ID: {val.levelID}, new start level name: {val.PlanetName}"); __instance.defaultPlanet = val.levelID; } } } } [HarmonyPatch] public class StormyPatches { [HarmonyPatch(typeof(StormyWeather), "Update")] [HarmonyPrefix] private static void OnUpdate(StormyWeather __instance) { if (ScienceBirdTweaks.LingeringLightningFix.Value && (((Object)(object)__instance.setStaticToObject != (Object)null && Object.op_Implicit((Object)(object)__instance.setStaticToObject.GetComponent()) && __instance.setStaticToObject.GetComponent().isInFactory) || ((Object)(object)__instance.targetingMetalObject != (Object)null && __instance.targetingMetalObject.isInFactory))) { if ((Object)(object)__instance.setStaticToObject != (Object)null) { __instance.staticElectricityParticle.Stop(); ((Component)__instance.staticElectricityParticle).gameObject.GetComponent().Stop(); __instance.strikeMetalObjectTimer = 0f; __instance.setStaticToObject = null; } __instance.targetingMetalObject = null; } } } [HarmonyPatch] public class SunFadePatches { private static MeshRenderer sunTexture; private static Material originalSunMat; private static Material fadingSunMat; private static Color baseSunColour; private static Color baseEmissiveColour; private static bool hasEmissive = false; private static bool doFade = false; private static int lastTime = -3; [HarmonyPatch(typeof(animatedSun), "Start")] [HarmonyPostfix] private static void OnStart() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (!ScienceBirdTweaks.SunFade.Value || !((Object)(object)TimeOfDay.Instance != (Object)null)) { return; } Transform val = ((Component)TimeOfDay.Instance.sunAnimator).gameObject.transform.Find("SunTexture"); if (!((Object)(object)val != (Object)null)) { return; } sunTexture = ((Component)val).GetComponent(); if ((Object)(object)sunTexture != (Object)null) { originalSunMat = ((Renderer)sunTexture).sharedMaterials[0]; fadingSunMat = new Material(originalSunMat); baseSunColour = fadingSunMat.color; if (fadingSunMat.HasColor("_EmissiveColor")) { baseEmissiveColour = fadingSunMat.GetColor("_EmissiveColor"); hasEmissive = true; } doFade = true; } } [HarmonyPatch(typeof(TimeOfDay), "MoveTimeOfDay")] [HarmonyPostfix] private static void TimeUpdate(TimeOfDay __instance) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (!doFade || !((Object)(object)__instance.sunAnimator != (Object)null)) { return; } int num = Mathf.FloorToInt(__instance.normalizedTimeOfDay * 100f) - 63; if (num >= lastTime + 3 && lastTime <= 24) { float num2 = Mathf.Clamp(1f - 0.125f * (float)((lastTime + 3) / 3 + 1), 0f, 1f); float num3 = Mathf.Clamp(0.55f * num2, 0f, 0.55f); Material obj = fadingSunMat; Color val = ((Color)(ref baseSunColour)).RGBMultiplied(num2); obj.color = ((Color)(ref val)).AlphaMultiplied(num3 + 0.45f); if (hasEmissive) { fadingSunMat.SetColor("_EmissiveColor", ((Color)(ref baseEmissiveColour)).RGBMultiplied(num2)); } lastTime += 3; } } [HarmonyPatch(typeof(StartOfRound), "LateUpdate")] [HarmonyPostfix] private static void SunLateUpdate(StartOfRound __instance) { if (doFade && (Object)(object)TimeOfDay.Instance.sunAnimator != (Object)null && (Object)(object)sunTexture != (Object)null) { ((Renderer)sunTexture).material = fadingSunMat; } } [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] private static void ResetValues() { if (ScienceBirdTweaks.SunFade.Value) { sunTexture = null; originalSunMat = null; fadingSunMat = null; hasEmissive = false; doFade = false; lastTime = -3; } } } [HarmonyPatch] public class UIPatches { public static Sprite handSprite; public static Sprite pointSprite; public static bool doShutterFix = false; public static bool fixedShutter = false; private static bool done = false; private static float checkTime = 0f; private static readonly string[] vanillaMoons = new string[13] { "20 Adamance", "68 Artifice", "220 Assurance", "71 Gordion", "7 Dine", "5 Embrion", "41 Experimentation", "44 Liquidation", "61 March", "21 Offense", "85 Rend", "8 Titan", "56 Vow" }; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void InitialLoad() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (ScienceBirdTweaks.StretchedHoverIconFix.Value) { handSprite = (Sprite)ScienceBirdTweaks.TweaksAssets.LoadAsset("HandIcon"); pointSprite = (Sprite)ScienceBirdTweaks.TweaksAssets.LoadAsset("HandIconPoint"); } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void OnStartReset(StartOfRound __instance) { fixedShutter = false; } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void FixOnSpawn(PlayerControllerB __instance) { if (((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && __instance.isCameraDisabled) { FixHandIcons(); FixShutterIcon(); } } [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] [HarmonyPostfix] private static void FixAfterGenerate() { if (!done) { done = true; FixHandIcons(); } } [HarmonyPatch(typeof(StartOfRound), "BuyShipUnlockableClientRpc")] [HarmonyPostfix] private static void OnBuy(StartOfRound __instance) { if (ScienceBirdTweaks.test1Present && !((NetworkBehaviour)__instance).IsServer) { doShutterFix = true; checkTime = Time.realtimeSinceStartup; } } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPostfix] private static void OnUpdate(StartOfRound __instance) { if (doShutterFix && (double)(Time.realtimeSinceStartup - checkTime) > 0.5) { doShutterFix = false; FixShutterIcon(); } } [HarmonyPatch(typeof(StartOfRound), "SpawnUnlockable")] [HarmonyPostfix] private static void OnSpawn(StartOfRound __instance) { FixShutterIcon(); } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void OnLoad(StartOfRound __instance, string sceneName) { done = false; } private static void FixShutterIcon() { if (fixedShutter || !ScienceBirdTweaks.test1Present) { return; } GameObject val = GameObject.Find("PrefabShutterSwitch(Clone)/LeverContainer"); if ((Object)(object)val != (Object)null) { InteractTrigger component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.hoverIcon = handSprite; fixedShutter = true; } } } private static void FixHandIcons() { if (ScienceBirdTweaks.StretchedHoverIconFix.Value) { InteractTrigger[] array = (from x in Object.FindObjectsOfType(true) where (Object)(object)x.hoverIcon != (Object)null && ((Object)x.hoverIcon).name == "HandIcon" select x).ToArray(); InteractTrigger[] array2 = (from x in Object.FindObjectsOfType(true) where (Object)(object)x.hoverIcon != (Object)null && ((Object)x.hoverIcon).name == "HandIconPoint" select x).ToArray(); for (int i = 0; i < array.Length; i++) { array[i].hoverIcon = handSprite; } for (int j = 0; j < array2.Length; j++) { array2[j].hoverIcon = pointSprite; } } } [HarmonyPatch(typeof(ShipBuildModeManager), "PlayerMeetsConditionsToBuild")] [HarmonyPostfix] private static void BuildCheckPatch(ShipBuildModeManager __instance, ref bool __result) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (ScienceBirdTweaks.FearfulBuilding.Value && !__result && (!__instance.InBuildMode || (!((Object)(object)__instance.placingObject == (Object)null) && !__instance.placingObject.inUse && !StartOfRound.Instance.unlockablesList.unlockables[__instance.placingObject.unlockableID].inStorage)) && !GameNetworkManager.Instance.localPlayerController.isTypingChat && !__instance.player.isPlayerDead && !__instance.player.inSpecialInteractAnimation && !__instance.player.activatingItem && !__instance.player.disablingJetpackControls && !__instance.player.jetpackControls && __instance.player.isInHangarShipRoom) { AnimatorStateInfo currentAnimatorStateInfo = StartOfRound.Instance.shipAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Animator.StringToHash("ShipIdle") && (StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipHasLanded)) { __result = true; } } } [HarmonyPatch(typeof(QuickMenuManager), "Update")] [HarmonyPostfix] private static void PauseUpdate(QuickMenuManager __instance) { if (ScienceBirdTweaks.PauseMenuFlickerFix.Value && __instance.menuContainer.activeInHierarchy && (Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null) { Button component = EventSystem.current.currentSelectedGameObject.GetComponent