Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NicheTweaks v0.4.5
NicheTweaks.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn.Internal; using Dusk; using GameNetcodeStuff; using HarmonyLib; using LCBetterSaves; using LethalThings; using Lethal_Nuke; using Microsoft.CodeAnalysis; using NicheTweaks.ExternalTweaks.BetterSaves; using NicheTweaks.ExternalTweaks.DawnLib; using NicheTweaks.ExternalTweaks.EladsHUD; using NicheTweaks.ExternalTweaks.EladsHUD.AutoHide; using NicheTweaks.ExternalTweaks.EladsHUD.HUDReorder; using NicheTweaks.ExternalTweaks.EladsHUD.Misc; using NicheTweaks.ExternalTweaks.EnhancedMonsters; using NicheTweaks.ExternalTweaks.GeneralImprovements; using NicheTweaks.ExternalTweaks.ImmersiveVisor; using NicheTweaks.ExternalTweaks.InputUtils; using NicheTweaks.ExternalTweaks.LethalConfig; using NicheTweaks.ExternalTweaks.LethalNuke; using NicheTweaks.ExternalTweaks.LethalThings; using NicheTweaks.ExternalTweaks.LobbyControl; using NicheTweaks.ExternalTweaks.LobbyImprovements; using NicheTweaks.ExternalTweaks.MagicShippingCrate; using NicheTweaks.ExternalTweaks.MirrorDecor; using NicheTweaks.ExternalTweaks.MoreBlood; using NicheTweaks.ExternalTweaks.MoreCompany; using NicheTweaks.ExternalTweaks.ShipWindows; using NicheTweaks.NetcodePatcher; using NicheTweaks.Patches; using NicheTweaks.Tweaks.Audio; using NicheTweaks.Tweaks.Decals; using NicheTweaks.Tweaks.Gameplay; using NicheTweaks.Tweaks.HUD; using NicheTweaks.Tweaks.QoL; using NicheTweaks.Tweaks.Ship; using NicheTweaks.Tweaks.Visuals; using NicheTweaks.Tweaks.Visuals.PlayerSelfShadow; using NicheTweaks.Utils; using ShipWindows; using ShipWindows.Api.events; using ShipWindows.ShutterSwitch; using ShipWindows.WindowDefinition; using Steamworks.Data; using TMPro; using TooManyEmotes.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.VFX; using Woecust.ImmersiveVisor; [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("NicheTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.4.5.0")] [assembly: AssemblyInformationalVersion("0.4.5")] [assembly: AssemblyProduct("NicheTweaks")] [assembly: AssemblyTitle("NicheTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.5.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 NicheTweaks { internal static class ConfigManager { internal const string Audio = "Audio"; internal const string Decals = "Decals"; internal const string Gameplay = "Gameplay"; internal const string UI = "UI"; internal const string Visuals = "Visuals"; internal const string Ship = "Ship"; internal const string QoL = "QoL"; internal const string OtherMods = "zOther mods"; internal const string EladsHUD = "zzEladsHUD"; internal static ConfigEntry<bool> SilenceRingingEarsAudio { get; private set; } internal static ConfigEntry<bool> SilenceLightningStatic { get; private set; } internal static ConfigEntry<bool> MuteFearAudio { get; private set; } internal static ConfigEntry<bool> EnableDecalDrawDistanceOverride { get; private set; } internal static ConfigEntry<bool> EnableFootprintPoolOverride { get; private set; } internal static ConfigEntry<int> FootprintPoolSize { get; private set; } internal static ConfigEntry<bool> EnablePlayerBlood { get; private set; } internal static ConfigEntry<int> MinimumDamageForBlood { get; private set; } internal static ConfigEntry<int> BloodAmount { get; private set; } internal static ConfigEntry<float> BloodDecalSize { get; private set; } internal static ConfigEntry<bool> FixHoarderBugManEaterTarget { get; private set; } internal static ConfigEntry<bool> GrabbableToEnemiesItemBlacklistToggle { get; private set; } internal static ConfigEntry<string> GrabbableToEnemiesItemBlacklist { get; private set; } internal static ConfigEntry<bool> RadmechLargerHitCollider { get; private set; } internal static ConfigEntry<bool> ButlerTallerHitCollider { get; private set; } internal static ConfigEntry<bool> JesterTallerHitCollider { get; private set; } internal static ConfigEntry<bool> ButlerCollisionAdjustment { get; private set; } internal static ConfigEntry<bool> DisableUtilitySlot { get; private set; } internal static ConfigEntry<bool> PreventCheckDeadPlayersCheese { get; private set; } internal static ConfigEntry<bool> TriggerDeadlineEjectionAtZeroDays { get; private set; } internal static ConfigEntry<bool> DisableInspectItem { get; private set; } internal static ConfigEntry<bool> FixZeroScaleItems { get; private set; } internal static ConfigEntry<bool> DisableClock { get; private set; } internal static ConfigEntry<bool> AddClockToDeathScreen { get; private set; } internal static ConfigEntry<bool> DisableChat { get; private set; } internal static ConfigEntry<bool> FixChatColon { get; private set; } internal static ConfigEntry<bool> DisableCompass { get; private set; } internal static ConfigEntry<bool> DisableWeight { get; private set; } internal static ConfigEntry<HandsFullTextPreset> HandsFullTextPresetSelection { get; private set; } internal static ConfigEntry<bool> ItemLightningBorder { get; private set; } internal static ConfigEntry<bool> RemoveItemSlotFade { get; private set; } internal static ConfigEntry<bool> HideHUDAtTerminal { get; private set; } internal static ConfigEntry<bool> EnableFloodedCondensation { get; private set; } internal static ConfigEntry<bool> FixQuitGameMenuHighlightColours { get; private set; } internal static ConfigEntry<bool> QuitGameColourConsistency { get; private set; } internal static ConfigEntry<bool> HideJoinButton { get; private set; } internal static ConfigEntry<bool> HideInviteFriendsButton { get; private set; } internal static ConfigEntry<bool> HideCreditsButton { get; private set; } internal static ConfigEntry<bool> ChangeFriendsOnlyTextToPrivate { get; private set; } internal static ConfigEntry<bool> DisableControlTips { get; private set; } internal static ConfigEntry<bool> FixUtilitySlotItemIconSize { get; private set; } internal static ConfigEntry<bool> EnableTooltipRename { get; private set; } internal static ConfigEntry<string> TooltipItemsToRename { get; private set; } internal static ConfigEntry<string> AllItemNamesList { get; private set; } internal static ConfigEntry<bool> ScanNodeOverridesToggle { get; private set; } internal static ConfigEntry<string> ScanNodeOverrides { get; private set; } internal static ConfigEntry<bool> HideWarningDisplayTipToggle { get; private set; } internal static ConfigEntry<bool> DisableFilmGrain { get; private set; } internal static ConfigEntry<bool> BlockCustomMoonVFX { get; private set; } internal static ConfigEntry<string> BlockCustomMoonVFXMoonFilter { get; private set; } internal static ConfigEntry<bool> DisableLocalPlayerSelfShadow { get; private set; } internal static ConfigEntry<bool> HidePlayerArms { get; private set; } internal static ConfigEntry<bool> ToyCubeTextureFix { get; private set; } internal static ConfigEntry<bool> EnableLODOverride { get; private set; } internal static ConfigEntry<float> LODBias { get; private set; } internal static ConfigEntry<bool> DisableChargeStationScanNode { get; private set; } internal static ConfigEntry<bool> CloseShipDoorOnLeverPull { get; private set; } internal static ConfigEntry<bool> PlanetVideoReelDisable { get; private set; } internal static ConfigEntry<bool> EnableGlobalVolumeMeter { get; private set; } internal static ConfigEntry<bool> SavePlayerVolume { get; private set; } internal static ConfigEntry<bool> EnableDropshipPickupDelay { get; private set; } internal static ConfigEntry<float> DropshipPickupDelayTime { get; private set; } internal static ConfigEntry<bool> EnableShipTeleporterBlock { get; private set; } internal static ConfigEntry<bool> EnableLandmineFix { get; private set; } internal static ConfigEntry<bool> JesterWarmup { get; private set; } internal static ConfigEntry<bool> AmbientMusicWarmup { get; private set; } internal static ConfigEntry<bool> NormaliseHelmetLightBrightness { get; private set; } internal static ConfigEntry<bool> UncapFPS { get; private set; } internal static ConfigEntry<bool> PreventErrorFromSteamImage { get; private set; } internal static ConfigEntry<bool> DisableAchievementPopups { get; private set; } internal static ConfigEntry<bool> ReplaceDawnLibHotloadingPlayerImages { get; private set; } internal static ConfigEntry<bool> FixMoreBloodFootprints { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyMenuButton { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyCrewCount { get; private set; } internal static ConfigEntry<bool> MoreCompanyOrangeCosmeticButton { get; private set; } internal static ConfigEntry<bool> LobbyImprovementsTextEdit { get; private set; } internal static ConfigEntry<bool> BetterSavesTextEdit { get; private set; } internal static ConfigEntry<bool> BetterSavesAutoRename { get; private set; } internal static ConfigEntry<bool> BetterSavesStartCreditsFix { get; private set; } internal static ConfigEntry<bool> HideKeybindsLegacyButton { get; private set; } internal static ConfigEntry<bool> HideLethalConfigMenu { get; private set; } internal static ConfigEntry<bool> AddSpaceToLethalConfig { get; private set; } internal static ConfigEntry<bool> EnableLIUtilBeltAlign { get; private set; } internal static ConfigEntry<bool> MZCoMagicShippingNeverRespawns { get; private set; } internal static ConfigEntry<bool> ImmersiveVisorWorksWithHurricane { get; private set; } internal static ConfigEntry<bool> ShipWindowsOpenClose { get; private set; } internal static ConfigEntry<bool> LethalNukeFix { get; private set; } internal static ConfigEntry<bool> MirrorDecorFPSCapToggle { get; private set; } internal static ConfigEntry<int> MirrorDecorFPSCap { get; private set; } internal static ConfigEntry<bool> RemoveEnhancedMonstersVersionNumber { get; private set; } internal static ConfigEntry<bool> RemoveLobbyCommand { get; private set; } internal static ConfigEntry<bool> PlayerScanNodeRed { get; private set; } internal static ConfigEntry<bool> V80Compat { get; private set; } internal static ConfigEntry<bool> EnableEladsHUDReorder { get; private set; } internal static ConfigEntry<bool> FixStaminaTenPercent { get; private set; } internal static ConfigEntry<bool> DisableEladsHUDStaminaNotch { get; private set; } internal static ConfigEntry<bool> HideEladsHUDWeight { get; private set; } internal static ConfigEntry<bool> EladsHUDTriggerHealthShowOnHeal { get; private set; } internal static ConfigEntry<bool> EladsHUDHideStaminaPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideStamina { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideDelay { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideStartPercent { get; private set; } internal static ConfigEntry<bool> EladsHUDWeightTriggersStamina { get; private set; } internal static ConfigEntry<bool> EladsHUDHideOxygenPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideOxygen { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenDelay { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenValue { get; private set; } internal static ConfigEntry<bool> EladsHUDHidePercentDividers { get; private set; } internal static ConfigEntry<bool> EladsHUDHideInsanityPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideInsanity { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideInsanityDelay { get; private set; } private static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue, string description) { return config.Bind<T>(section, key, defaultValue, description); } internal static void CfgInit(ConfigFile config) { SilenceRingingEarsAudio = Bind(config, "Audio", "Silence ear ringing audio", defaultValue: false, "If true, silences the ear ringing audio from shotgun blasts."); SilenceLightningStatic = Bind(config, "Audio", "Silence lightning static audio", defaultValue: false, "If true, silences live lightning static that plays from a conductive item being targeted when entering the facility."); MuteFearAudio = Bind(config, "Audio", "Mute fear audio", defaultValue: false, "If true, stops the fear ambience and heartbeat audio driven by the local player's fear level."); EnableDecalDrawDistanceOverride = Bind(config, "Decals", "Enable decal draw distance override", defaultValue: false, "If true, breaks the decal draw distance and causes decals to always be rendered. Will impact performance, not recommended without LethalSponge."); EnableFootprintPoolOverride = Bind(config, "Decals", "Enable footprint pool override", defaultValue: false, "If true, overrides the number of footprint decals allowed to exist."); FootprintPoolSize = Bind(config, "Decals", "Footprint pool size", 250, "Number of footprints that are allowed to be present before the oldest footprints start culling visually. Increasing this will impact performance."); EnablePlayerBlood = Bind(config, "Decals", "Enable player blood effects", defaultValue: false, "Enable blood effects when players take damage."); MinimumDamageForBlood = Bind(config, "Decals", "Minimum damage for blood", 5, "Minimum damage before blood splatter appears."); BloodAmount = Bind(config, "Decals", "Blood amount", 3, "Number of blood splatters a player takes damage."); BloodDecalSize = Bind(config, "Decals", "BloodDecalSize", 3f, "Size of blood splats created by players taking damage."); FixHoarderBugManEaterTarget = Bind(config, "Gameplay", "Fix hoarder bug trying to grab man eater", defaultValue: false, "If true, prevents hoarder bugs from trying to pick up man eaters"); GrabbableToEnemiesItemBlacklistToggle = Bind(config, "Gameplay", "Enable grabbable to enemies item blacklist", defaultValue: false, "If true, enables grabbable to enemies item blacklist"); GrabbableToEnemiesItemBlacklist = Bind(config, "Gameplay", "Grabbable to enemies item blacklist", "", "Uses itemProperties name, separated by commas. E.g. 'Big bolt,Large axle,Bowl of Apples'"); RadmechLargerHitCollider = Bind(config, "Gameplay", "Give Radmechs a larger hit collider", defaultValue: false, "If true, gives the Radmech/Old Bird enemies a larger hitbox, mainly for use with mods where they are no longer immortal. However, as an unavoidable consequence, they can now grab you far easier, making them more difficult. Can be used to increase their lethality as well."); ButlerTallerHitCollider = Bind(config, "Gameplay", "Give Butlers a taller player hit collider", defaultValue: false, "If true, increases the height of Butlers player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas."); JesterTallerHitCollider = Bind(config, "Gameplay", "Give Jesters a taller player hit collider", defaultValue: false, "If true, increases the height of Jesters player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas."); ButlerCollisionAdjustment = Bind(config, "Gameplay", "Lower size of Butler obstacle avoidance", defaultValue: false, "If true, resizes Butler's NavMeshAgent obstacle avoidance radius from 1.6 to 1.4 to help them fit through tighter spaces and open doors properly."); DisableUtilitySlot = Bind(config, "Gameplay", "Disable utility slot", defaultValue: false, "If true, disables the utility slot on the HUD and prevents items from using the utility slot."); PreventCheckDeadPlayersCheese = Bind(config, "Gameplay", "Prevent check dead players cheese", defaultValue: false, "If true, displays the 'No one can hear you' popup when sending a chat message when everyone is dead."); TriggerDeadlineEjectionAtZeroDays = Bind(config, "Gameplay", "Eject at zero days without ship loot", defaultValue: false, "If true, triggers the deadline firing sequence as soon as the crew reaches 0 days left when no ship scrap value is found."); DisableInspectItem = Bind(config, "Gameplay", "Disable item inspection", defaultValue: false, "If true, disables the ability to inspect items."); FixZeroScaleItems = Bind(config, "Gameplay", "Fix zero scale items", defaultValue: false, "EXPERIMENTAL | If true, attempts to fix NaN errors. Not sure if this works."); DisableClock = Bind(config, "UI", "Hide clock from HUD", defaultValue: false, "If true, hides the clock from the HUD."); AddClockToDeathScreen = Bind(config, "UI", "Add clock to death screen", defaultValue: false, "If true, adds clock to death screen."); DisableChat = Bind(config, "UI", "Hide chat from HUD", defaultValue: false, "If true, hides the chat from the HUD. Warning: It remains hidden even if you type in it."); FixChatColon = Bind(config, "UI", "Set chat colon colour to blue", defaultValue: false, "If true, sets the colon in the chat to blue and prevents the colon from changing colours when using <color> html attributes in chat messages."); DisableCompass = Bind(config, "UI", "Hide compass from HUD", defaultValue: false, "If true, hides the compass from the HUD."); DisableWeight = Bind(config, "UI", "Hide weight from HUD", defaultValue: false, "If true, hides the weight from the HUD."); HandsFullTextPresetSelection = Bind(config, "UI", "Hands full text preset", HandsFullTextPreset.DefaultNoChange, "Preset for HandsFullText position/rotation/scale/opacity. DefaultNoChange does not modify the HUD."); ItemLightningBorder = Bind(config, "UI", "Item Lightning Warning", defaultValue: false, "If true, warns the player which item is about to be struck by lightning with a visual indicator."); RemoveItemSlotFade = Bind(config, "UI", "Remove Item Slot Fade", defaultValue: false, "If true, removes the fade popout of the item slot frame when swapping item slots."); HideHUDAtTerminal = Bind(config, "UI", "Hide HUD at terminal", defaultValue: false, "If true, hides the HUD whilst at the terminal."); EnableFloodedCondensation = Bind(config, "UI", "Enable condensation on visor during flooded", defaultValue: false, "If true, shows helmet condensation during Flooded weather."); FixQuitGameMenuHighlightColours = Bind(config, "UI", "Fix quit game highlight colours", defaultValue: false, "If true, changes the green highlights and corners of the in-game quit menu to be highlighted orange like the rest of the game."); QuitGameColourConsistency = Bind(config, "UI", "Change quit game confirmation text to orange", defaultValue: false, "If true, changes the light blue 'Would you like to leave the game?' text to be orange."); HideJoinButton = Bind(config, "UI", "Hide join button", defaultValue: false, "If true, hides the join crew button in the main menu."); HideInviteFriendsButton = Bind(config, "UI", "Hide invite friends button", defaultValue: false, "If true, hides the invite friends button in the quick menu."); HideCreditsButton = Bind(config, "UI", "Hide credits button", defaultValue: false, "If true, hides the Credits button in the main menu."); ChangeFriendsOnlyTextToPrivate = Bind(config, "UI", "Change friends only text to private", defaultValue: false, "If true, changes the 'Friends only' lobby option in lobby creation menu to say 'Private'."); DisableControlTips = Bind(config, "UI", "Hide control tips from HUD", defaultValue: false, "If true, hides the control tip labels (top right of HUD)."); FixUtilitySlotItemIconSize = Bind(config, "UI", "Fix utility slot item icon size", defaultValue: false, "If true, fits the item icon to the utility slot."); EnableTooltipRename = Bind(config, "UI", "Customise control tip item name", defaultValue: false, "If true, enables the replacement of item control tip texts with their scan node text."); TooltipItemsToRename = Bind(config, "UI", "Items to change the control tip text of", "Brush = Hair brush,clipboard = Training manual,Bell = Brass bell,Gift = Gift box,Gold bar = Gold Bar,Hive = Bee hive,Ring = Wedding ring,Toy robot = Robot Toy,Metal sheet = Tattered metal sheet,Mug = Coffee mug,Rubber Ducky = Rubber ducky,Tea kettle = Tea Kettle,Ammo = Shotgun shell,Cookie pan = Cookie mold pan", "Items that will have their control tip text altered. E.g. 'ExampleItem1 = <desired control tip string>'"); AllItemNamesList = Bind(config, "UI", "Autogenerated item and scan node default text list", "Generates after loading a lobby", "Auto generated list of all item names and their respective default scan node text. Needs control tip renaming to be set to true"); ScanNodeOverridesToggle = Bind(config, "UI", "Scan node overrides toggle", defaultValue: false, "If true, enables the ability to override the type of any scan node"); ScanNodeOverrides = Bind(config, "UI", "Scan node overrides", "SnailCatRe:1, Fake SnailCatRe:1, Bandages:0, Defibrillator:0, Handlamp:0, MedicalKit:0, ProductivityAutoinjector:0, ShiftController:0, Toolbox:0, SeedCarrot:0, SeedGrape1:0, SeedGrape0:0, SeedPotato:0, SeedWheat:0, Fertilizer0:0", "Uses GameObject name and ScanNodeType, separated by colons and commas. E.g. 'SnailCatRe:1,Fake SnailCatRe:1,Bandages:0'. Searches the target GameObject and its hierarchy for ScanNodeProperties. 0 = Blue, 1 = Red, 2 = Green. A GameObject's name may not be the same as an item or enemies name!"); HideWarningDisplayTipToggle = Bind(config, "UI", "Hide warning display tips", defaultValue: false, "If true, hides all warning display tips (yellow display tips)"); DisableFilmGrain = Bind(config, "Visuals", "Disable film grain effect globally", defaultValue: false, "If true, globally disables film grain where it may be present."); BlockCustomMoonVFX = Bind(config, "Visuals", "Disable custom VFX on moons", defaultValue: false, "If true, disables all visual effects on moons, primarily for use with custom moons. WARNING: Will cause issues with some modded weathers that have custom visuals, compatibility is planned."); BlockCustomMoonVFXMoonFilter = Bind(config, "Visuals", "Disable custom VFX moon filter", "", "Moons to enable custom VFX disabling on. Separated by commas, example: Experimentation,Abaddon,Embrion. Empty = all moons."); DisableLocalPlayerSelfShadow = Bind(config, "Visuals", "Disable local player shadow", defaultValue: false, "If true, disables shadow casting for the local player only. Very useful for modded flashlights with very high intensities."); HidePlayerArms = Bind(config, "Visuals", "Hide player arms", defaultValue: false, "If true, hides the player arms."); ToyCubeTextureFix = Bind(config, "Visuals", "Enable texture fix for Toy cube", defaultValue: false, "If true, changes the texture of Toy cube (rubix cube) scrap to a texture of a rubix cube that is actually solvable."); EnableLODOverride = Bind(config, "Visuals", "Enable LOD bias override", defaultValue: false, "If true, enables custom LOD distance."); LODBias = Bind(config, "Visuals", "LOD bias", 1f, "LOD bias value. Increasing this will impact performance."); DisableChargeStationScanNode = Bind(config, "Ship", "Disable leftover charge station scan node", defaultValue: false, "If true, hides the scan node of the charge station inside the ship. This only affects the leftover scan node after moving the charge station with build mode."); CloseShipDoorOnLeverPull = Bind(config, "Ship", "Close ship doors when lever is pulled", defaultValue: false, "If true, closes the ship doors when the lever is pulled."); PlanetVideoReelDisable = Bind(config, "Ship", "Disable planet reel video on ship monitors", defaultValue: false, "If true, disables the planet reel video on the ship monitor."); EnableGlobalVolumeMeter = Bind(config, "QoL", "Enable global voice volume slider", defaultValue: false, "If true, enables the global voice volume slider in the player list."); SavePlayerVolume = Bind(config, "QoL", "Enable player volume saving", defaultValue: false, "If true, enables player volume saving. Works with global volume slider."); EnableDropshipPickupDelay = Bind(config, "QoL", "Enable dropship item pickup delay", defaultValue: false, "If true, adds a short delay to items dropped by the dropship before they can be grabbed."); DropshipPickupDelayTime = Bind(config, "QoL", "Dropship item pickup delay time", 1f, "Time in seconds before dropped items can be picked up."); EnableShipTeleporterBlock = Bind(config, "QoL", "Enable teleporter item pickup block", defaultValue: false, "If true, block item pickup whilst you are being teleported."); EnableLandmineFix = Bind(config, "QoL", "Remove landmine invisible bump", defaultValue: false, "Removes the invisible bump left by landmines after exploding."); JesterWarmup = Bind(config, "QoL", "Jester Warmup", defaultValue: false, "If true, silently plays and stops the Jester's audio clips so they are decompressed before first real playback to prevent an in-game lag spike"); AmbientMusicWarmup = Bind(config, "QoL", "Ambient music warmup", defaultValue: false, "If true, silently plays and stops ambient music audio so they are decompressed before first real playback to prevent an in-game lag spike"); NormaliseHelmetLightBrightness = Bind(config, "QoL", "Normalise helmet light brightness", defaultValue: false, "If true, matches the helmet light intensity to the flashlight's held light intensity when a flashlight is pocketed."); UncapFPS = Bind(config, "QoL", "Uncap FPS", defaultValue: false, "If true, removes the 250 fps cap."); PreventErrorFromSteamImage = Bind(config, "QoL", "Prevent a harmless error on player join", defaultValue: false, "If true, fixes a vanilla bug that causes harmless errors to be thrown when players join a lobby."); DisableAchievementPopups = Bind(config, "zOther mods", "Hide and mute DawnLib achievement popups", defaultValue: false, "If true, hides DawnLib's achievement popup and sound."); ReplaceDawnLibHotloadingPlayerImages = Bind(config, "zOther mods", "Replace DawnLib hotloadUI images", defaultValue: false, "If true, replaces DawnLib hotloadUI player Steam images with a vanilla image."); FixMoreBloodFootprints = Bind(config, "zOther mods", "Fix MoreBlood footprint smearing", defaultValue: false, "If true, enable fix for MoreBlood footprint smearing."); HideMoreCompanyMenuButton = Bind(config, "zOther mods", "Hide MoreCompany main menu button", defaultValue: false, "If true, hides the MoreCompany cosmetics button in the main menu. Requires MoreCompany to be installed."); HideMoreCompanyCrewCount = Bind(config, "zOther mods", "Hide MoreCompany crew count in create lobby menu", defaultValue: false, "If true, hides the MoreCompany crew count in the create lobby menu. Requires MoreCompany to be installed."); MoreCompanyOrangeCosmeticButton = Bind(config, "zOther mods", "Change MoreCompany cosmetic button icon to orange", defaultValue: false, "If true, changes the cosmetic button in the main menu and the pause menu from green to orange. Requires MoreCompany to be installed."); LobbyImprovementsTextEdit = Bind(config, "zOther mods", "Change LobbyImprovements text", defaultValue: false, "If true, changes text on the create a lobby screen from 'ImprovedLobby' -> 'Lobby'. Requires LobbyImprovements to be installed."); BetterSavesTextEdit = Bind(config, "zOther mods", "Change BetterSaves text", defaultValue: false, "If true, changes text on the create a lobby screen from 'BetterSaves' -> 'Save Files'. Requires LCBetterSaves to be installed."); BetterSavesAutoRename = Bind(config, "zOther mods", "BetterSaves auto rename", defaultValue: false, "If true, automatically renames new saves to the lobby name. Requires LCBetterSaves to be installed."); BetterSavesStartCreditsFix = Bind(config, "zOther mods", "BetterSaves start credits fix", defaultValue: false, "If true, sets BetterSaves starting credits to 60 rather than 30. Requires LCBetterSaves to be installed."); HideKeybindsLegacyButton = Bind(config, "zOther mods", "Hide legacy control button inside control settings", defaultValue: false, "If true, hide legacy control button inside control settings. Requires LethalCompany InputUtils to be installed."); HideLethalConfigMenu = Bind(config, "zOther mods", "Hide LethalConfig main menu button", defaultValue: false, "If true, hides LethalConfig button in the main menu."); AddSpaceToLethalConfig = Bind(config, "zOther mods", "Add space to LethalConfig", defaultValue: false, "If true, renames 'LethalConfig' to 'Lethal Config' in the main menu and in the pause menu in-game."); EnableLIUtilBeltAlign = Bind(config, "zOther mods", "Enable Utility Belt UI alignment fix", defaultValue: false, "If true, aligns Utility Belt item slots to the middle for consistency purposes. Requires LethalThings to be installed."); MZCoMagicShippingNeverRespawns = Bind(config, "zOther mods", "MZCoMagicShipping crate never respawns", defaultValue: false, "If true, the magic crate does not respawn and is single use only. Requires MZCoMagicShipping to be installed."); ImmersiveVisorWorksWithHurricane = Bind(config, "zOther mods", "ImmersiveVisor works with Hurricane", defaultValue: false, "If true, Immersive Visor shows rain drops on the visor during hurricane weather. Requires ImmersiveVisor and Wesleys Weathers to be installed."); ShipWindowsOpenClose = Bind(config, "zOther mods", "Ship window shutters close on departure", defaultValue: false, "If true, ship window shutters close when the ship doors close on departure. Requires ShipWindows to be installed."); LethalNukeFix = Bind(config, "zOther mods", "Lethal Nuke Fix", defaultValue: false, "If true, prevents lethal nuke's particle effect from looping. Requires Lethal Nuke to be installed."); MirrorDecorFPSCapToggle = Bind(config, "zOther mods", "MirrorDecor FPS cap toggle", defaultValue: false, "If true, enables FPS cap for MirrorDecor and prevents camera from rendering when not on the ship. Requires MirrorDecor to be installed."); MirrorDecorFPSCap = Bind(config, "zOther mods", "MirrorDecor FPS cap", 30, "Sets the FPS for MirrorDecor."); RemoveEnhancedMonstersVersionNumber = Bind(config, "zOther mods", "Remove EnhancedMonsters version number", defaultValue: false, "If true, removes EnhancesMonsters' version number from Lethal Company's version number text in the main menu. Requires EnhancedMonsters to be installed."); RemoveLobbyCommand = Bind(config, "zOther mods", "Remove LobbyControl command", defaultValue: false, "If true, removes the lobby command from help/other screen on the terminal. Does not disable the lobby command, only hides. Requires LobbyControl to be installed."); PlayerScanNodeRed = Bind(config, "zOther mods", "Player Scan node red", defaultValue: false, "If true, sets the player scan node to be red for GI's 'Scan players'. Requires GeneralImprovements to be installed."); V80Compat = Bind(config, "zzEladsHUD", "v80 utility slot compatibility", defaultValue: false, "If true, allows the utility slot to be seen when using EladsHUD in Lethal Company V80. Requires EladsHUD to be installed."); EnableEladsHUDReorder = Bind(config, "zzEladsHUD", "Reorganise EladsHUD", defaultValue: false, "If true, moves InsanityDisplay's percentage down to be in line with Stamina and Oxygen. Requires InsanityDisplay and Oxygen to be installed and configured accordingly."); FixStaminaTenPercent = Bind(config, "zzEladsHUD", "Fix stamina bar 10% cap", defaultValue: false, "If true, fixes stamina bar being unable to deplete to 0% properly."); DisableEladsHUDStaminaNotch = Bind(config, "zzEladsHUD", "Hide stamina notch", defaultValue: false, "If true, hides the notch on the stamina bar that's present during stamina drain."); HideEladsHUDWeight = Bind(config, "zzEladsHUD", "Hide weight", defaultValue: false, "If true, hides weight UI."); EladsHUDTriggerHealthShowOnHeal = Bind(config, "zzEladsHUD", "Trigger health bar popup on heal", defaultValue: false, "If true, will show health bar when health increases as well rather than when only decreasing."); EladsHUDHideStaminaPercentage = Bind(config, "zzEladsHUD", "Hide stamina number and percentage", defaultValue: false, "If true, hides number and percentage for stamina."); EladsHUDAutoHideStamina = Bind(config, "zzEladsHUD", "Autohide stamina bar", defaultValue: false, "If true, automatically hides stamina bar when at configured value for a period of time."); EladsHUDStaminaAutoHideDelay = Bind(config, "zzEladsHUD", "Stamina bar auto hide delay time", 3f, "Seconds to wait before hiding the stamina bar."); EladsHUDStaminaAutoHideStartPercent = Bind(config, "zzEladsHUD", "Autohide stamina start percent", 1f, "Percentage (0.0–1.0) at which stamina autohide begins. Example: 0.75 = 75%."); EladsHUDWeightTriggersStamina = Bind(config, "zzEladsHUD", "Weight affects stamina bar fading", defaultValue: false, "If true, stamina bar and percentage will reappear when weight updates."); EladsHUDHideOxygenPercentage = Bind(config, "zzEladsHUD", "Hide oxygen number and percentage", defaultValue: false, "If true, hides number and percentage for oxygen. Requires Oxygen to be installed."); EladsHUDAutoHideOxygen = Bind(config, "zzEladsHUD", "Autohide oxygen bar", defaultValue: false, "If true, automatically hides oxygen bar when at 100% for a period of time. Requires Oxygen to be installed."); EladsHUDAutoHideOxygenDelay = Bind(config, "zzEladsHUD", "Oxygen bar auto hide delay time", 3f, "Seconds to wait at 100% stamina before hiding the stamina bar. Requires Oxygen to be installed."); EladsHUDAutoHideOxygenValue = Bind(config, "zzEladsHUD", "AutoHideOxygenValue", 0.75f, "Oxygen HUD disappears if oxygen value > this setting."); EladsHUDHidePercentDividers = Bind(config, "zzEladsHUD", "Hide percentage dividers", defaultValue: false, "If true, hides the percentage divider UI elements. These are the small dots between each percent number. Requires Oxygen to be installed."); EladsHUDHideInsanityPercentage = Bind(config, "zzEladsHUD", "Hide insanity number and percentage", defaultValue: false, "If true, hides number and percentage for insanity. Requires InsanityDisplay to be installed."); EladsHUDAutoHideInsanity = Bind(config, "zzEladsHUD", "Autohide insanity bar", defaultValue: false, "If true, automatically hides insanity bar when at 100% for a period of time. Requires InsanityDisplay to be installed."); EladsHUDAutoHideInsanityDelay = Bind(config, "zzEladsHUD", "Insanity bar auto hide delay time", 3f, "Seconds to wait at 100% insanity before hiding the stamina bar. Requires InsanityDisplay to be installed."); } } [BepInPlugin("MrHat.NicheTweaks", "NicheTweaks", "0.4.5")] [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.*/)] [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.*/)] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.NicheTweaks"; internal const string modName = "NicheTweaks"; internal const string modVersion = "0.4.5"; internal static Harmony _harmony; internal static ManualLogSource mls; internal static Plugin? Instance; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.NicheTweaks"); _harmony = new Harmony("MrHat.NicheTweaks"); ConfigManager.CfgInit(((BaseUnityPlugin)this).Config); Keys.Init(); Log.Info("NicheTweaks initialised"); Patch(typeof(StartOfRoundPatches)); Patch(ConfigManager.SilenceRingingEarsAudio, typeof(RingingEarsAudioSilencerTweak)); Patch(ConfigManager.SilenceLightningStatic, typeof(LightningStaticAudioTweak)); Patch(ConfigManager.MuteFearAudio, typeof(FearAudioMuteTweak)); Patch(ConfigManager.EnableDecalDrawDistanceOverride, typeof(DecalDrawDistanceTweak)); Patch(ConfigManager.EnableFootprintPoolOverride, typeof(FootprintPoolOverrideTweak)); Patch(ConfigManager.EnablePlayerBlood, typeof(PlayerBloodTweak), typeof(PlayerBloodDamageTweak)); Patch(ConfigManager.FixHoarderBugManEaterTarget, typeof(HoarderBugManEaterTargetFixTweak)); Patch(ConfigManager.GrabbableToEnemiesItemBlacklistToggle, typeof(GrabbableToEnemiesBlacklistTweak)); Patch(ConfigManager.RadmechLargerHitCollider, typeof(RadmechHitColliderTweak)); Patch(ConfigManager.ButlerTallerHitCollider, typeof(ButlerTallerDamageCollider)); Patch(ConfigManager.JesterTallerHitCollider, typeof(JesterTallerDamageCollider)); Patch(ConfigManager.ButlerCollisionAdjustment, typeof(ButlerCollisionAdjustmentTweak)); Patch(ConfigManager.DisableUtilitySlot, typeof(UtilitySlotDisableTweak), typeof(UtilitySlotHUDHideTweak)); Patch(ConfigManager.PreventCheckDeadPlayersCheese, typeof(DeadPlayerCheckCheesePreventionTweak), typeof(DeadPlayerCheckCheeseTextCacheTweak)); Patch(ConfigManager.TriggerDeadlineEjectionAtZeroDays, typeof(DeadlineEjectionTweak)); Patch(ConfigManager.DisableInspectItem, typeof(ItemInspectionDisableTweak)); Patch(ConfigManager.FixZeroScaleItems, typeof(ZeroScaleItemFixTweak)); Patch(ConfigManager.DisableClock, typeof(ClockHUDHideTweak)); Patch(ConfigManager.AddClockToDeathScreen, typeof(DeathScreenClockSetupTweak), typeof(DeathScreenClockTweak)); Patch(ConfigManager.DisableChat, typeof(ChatHUDHideTweak)); Patch(ConfigManager.FixChatColon, typeof(ChatColonColorTweak)); Patch(ConfigManager.DisableCompass, typeof(CompassHUDHideTweak)); Patch(ConfigManager.DisableWeight, typeof(WeightHUDHideTweak)); if (ConfigManager.HandsFullTextPresetSelection.Value != 0) { Log.Info(((ConfigEntryBase)ConfigManager.HandsFullTextPresetSelection).Definition.Key + " enabled"); Patch(typeof(HandsFullTextPositionTweak)); } Patch(ConfigManager.ItemLightningBorder, typeof(ItemLightningBorderSetupTweak), typeof(ItemLightningBorderTweak)); Patch(ConfigManager.RemoveItemSlotFade, typeof(RemoveItemSlotFadeTweak)); Patch(ConfigManager.HideHUDAtTerminal, typeof(TerminalHUDHideTweak), typeof(TerminalHUDRestoreTweak)); Patch(ConfigManager.EnableFloodedCondensation, typeof(FloodedCondensationTweak)); Patch(ConfigManager.FixQuitGameMenuHighlightColours, typeof(QuitGameHighlightColourTweak)); Patch(ConfigManager.QuitGameColourConsistency, typeof(QuitGameTextColourTweak)); Patch(ConfigManager.HideJoinButton, typeof(JoinButtonHideTweak)); Patch(ConfigManager.HideInviteFriendsButton, typeof(InviteFriendsButtonHideTweak)); Patch(ConfigManager.HideCreditsButton, typeof(CreditsButtonHideTweak)); Patch(ConfigManager.ChangeFriendsOnlyTextToPrivate, typeof(FriendsOnlyTextToPrivateTweak)); Patch(ConfigManager.DisableControlTips, typeof(ControlTipsHideTweak)); Patch(ConfigManager.FixUtilitySlotItemIconSize, typeof(UtilitySlotIconSizeTweak)); Patch(ConfigManager.EnableTooltipRename, typeof(ControlTipItemNameTweak), typeof(ControlTipItemNameListTweak)); Patch(ConfigManager.ScanNodeOverridesToggle, typeof(ScanNodeOverrideTweak)); Patch(ConfigManager.HideWarningDisplayTipToggle, typeof(HideWarningDisplayTip)); Patch(ConfigManager.DisableFilmGrain, typeof(FilmGrainDisableTweak)); Patch(ConfigManager.BlockCustomMoonVFX, typeof(CustomMoonVFXDisableTweak), typeof(CustomMoonVFXCleanupTweak)); Patch(ConfigManager.DisableLocalPlayerSelfShadow, typeof(LocalPlayerShadowDisableTweak), typeof(HeldItemShadowDisableTweak)); if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.hasTooManyEmotes) { Patch(typeof(TooManyEmotesSelfShadowCompat)); } if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.hasLocalFlashlight) { Patch(typeof(LocalFlashlightSelfShadowCompat)); } Patch(ConfigManager.HidePlayerArms, typeof(PlayerArmsHideTweak)); Patch(ConfigManager.ToyCubeTextureFix, typeof(ToyCubeTextureFixTweak)); Patch(ConfigManager.EnableLODOverride, typeof(LODBiasOverrideSetupTweak)); Patch(ConfigManager.DisableChargeStationScanNode, typeof(ChargeStationScanNodeDisableTweak)); Patch(ConfigManager.CloseShipDoorOnLeverPull, typeof(ShipDoorCloseTweak)); Patch(ConfigManager.PlanetVideoReelDisable, typeof(PlanetVideoReelDisableTweak)); Patch(ConfigManager.EnableGlobalVolumeMeter, typeof(GlobalVoiceVolumeSliderTweak), typeof(GlobalVoiceVolumeOverlay)); Patch(ConfigManager.SavePlayerVolume, typeof(PlayerVolumeSavingTweak)); if (ConfigManager.SavePlayerVolume.Value) { SavePlayerVolumeRuntime.SaveFileSetup(); } Patch(ConfigManager.EnableDropshipPickupDelay, typeof(DropshipPickupDelayTweak)); Patch(ConfigManager.EnableShipTeleporterBlock, typeof(TeleporterItemPickupBlockTrackingTweak), typeof(TeleporterItemPickupBlockTweak), typeof(TeleporterItemPickupBlockResetTweak)); Patch(ConfigManager.EnableLandmineFix, typeof(LandmineInvisibleBumpTweak)); Patch(ConfigManager.JesterWarmup, typeof(JesterWarmupTweak)); Patch(ConfigManager.AmbientMusicWarmup, typeof(AmbientMusicPrewarmTweak)); Patch(ConfigManager.NormaliseHelmetLightBrightness, typeof(HelmetLightBrightnessTweak)); Patch(ConfigManager.UncapFPS, typeof(FpsUncapTweak)); Patch(ConfigManager.PreventErrorFromSteamImage, typeof(SteamImageErrorPreventionTweak)); if (Keys.hasDawnLib && ConfigManager.ReplaceDawnLibHotloadingPlayerImages.Value) { DawnLibHotloadingPlayerImageTweak.Load(); } PatchIf(Keys.hasDawnLib, ConfigManager.DisableAchievementPopups, typeof(DawnLibAchievementPopupTweak)); PatchIf(Keys.hasDawnLib, ConfigManager.ReplaceDawnLibHotloadingPlayerImages, typeof(DawnLibHotloadingPlayerImageTweak)); PatchIf(Keys.hasMoreBlood, ConfigManager.FixMoreBloodFootprints, typeof(MoreBloodFootprintFixTweak)); if (Keys.hasMoreCompany && (ConfigManager.HideMoreCompanyMenuButton.Value || ConfigManager.HideMoreCompanyCrewCount.Value || ConfigManager.MoreCompanyOrangeCosmeticButton.Value)) { Patch(typeof(MoreCompanyMenuTweak)); } PatchIf(Keys.hasMoreCompany, ConfigManager.HideMoreCompanyMenuButton); PatchIf(Keys.hasMoreCompany, ConfigManager.HideMoreCompanyCrewCount); PatchIf(Keys.hasMoreCompany, ConfigManager.MoreCompanyOrangeCosmeticButton); PatchIf(Keys.hasLobbyImprovements, ConfigManager.LobbyImprovementsTextEdit, typeof(LobbyImprovementsTextTweak)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesTextEdit, typeof(BetterSavesTextTweak)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesAutoRename, typeof(BetterSavesAutoRename)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesStartCreditsFix, typeof(BetterSavesStartCreditsFix)); PatchIf(Keys.hasInputUtils, ConfigManager.HideKeybindsLegacyButton, typeof(InputUtilsLegacyButtonHideTweak)); PatchIf(Keys.hasLethalConfig, ConfigManager.HideLethalConfigMenu, typeof(LethalConfigMenuButtonTweak)); PatchIf(Keys.hasLethalConfig, ConfigManager.AddSpaceToLethalConfig, typeof(LethalConfigSpacingTweak)); PatchIf(Keys.hasLethalThings, ConfigManager.EnableLIUtilBeltAlign, typeof(LethalThingsUtilityBeltTweak)); PatchIf(Keys.hasMZCoMagicShipping, ConfigManager.MZCoMagicShippingNeverRespawns, typeof(MagicShippingCrateRespawnTweak), typeof(MagicShippingCrateStartCleanupTweak)); PatchIf(Keys.hasImmersiveVisor, ConfigManager.ImmersiveVisorWorksWithHurricane, typeof(ImmersiveVisorHurricaneTweak)); PatchIf(Keys.hasShipWindows, ConfigManager.ShipWindowsOpenClose, typeof(ShipWindowsOpenCloseTweak)); PatchIf(Keys.hasLethalNuke, ConfigManager.LethalNukeFix, typeof(LethalNukeFixTweak)); PatchIf(Keys.hasMirrorDecor, ConfigManager.MirrorDecorFPSCapToggle, typeof(MirrorDecorFpsCapTweak)); PatchIf(Keys.hasEnhancedMonsters, ConfigManager.RemoveEnhancedMonstersVersionNumber, typeof(EnhancedMonstersVersionNumberRemovalTweak)); PatchIf(Keys.hasLobbyControl, ConfigManager.RemoveLobbyCommand, typeof(LobbyControlCommandRemovalTweak)); PatchIf(Keys.hasGeneralImprovements, ConfigManager.PlayerScanNodeRed, typeof(GeneralImprovementsPlayerScanNodeTweak)); if (Keys.hasEladsHUD) { Patch(ConfigManager.V80Compat, typeof(EladsHUDV80Compat)); Patch(ConfigManager.FixStaminaTenPercent, typeof(EladsHUDStaminaTenPercentTweak)); Patch(ConfigManager.EladsHUDTriggerHealthShowOnHeal, typeof(EladsHUDHealthPopupTweak)); PatchIf(Keys.hasInsanityDisplay && Keys.hasOxygen, ConfigManager.EnableEladsHUDReorder, typeof(EladsHUDStaminaReorderTweak), typeof(EladsHUDInsanityReorderTweak), typeof(EladsHUDInsanityPercentageReorderTweak), typeof(EladsHUDOxygenReorderTweak)); Patch(typeof(EladsHUDTweak)); Patch(ConfigManager.DisableEladsHUDStaminaNotch); Patch(ConfigManager.HideEladsHUDWeight); Patch(ConfigManager.EladsHUDAutoHideStamina); Patch(ConfigManager.EladsHUDWeightTriggersStamina); } PatchIf(Keys.hasEladsHUD, ConfigManager.EladsHUDHideStaminaPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDHideOxygenPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDAutoHideOxygen); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDHidePercentDividers); PatchIf(Keys.hasEladsHUD && Keys.hasInsanityDisplay, ConfigManager.EladsHUDHideInsanityPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasInsanityDisplay, ConfigManager.EladsHUDAutoHideInsanity); if ((Keys.hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value) || (Keys.hasEladsHUD && Keys.hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value)) { GameObject val = CreateRunner("MrHat.NicheTweaks.PercentageHideRunner"); if (Keys.hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value) { val.AddComponent<HideStaminaPercentageRunner>(); } if (Keys.hasEladsHUD && Keys.hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value) { val.AddComponent<HideInsanityPercentageRunner>(); } } } private static void Patch(params Type[] patchTypes) { for (int i = 0; i < patchTypes.Length; i++) { _harmony.PatchAll(patchTypes[i]); } } private static void Patch(ConfigEntry<bool> configEntry, params Type[] patchTypes) { PatchIf(condition: true, configEntry, patchTypes); } private static void PatchIf(bool condition, ConfigEntry<bool> configEntry, params Type[] patchTypes) { if (condition && configEntry.Value) { Log.Info(((ConfigEntryBase)configEntry).Definition.Key + " enabled"); Patch(patchTypes); } } private static GameObject CreateRunner(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; return val; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NicheTweaks"; public const string PLUGIN_NAME = "NicheTweaks"; public const string PLUGIN_VERSION = "0.4.5"; } } namespace NicheTweaks.Utils { internal enum HandsFullTextPreset { DefaultNoChange, BelowInventory, AboveInventory, TopOfScreen, AboveVanillaStaminaHealthUI, BelowChat, AboveTooltips } internal static class Keys { internal static bool hasLCBetterSaves { get; private set; } internal static bool hasLethalNuke { get; private set; } internal static bool hasImmersiveVisor { get; private set; } internal static bool hasLobbyImprovements { get; private set; } internal static bool hasInsanityDisplay { get; private set; } internal static bool hasEladsHUD { get; private set; } internal static bool hasOxygen { get; private set; } internal static bool hasHotbarPlus { get; private set; } internal static bool hasGeneralImprovements { get; private set; } internal static bool hasDawnLib { get; private set; } internal static bool hasLethalConfig { get; private set; } internal static bool hasMoreBlood { get; private set; } internal static bool hasMoreCompany { get; private set; } internal static bool hasLethalThings { get; private set; } internal static bool hasMZCoMagicShipping { get; private set; } internal static bool hasDiversity { get; private set; } internal static bool hasInputUtils { get; private set; } internal static bool hasTooManyEmotes { get; private set; } internal static bool hasLocalFlashlight { get; private set; } internal static bool hasShipWindows { get; private set; } internal static bool hasMisideItems { get; private set; } internal static bool hasMirrorDecor { get; private set; } internal static bool hasKeepUnlocks { get; private set; } internal static bool hasEnhancedMonsters { get; private set; } internal static bool hasLobbyControl { get; private set; } internal static void Init() { hasLCBetterSaves = Chainloader.PluginInfos.ContainsKey("LCBetterSaves"); hasLethalNuke = Chainloader.PluginInfos.ContainsKey("Lethal_Nuke"); hasImmersiveVisor = Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"); hasLobbyImprovements = Chainloader.PluginInfos.ContainsKey("uk.1a3.lobbyimprovements"); hasInsanityDisplay = Chainloader.PluginInfos.ContainsKey("InsanityDisplay.Confusified.com.GitHub"); hasEladsHUD = Chainloader.PluginInfos.ContainsKey("me.eladnlg.customhud"); hasOxygen = Chainloader.PluginInfos.ContainsKey("consequential.Oxygen"); hasHotbarPlus = Chainloader.PluginInfos.ContainsKey("FlipMods.HotbarPlus"); hasGeneralImprovements = Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements"); hasDawnLib = Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib"); hasLethalConfig = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); hasMoreBlood = Chainloader.PluginInfos.ContainsKey("FlipMods.MoreBlood"); hasMoreCompany = Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany"); hasLethalThings = Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings"); hasMZCoMagicShipping = Chainloader.PluginInfos.ContainsKey("com.github.xuuxiaolan.mzcomagicshipping"); hasDiversity = Chainloader.PluginInfos.ContainsKey("Chaos.Diversity"); hasInputUtils = Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils"); hasTooManyEmotes = Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes"); hasLocalFlashlight = Chainloader.PluginInfos.ContainsKey("command.localFlashlight"); hasShipWindows = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindows"); hasMisideItems = Chainloader.PluginInfos.ContainsKey("MrHat.MisideItems.Internals"); hasMirrorDecor = Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor"); hasKeepUnlocks = Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.keepunlocks"); hasEnhancedMonsters = Chainloader.PluginInfos.ContainsKey("com.velddev.enhancedmonsters"); hasLobbyControl = Chainloader.PluginInfos.ContainsKey("mattymatty.LobbyControl"); } } internal static class Log { internal static void Debug(string message) { Write((LogLevel)32, message); } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } internal static class SceneObjectUtils { private static readonly Dictionary<string, GameObject> cachedObjects = new Dictionary<string, GameObject>(); internal static void CacheObject(string path) { GameObject val = Find(path); if ((Object)(object)val == (Object)null) { cachedObjects.Remove(path); } else { cachedObjects[path] = val; } } internal static GameObject? GetCachedObject(string path) { GameObject value; return cachedObjects.TryGetValue(path, out value) ? value : null; } internal static void Clear() { cachedObjects.Clear(); } internal static GameObject? Find(string path) { GameObject val = GameObject.Find(path); return val ?? null; } internal static Transform? FindChild(string path, string childPath) { GameObject? obj = Find(path); return (obj != null) ? obj.transform.Find(childPath) : null; } internal static void SetActive(string path, bool active) { GameObject val = Find(path); if (val != null) { val.SetActive(active); } } internal static void SetLocalPosition(string path, Vector3 localPosition) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = Find(path); if (val != null) { val.transform.localPosition = localPosition; } } internal static void SetText(string path, string textValue) { string textValue2 = textValue; WithComponent<TextMeshProUGUI>(path, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI text) { ((TMP_Text)text).text = textValue2; }); } internal static void SetTextColor(string path, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) WithComponent<TextMeshProUGUI>(path, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI text) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)text).color = color; }); } internal static void SetImageColor(string path, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) WithComponent<Image>(path, (Action<Image>)delegate(Image image) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)image).color = color; }); } internal static void HideCanvasGroup(string path) { GameObject val = Find(path); if (!((Object)(object)val == (Object)null)) { CanvasGroupUtils.Hide(val); } } internal static void SetDirectChildObjectsActive(string path, bool active) { GameObject val = Find(path); if (!((Object)(object)val == (Object)null)) { Transform transform = val.transform; for (int i = 0; i < transform.childCount; i++) { ((Component)transform.GetChild(i)).gameObject.SetActive(active); } } } internal static void SetObjectsNamedActive(string objectName, bool active) { string objectName2 = objectName; IEnumerable<Transform> enumerable = from transform in Object.FindObjectsOfType<Transform>(true) where ((Object)transform).name == objectName2 select transform; foreach (Transform item in enumerable) { ((Component)item).gameObject.SetActive(active); } } private static void WithComponent<T>(string path, Action<T> action) where T : Component { T component = GetComponent<T>(path); if ((Object)(object)component != (Object)null) { action(component); } } private static T? GetComponent<T>(string path) where T : Component { GameObject val = Find(path); return (val != null) ? val.GetComponent<T>() : default(T); } } internal static class ResourceUtils { internal static T[] FindAll<T>() where T : Object { return Resources.FindObjectsOfTypeAll<T>(); } internal static T FindFirst<T>() where T : Object { return FindAll<T>()[0]; } internal static GameObject? FindGameObject(Func<GameObject, bool> predicate) { GameObject[] array = ResourceUtils.FindAll<GameObject>(); foreach (GameObject val in array) { if (predicate(val)) { return val; } } return null; } } internal static class CoroutineUtils { [CompilerGenerated] private sealed class <DelayThen>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public Action action; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayThen>d__0(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(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; action(); 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 <NextFrameThen>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action action; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <NextFrameThen>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; action(); 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(); } } [IteratorStateMachine(typeof(<DelayThen>d__0))] internal static IEnumerator DelayThen(float seconds, Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayThen>d__0(0) { seconds = seconds, action = action }; } [IteratorStateMachine(typeof(<NextFrameThen>d__1))] internal static IEnumerator NextFrameThen(Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <NextFrameThen>d__1(0) { action = action }; } } internal static class AudioPrewarmUtils { internal static int Prewarm(AudioSource audioSource, IEnumerable<AudioClip?> clips, HashSet<int> prewarmedClipIds) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 AudioClip clip = audioSource.clip; float volume = audioSource.volume; float time = audioSource.time; bool isPlaying = audioSource.isPlaying; int num = 0; foreach (AudioClip clip2 in clips) { if (!((Object)(object)clip2 == (Object)null) && (int)clip2.loadType != 2 && prewarmedClipIds.Add(((Object)clip2).GetInstanceID())) { audioSource.clip = clip2; audioSource.volume = 0f; audioSource.Play(); audioSource.Pause(); audioSource.Stop(); audioSource.time = 0f; num++; } } audioSource.clip = clip; audioSource.volume = volume; if (isPlaying && (Object)(object)clip != (Object)null) { audioSource.time = Mathf.Min(time, clip.length); audioSource.Play(); } else { audioSource.Stop(); } return num; } } internal static class ConfigStringUtils { internal static List<string> SplitCommaSeparated(string raw) { List<string> list = new List<string>(); if (string.IsNullOrWhiteSpace(raw)) { return list; } string[] array = raw.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0) { list.Add(text); } } return list; } internal static Dictionary<string, string> ParseAssignments(string raw, char separator) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); if (string.IsNullOrWhiteSpace(raw)) { return dictionary; } foreach (string item in SplitCommaSeparated(raw)) { int num = item.IndexOf(separator); if (num > 0 && num < item.Length - 1) { string text = item.Substring(0, num).Trim(); string text2 = item.Substring(num + 1).Trim(); if (text.Length != 0 && text2.Length != 0) { dictionary[text] = text2; } } } return dictionary; } internal static Dictionary<string, int> ParseIntAssignments(string raw, char separator, int minValue, int maxValue) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); if (string.IsNullOrWhiteSpace(raw)) { return dictionary; } foreach (string item in SplitCommaSeparated(raw)) { int num = item.LastIndexOf(separator); if (num > 0 && num < item.Length - 1) { string text = item.Substring(0, num).Trim(); string s = item.Substring(num + 1).Trim(); if (text.Length != 0 && int.TryParse(s, out var result) && result >= minValue && result <= maxValue) { dictionary[text] = result; } } } return dictionary; } } internal static class CanvasGroupUtils { internal static CanvasGroup GetOrAdd(GameObject gameObject) { CanvasGroup component = gameObject.GetComponent<CanvasGroup>(); return Object.op_Implicit((Object)(object)component) ? component : gameObject.AddComponent<CanvasGroup>(); } internal static CanvasGroup GetOrAdd(Transform transform) { return GetOrAdd(((Component)transform).gameObject); } internal static float GetAlpha(Transform transform) { CanvasGroup component = ((Component)transform).GetComponent<CanvasGroup>(); return Object.op_Implicit((Object)(object)component) ? component.alpha : 1f; } internal static void SetAlpha(Transform transform, float alpha) { GetOrAdd(((Component)transform).gameObject).alpha = alpha; } internal static void SetAlpha(float alpha, CanvasGroup? first, CanvasGroup? second, CanvasGroup? third, CanvasGroup? fourth) { if (first != null) { first.alpha = alpha; } if (second != null) { second.alpha = alpha; } if (third != null) { third.alpha = alpha; } if (fourth != null) { fourth.alpha = alpha; } } internal static void Hide(GameObject gameObject) { CanvasGroup orAdd = GetOrAdd(gameObject); orAdd.alpha = 0f; orAdd.interactable = false; orAdd.blocksRaycasts = false; } } internal static class AssetBundleUtils { internal static bool TryLoadAsset<T>(string bundleFileName, string assetPath, out T? asset, out string bundlePath) where T : Object { string path = Path.GetDirectoryName(typeof(Plugin).Assembly.Location) ?? string.Empty; bundlePath = Path.Combine(path, bundleFileName); AssetBundle val = AssetBundle.LoadFromFile(bundlePath); if ((Object)(object)val == (Object)null) { asset = default(T); return false; } asset = val.LoadAsset<T>(assetPath); val.Unload(false); return (Object)(object)asset != (Object)null; } } } namespace NicheTweaks.Tweaks.Visuals { internal static class MoonVFXBlock { private static readonly HashSet<string> moonFilterKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly Regex levelSuffixRegex = new Regex("Level$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static bool enabled; private static bool hooksInstalled; private static string? lastRawFilter; internal static void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) enabled = true; SceneHooks(); SetMoonFilter(ConfigManager.BlockCustomMoonVFXMoonFilter.Value); ApplyIfLoadedSceneIsCurrentLevel(SceneManager.GetActiveScene()); } internal static void Clear() { enabled = false; moonFilterKeys.Clear(); lastRawFilter = null; } private static void SceneHooks() { if (!hooksInstalled) { hooksInstalled = true; SceneManager.sceneLoaded += OnSceneLoaded; } } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (enabled) { ApplyIfLoadedSceneIsCurrentLevel(scene); } } private static void SetMoonFilter(string commaSeparatedMoonNames) { if (string.Equals(lastRawFilter, commaSeparatedMoonNames, StringComparison.Ordinal)) { return; } lastRawFilter = commaSeparatedMoonNames; moonFilterKeys.Clear(); if (string.IsNullOrWhiteSpace(commaSeparatedMoonNames)) { return; } foreach (string item in ConfigStringUtils.SplitCommaSeparated(commaSeparatedMoonNames)) { string text = NormaliseMoonKey(item); if (!string.IsNullOrWhiteSpace(text)) { moonFilterKeys.Add(text); } } } private static string NormaliseMoonKey(string raw) { if (string.IsNullOrWhiteSpace(raw)) { return string.Empty; } string input = raw.Trim(); return levelSuffixRegex.Replace(input, string.Empty).Trim(); } private static bool LevelMatchesFilter(SelectableLevel level) { if (moonFilterKeys.Count == 0) { return true; } string text = NormaliseMoonKey(((Object)level).name); return !string.IsNullOrWhiteSpace(text) && moonFilterKeys.Contains(text); } private static void ApplyIfLoadedSceneIsCurrentLevel(Scene loadedScene) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Scene)(ref loadedScene)).IsValid() || !((Scene)(ref loadedScene)).isLoaded || string.Equals(((Scene)(ref loadedScene)).name, "SampleSceneRelay", StringComparison.OrdinalIgnoreCase)) { return; } SelectableLevel val = StartOfRound.Instance?.currentLevel; if (!((Object)(object)val == (Object)null) && LevelMatchesFilter(val)) { string sceneName = val.sceneName; if (!string.IsNullOrWhiteSpace(sceneName) && string.Equals(((Scene)(ref loadedScene)).name, sceneName, StringComparison.Ordinal)) { DisableVFXInScene(loadedScene, out var vfxFound, out var vfxDisabled, out var volumesFound, out var volumesDisabled); Log.Debug($"moon scene vfx disabled in {((Scene)(ref loadedScene)).name} with {vfxDisabled} of {vfxFound} effects and {volumesDisabled} of {volumesFound} volumes"); } } } private static void DisableVFXInScene(Scene scene, out int vfxFound, out int vfxDisabled, out int volumesFound, out int volumesDisabled) { vfxFound = 0; vfxDisabled = 0; volumesFound = 0; volumesDisabled = 0; GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { if ((Object)(object)val == (Object)null) { continue; } VisualEffect[] componentsInChildren = val.GetComponentsInChildren<VisualEffect>(true); foreach (VisualEffect val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { vfxFound++; if (((Behaviour)val2).enabled) { ((Behaviour)val2).enabled = false; vfxDisabled++; } } } Volume[] componentsInChildren2 = val.GetComponentsInChildren<Volume>(true); foreach (Volume val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null)) { volumesFound++; bool flag = false; if (((Behaviour)val3).enabled) { ((Behaviour)val3).enabled = false; flag = true; } if (val3.weight > 0f) { val3.weight = 0f; flag = true; } if (flag) { volumesDisabled++; } } } } } } [HarmonyPatch(typeof(RoundManager), "Start")] internal static class CustomMoonVFXDisableTweak { [HarmonyPostfix] private static void Postfix() { MoonVFXBlock.Start(); } } [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] internal static class CustomMoonVFXCleanupTweak { [HarmonyPostfix] private static void Postfix() { MoonVFXBlock.Clear(); } } [HarmonyPatch(typeof(FilmGrain))] internal static class FilmGrainDisableTweak { [HarmonyPatch("IsActive")] [HarmonyPrefix] private static bool Prefix(ref bool __result) { __result = false; return false; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] internal static class LODBiasOverrideSetupTweak { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { HDAdditionalCameraData cam = default(HDAdditionalCameraData); if (((Component)__instance.gameplayCamera).TryGetComponent<HDAdditionalCameraData>(ref cam)) { LODBiasOverride.Apply(cam); } } } internal static class LODBiasOverride { internal static void Apply(HDAdditionalCameraData cam) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) cam.customRenderingSettings = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true; ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true); ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true); cam.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2; cam.renderingPathCustomFrameSettings.lodBias = ConfigManager.LODBias.Value; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class PlayerArmsHideTweak { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { ((Renderer)__instance.thisPlayerModelArms).enabled = false; } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] internal static class ToyCubeTextureFixTweak { private const string BundleFileName = "toycubefixassets"; private const string MaterialAssetPath = "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat"; private static Material? fixedToyCubeMaterial; [HarmonyPostfix] private static void OnGameNetworkManagerStart() { if ((Object)(object)fixedToyCubeMaterial == (Object)null && !AssetBundleUtils.TryLoadAsset<Material>("toycubefixassets", "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat", out fixedToyCubeMaterial, out string bundlePath)) { Log.Error("toy cube material missing from asset bundle at " + bundlePath); return; } GameObject[] array = ResourceUtils.FindAll<GameObject>(); GrabbableObject val2 = default(GrabbableObject); foreach (GameObject val in array) { if (!val.TryGetComponent<GrabbableObject>(ref val2)) { continue; } Item itemProperties = val2.itemProperties; if (!((Object)(object)itemProperties == (Object)null) && IsToyCubeName(itemProperties.itemName)) { MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(true); if (!((Object)(object)componentInChildren == (Object)null)) { ((Renderer)componentInChildren).sharedMaterial = fixedToyCubeMaterial; break; } } } } private static bool IsToyCubeName(string itemName) { if (string.IsNullOrWhiteSpace(itemName)) { return false; } string text = itemName.Replace(" ", ""); return text.Equals("ToyCube", StringComparison.OrdinalIgnoreCase); } } } namespace NicheTweaks.Tweaks.Visuals.PlayerSelfShadow { internal static class HeldItemShadowDisableTweak { [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] [HarmonyPostfix] private static void GrabItemPostfix(GrabbableObject __instance) { Refresh(__instance); } [HarmonyPatch(typeof(GrabbableObject), "EquipItem")] [HarmonyPostfix] private static void EquipItemPostfix(GrabbableObject __instance) { Refresh(__instance); } [HarmonyPatch(typeof(GrabbableObject), "DiscardItem")] [HarmonyPostfix] private static void DiscardItemPostfix(GrabbableObject __instance) { if (__instance.hasHitGround) { HeldItemShadowCache.RestoreIfGrounded(__instance); } } [HarmonyPatch(typeof(GrabbableObject), "OnHitGround")] [HarmonyPostfix] private static void OnHitGroundPostfix(GrabbableObject __instance) { HeldItemShadowCache.RestoreIfGrounded(__instance); } internal static void RefreshHeldItems(PlayerControllerB player) { if ((Object)(object)player == (Object)null || player.ItemSlots == null) { return; } for (int i = 0; i < player.ItemSlots.Length; i++) { GrabbableObject val = player.ItemSlots[i]; if (!((Object)(object)val == (Object)null)) { Refresh(val); } } } private static void Refresh(GrabbableObject item) { if ((Object)(object)item == (Object)null) { return; } if (!item.isHeld) { if (item.hasHitGround) { HeldItemShadowCache.RestoreIfGrounded(item); } return; } PlayerControllerB playerHeldBy = item.playerHeldBy; if (playerHeldBy != null && ((NetworkBehaviour)playerHeldBy).IsOwner) { HeldItemShadowCache.Cache(item); if (LocalPlayerShadowDisableTweak.ShouldHideHeldItemShadows(playerHeldBy)) { HeldItemShadowCache.ApplyHeld(item); } else { HeldItemShadowCache.Restore(item); } } } } internal static class HeldItemShadowCache { private class CachedItemShadowState { public readonly CachedRendererShadowState[] Renderers; public readonly bool HasAnyShadowEnabled; public bool ShadowsHidden; public CachedItemShadowState(CachedRendererShadowState[] renderers, bool hasAnyShadowEnabled) { Renderers = renderers; HasAnyShadowEnabled = hasAnyShadowEnabled; base..ctor(); } } private readonly struct CachedRendererShadowState { public readonly Renderer Renderer; public readonly ShadowCastingMode ShadowCastingMode; public CachedRendererShadowState(Renderer renderer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Renderer = renderer; ShadowCastingMode = renderer.shadowCastingMode; } } private static readonly Dictionary<GrabbableObject, CachedItemShadowState> cachedItems = new Dictionary<GrabbableObject, CachedItemShadowState>(); internal static void Cache(GrabbableObject item) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 if ((Object)(object)item == (Object)null || cachedItems.ContainsKey(item)) { return; } Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren<Renderer>(true); List<CachedRendererShadowState> list = new List<CachedRendererShadowState>(componentsInChildren.Length); bool hasAnyShadowEnabled = false; foreach (Renderer val in componentsInChildren) { if (val is MeshRenderer || val is SkinnedMeshRenderer) { list.Add(new CachedRendererShadowState(val)); if ((int)val.shadowCastingMode > 0) { hasAnyShadowEnabled = true; } } } if (list.Count != 0) { cachedItems[item] = new CachedItemShadowState(list.ToArray(), hasAnyShadowEnabled); } } internal static void ApplyHeld(GrabbableObject item) { if (item == null || !item.isHeld || !cachedItems.TryGetValue(item, out CachedItemShadowState value) || !value.HasAnyShadowEnabled || value.ShadowsHidden) { return; } for (int i = 0; i < value.Renderers.Length; i++) { Renderer renderer = value.Renderers[i].Renderer; if (!((Object)(object)renderer == (Object)null)) { renderer.shadowCastingMode = (ShadowCastingMode)0; } } value.ShadowsHidden = true; } internal static void Restore(GrabbableObject item) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || !cachedItems.TryGetValue(item, out CachedItemShadowState value) || !value.HasAnyShadowEnabled || !value.ShadowsHidden) { return; } for (int i = 0; i < value.Renderers.Length; i++) { CachedRendererShadowState cachedRendererShadowState = value.Renderers[i]; if (!((Object)(object)cachedRendererShadowState.Renderer == (Object)null)) { cachedRendererShadowState.Renderer.shadowCastingMode = cachedRendererShadowState.ShadowCastingMode; } } value.ShadowsHidden = false; } internal static void RestoreIfGrounded(GrabbableObject item) { if (item != null && item.hasHitGround) { Restore(item); } } internal static void Clear() { cachedItems.Clear(); } } [HarmonyPatch] internal static class LocalFlashlightSelfShadowCompat { private static FieldInfo? cachedPublicFlashStateField; [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method("LocalFlashlight.LightScript:Toggle", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { LocalPlayerShadowDisableTweak.Refresh(val); } } private static bool GetPublicFlashState() { if (cachedPublicFlashStateField == null) { Type type = Type.GetType("LocalFlashlight.LightScript, LocalFlashlight"); if (type == null) { return false; } cachedPublicFlashStateField = type.GetField("publicFlashState", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (cachedPublicFlashStateField == null) { return false; } } return (bool)cachedPublicFlashStateField.GetValue(null); } internal static bool IsLocalFlashlightOn() { return GetPublicFlashState(); } } [HarmonyPatch] internal static class LocalPlayerShadowDisableTweak { [CompilerGenerated] private sealed class <DelayedRefresh>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedRefresh>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; Refresh(); 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 HashSet<FlashlightItem> cachedFlashlights = new HashSet<FlashlightItem>(); private static PlayerControllerB? cachedPlayer; private static SkinnedMeshRenderer? cachedLod1Renderer; private static SkinnedMeshRenderer? cachedLod2Renderer; private static bool CacheRenderers(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if (!((NetworkBehaviour)player).IsOwner) { return false; } if ((Object)(object)cachedPlayer == (Object)(object)player && ((Object)(object)cachedLod1Renderer != (Object)null || (Object)(object)cachedLod2Renderer != (Object)null)) { return true; } cachedPlayer = player; Transform val = ((Component)player).transform.Find("ScavengerModel"); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = val.Find("LOD1"); Transform val3 = val.Find("LOD2"); cachedLod1Renderer = ((val2 != null) ? ((Component)val2).GetComponent<SkinnedMeshRenderer>() : null); cachedLod2Renderer = ((val3 != null) ? ((Component)val3).GetComponent<SkinnedMeshRenderer>() : null); return (Object)(object)cachedLod1Renderer != (Object)null || (Object)(object)cachedLod2Renderer != (Object)null; } private static void SetLODRenderers(PlayerControllerB player, bool enabled) { if (CacheRenderers(player)) { SkinnedMeshRenderer? obj = cachedLod1Renderer; if (obj != null) { ((Renderer)obj).enabled = enabled; } SkinnedMeshRenderer? obj2 = cachedLod2Renderer; if (obj2 != null) { ((Renderer)obj2).enabled = enabled; } } } internal static void RegisterFlashlight(FlashlightItem flashlight) { if (!((Object)(object)flashlight == (Object)null)) { cachedFlashlights.Add(flashlight); } } internal static void UnregisterFlashlight(FlashlightItem flashlight) { if (!((Object)(object)flashlight == (Object)null)) { cachedFlashlights.Remove(flashlight); } } internal static void ClearCache() { cachedFlashlights.Clear(); cachedPlayer = null; cachedLod1Renderer = null; cachedLod2Renderer = null; } private static void Refresh(PlayerControllerB player, bool hide) { SetLODRenderers(player, !hide); } private static bool ShouldHidePlayerSelfShadow(PlayerControllerB player) { if (player == null || !((NetworkBehaviour)player).IsOwner) { return false; } if (Keys.hasLocalFlashlight && LocalFlashlightSelfShadowCompat.IsLocalFlashlightOn()) { return true; } bool flag = IsAnyFlashlightOn(player); Light helmetLight = player.helmetLight; bool flag2 = helmetLight != null && ((Behaviour)helmetLight).enabled; return flag || flag2; } internal static bool ShouldHideHeldItemShadows(PlayerControllerB player) { if (player == null || !((NetworkBehaviour)player).IsOwner) { return false; } return !TooManyEmotesSelfShadowCompat.IsLocalPlayerEmoting() && ((Keys.hasLocalFlashlight && LocalFlashlightSelfShadowCompat.IsLocalFlashlightOn()) || IsAnyFlashlightOn(player)); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] private static void Postfix_StartOfRound() { ClearCache(); } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "Start")] private static void Postfix_FlashlightStart(FlashlightItem __instance) { RegisterFlashlight(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ChangeHelmetLight")] private static void Postfix_ChangeHelmetLight(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { Refresh(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void Postfix_PlayerStart(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { Refresh(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] private static void Postfix_SwitchFlashlight(FlashlightItem __instance) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner) { Refresh(playerHeldBy); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "DiscardItem")] private static void Postfix_DropFlashlight() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).IsOwner) { Refresh(val); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] private static void Postfix_EquipFlashlight(FlashlightItem __instance) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner) { Refresh(playerHeldBy); } } internal static void Refresh(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { bool hide = !TooManyEmotesSelfShadowCompat.IsLocalPlayerEmoting() && ShouldHidePlayerSelfShadow(player); Refresh(player, hide); HeldItemShadowDisableTweak.RefreshHeldItems(player); } } private static void Refresh() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { Refresh(val); } } internal static void ApplyHideFromEmote(PlayerControllerB player) { Refresh(player, hide: true); HeldItemShadowDisableTweak.RefreshHeldItems(player); } internal static void ApplyShowFromEmote(PlayerControllerB player) { Refresh(player, hide: false); HeldItemShadowDisableTweak.RefreshHeldItems(player); } private static bool IsAnyFlashlightOn(PlayerControllerB player) { if (cachedFlashlights.Count == 0) { return false; } List<FlashlightItem> list = null; bool result = false; foreach (FlashlightItem cachedFlashlight in cachedFlashlights) { if ((Object)(object)cachedFlashlight == (Object)null) { if (list == null) { list = new List<FlashlightItem>(); } list.Add(cachedFlashlight); } else if (!((Object)(object)((GrabbableObject)cachedFlashlight).playerHeldBy != (Object)(object)player) && ((GrabbableObject)cachedFlashlight).isBeingUsed) { result = true; break; } } if (list != null) { for (int i = 0; i < list.Count; i++) { cachedFlashlights.Remove(list[i]); } } return result; } internal static void RefreshLocalPlayerNextFrame() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { ((MonoBehaviour)val).StartCoroutine(DelayedRefresh()); } } [IteratorStateMachine(typeof(<DelayedRefresh>d__25))] private static IEnumerator DelayedRefresh() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedRefresh>d__25(0); } } [HarmonyPatch] internal static class TooManyEmotesSelfShadowCompat { private static bool localPlayerIsEmoting; internal static bool IsLocalPlayerEmoting() { return localPlayerIsEmoting; } [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStartCustomEmoteLocal")] [HarmonyPostfix] private static void OnStartEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { localPlayerIsEmoting = true; LocalPlayerShadowDisableTweak.ApplyShowFromEmote(val); } } [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStopCustomEmoteLocal")] [HarmonyPostfix] private static void OnStopEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { localPlayerIsEmoting = false; LocalPlayerShadowDisableTweak.Refresh(val); LocalPlayerShadowDisableTweak.RefreshLocalPlayerNextFrame(); } } } } namespace NicheTweaks.Tweaks.Ship { [HarmonyPatch(typeof(StartOfRound), "Start")] internal static class ChargeStationScanNodeDisableTweak { [HarmonyPostfix] private static void OnStart() { SceneObjectUtils.SetActive("Environment/HangarShip/ShipModels2b/ChargeStation/ScanNode (1)", active: false); } } [HarmonyPatch] internal static class PlanetVideoReelDisableTweak { internal class StayDisabledForever : MonoBehaviour { private void Awake() { if (((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(false); } } private void OnEnable() { ((Component)this).gameObject.SetActive(false); } } private static GameObject? planetVideoReel; [HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")] [HarmonyPatch(typeof(StartOfRound), "PlayerLoadedClientRpc")] [HarmonyPatch(typeof(StartOfRound), "PlayerLoadedServerRpc")] [HarmonyPostfix] private static void Postfix() { if ((Object)(object)planetVideoReel == (Object)null) { planetVideoReel = SceneObjectUtils.Find("MapScreenUI/PlanetVideoReel"); } if (!((Object)(object)planetVideoReel == (Object)null) && (Object)(object)planetVideoReel.GetComponent<StayDisabledForever>() == (Object)null) { planetVideoReel.AddComponent<StayDisabledForever>(); } } } [HarmonyPatch] internal static class ShipDoorCloseTweak { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnApply; } private const string Request = "MrHat.NicheTweaks.ShipDoorClose.Request"; private const string Apply = "MrHat.NicheTweaks.ShipDoorClose.Apply"; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRoundStartPostfix() { Wired(); } [HarmonyPatch(typeof(StartMatchLever), "StartGame")] [HarmonyPostfix] private static void StartMatchLeverStartGamePostfix() { Wired(); SendRequest(); } private static void Wired() { //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_0047: Expected O, but got Unknown //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_006e: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; customMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Request"); customMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Apply"); object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Request", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnApply; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnApply; <>O.<1>__OnApply = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Apply", (HandleNamedMessageDelegate)obj2); } private static void SendRequest() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessage("MrHat.NicheTweaks.ShipDoorClose.Request", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void OnRequest(ulong sender, FastBufferReader reader) { if (NetworkManager.Singleton.IsServer) { Broadcast(); ApplyLocal(); } } private static void OnApply(ulong sender, FastBufferReader reader) { ApplyLocal(); } private static void Broadcast() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessageToAll("MrHat.NicheTweaks.ShipDoorClose.Apply", val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void ApplyLocal() { StartOfRound instance = StartOfRound.Instance; HangarShipDoor val = Object.FindObjectOfType<HangarShipDoor>(); instance.SetShipDoorsClosed(true); val.PlayDoorAnimation(true); val.SetDoorButtonsEnabled(false); } } } namespace NicheTweaks.Tweaks.QoL { internal static class AmbientMusicPrewarmTweak { [CompilerGenerated] private sealed class <GetAmbientMusicClips>d__2 : IEnumerable<AudioClip>, IEnumerable, IEnumerator<AudioClip>, IEnumerator, IDisposable { private int <>1__state; private AudioClip? <>2__current; private int <>l__initialThreadId; private SoundManager soundManager; public SoundManager <>3__soundManager; private AudioClip[] <>s__1; private int <>s__2; private AudioClip <clip>5__3; private AudioClip[] <>s__4; private int <>s__5; private AudioClip <clip>5__6; AudioClip IEnumerator<AudioClip>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetAmbientMusicClips>d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <clip>5__3 = null; <>s__4 = null; <clip>5__6 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = soundManager.DaytimeMusic; <>s__2 = 0; goto IL_008d; case 1: <>1__state = -1; <clip>5__3 = null; <>s__2++; goto IL_008d; case 2: { <>1__state = -1; <clip>5__6 = null; <>s__5++; break; } IL_008d: if (<>s__2 < <>s__1.Length) { <clip>5__3 = <>s__1[<>s__2]; <>2__current = <clip>5__3; <>1__state = 1; return true; } <>s__1 = null; <>s__4 = soundManager.EveningMusic; <>s__5 = 0; break; } if (<>s__5 < <>s__4.Length) { <clip>5__6 = <>s__4[<>s__5]; <>2__current = <clip>5__6; <>1__state = 2; return true; } <>s__4 = null; 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(); } [DebuggerHidden] IEnumerator<AudioClip> IEnumerable<AudioClip>.GetEnumerator() { <GetAmbientMusicClips>d__2 <GetAmbientMusicClips>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetAmbientMusicClips>d__ = this; } else { <GetAmbientMusicClips>d__ = new <GetAmbientMusicClips>d__2(0); } <GetAmbientMusicClips>d__.soundManager = <>3__soundManager; return <GetAmbientMusicClips>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<AudioClip>)this).GetEnumerator(); } } private static readonly HashSet<int> prewarmedClipIds = new HashSet<int>(); [HarmonyPatch(typeof(SoundManager), "Start")] [HarmonyPostfix] private static void Postfix(SoundManager __instance) { AudioSource musicSource = __instance.musicSource; if ((Object)(object)musicSource == (Object)null) { Log.Debug("ambient music warmup skipped because music source was not ready"); return; } Stopwatch stopwatch = Stopwatch.StartNew(); int num = AudioPrewarmUtils.Prewarm(musicSource, GetAmbientMusicClips(__instance), prewarmedClipIds); stopwatch.Stop(); Log.Debug($"ambient music warmup completed in {stopwatch.Elapsed.TotalMilliseconds:F2} ms with {num} clips prewarmed"); } [IteratorStateMachine(typeof(<GetAmbientMusicClips>d__2))] private static IEnumerable<AudioClip?> GetAmbientMusicClips(SoundManager soundManager) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetAmbientMusicClips>d__2(-2) { <>3__soundManager = soundManager }; } } internal static class DropshipPickupDelayTweak { private static float blockUntilTime; private static bool blockActive; internal static void StartCooldown(float seconds) { blockUntilTime = Time.time + seconds; blockActive = true; } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] [HarmonyPrefix] private static bool Prefix() { if (!blockActive) { return true; } if (Time.time >= blockUntilTime) { blockActive = false; return true; } return false; } [HarmonyPatch(typeof(InteractTrigger), "Interact")] [H