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.1
NicheTweaks.dll
Decompiled a week 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 DiversityRemastered.Misc; using DiversityRemastered.Monsters; using DiversityRemastered.ScriptableObjects; using GameNetcodeStuff; using HarmonyLib; using KeepUnlocks; using LCBetterSaves; using LethalThings; using Lethal_Nuke; using Microsoft.CodeAnalysis; using NicheTweaks; using NicheTweaks.ExternalTweaks.BetterSavesImprovedLobby; using NicheTweaks.ExternalTweaks.DawnLib; using NicheTweaks.ExternalTweaks.Diversity; 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.KeepUnlocks; using NicheTweaks.ExternalTweaks.LethalConfig; using NicheTweaks.ExternalTweaks.LethalNuke; using NicheTweaks.ExternalTweaks.LethalThings; using NicheTweaks.ExternalTweaks.LobbyControl; using NicheTweaks.ExternalTweaks.MagicShippingCrate; using NicheTweaks.ExternalTweaks.MoreBlood; using NicheTweaks.ExternalTweaks.MoreCompany; using NicheTweaks.ExternalTweaks.ShipWindows; using NicheTweaks.Helpers; using NicheTweaks.NetcodePatcher; using NicheTweaks.Patches; using NicheTweaks.Tweaks; using NicheTweaks.Tweaks.ButlerNavMeshAgentReduction; using NicheTweaks.Tweaks.GlobalVolumeSlider; using NicheTweaks.Tweaks.InteractCooldowns; using NicheTweaks.Tweaks.ItemTooltipRenamer; using NicheTweaks.Tweaks.LightningOverlay; using NicheTweaks.Tweaks.PlayerBloodSpill; using NicheTweaks.Tweaks.PlayerSelfShadow; using NicheTweaks.Tweaks.PlayerVolumeSaving; using NicheTweaks.Tweaks.PlayerVolumeSaving.MonoBehaviours; using NicheTweaks.Tweaks.ShipDoorClose; using NicheTweaks.Tweaks.VFX; 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.InputSystem; 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.1.0")] [assembly: AssemblyInformationalVersion("0.4.1")] [assembly: AssemblyProduct("NicheTweaks")] [assembly: AssemblyTitle("NicheTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal class MirrorDecorPatches { private static GameObject mirrorCameraObject; private static void SetMirrorCameraFramerate() { mirrorCameraObject = ((Component)FindRootObject("Mirror").transform.Find("MirrorFrame/MirrorMesh/Camera")).gameObject; mirrorCameraObject.AddComponent<MirrorCameraFramerateController>(); } private static GameObject FindRootObject(string name) { return Array.Find(Resources.FindObjectsOfTypeAll<GameObject>(), (GameObject x) => ((Object)x).name == name && (Object)(object)x.transform.parent == (Object)null && (Object)(object)x.transform.Find("MirrorFrame/MirrorMesh/Camera") != (Object)null); } [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPostfix] private static void Postfix(TimeOfDay __instance) { ((MonoBehaviour)__instance).StartCoroutine(CoroutineHelper.Delay(3f, SetMirrorCameraFramerate)); } } internal class MirrorCameraFramerateController : MonoBehaviour { private Camera mirrorCamera; private PlayerControllerB localPlayerController; private float elapsed; private void Start() { mirrorCamera = ((Component)this).GetComponent<Camera>(); localPlayerController = StartOfRound.Instance.localPlayerController; ((Behaviour)mirrorCamera).enabled = false; } private void OnEnable() { elapsed = 0f; } private void Update() { if (!localPlayerController.isInHangarShipRoom) { elapsed = 0f; return; } float num = 1f / (float)ConfigManager.MirrorDecorFPSCap.Value; elapsed += Time.deltaTime; if (!(elapsed < num)) { elapsed -= num; mirrorCamera.Render(); } } } internal static class DropshipItemInteractCooldown { private static float blockUntilTime; private static bool blockActive; internal static void StartCooldown(float seconds) { blockUntilTime = Time.time + seconds; blockActive = true; Plugin.mls.LogDebug((object)string.Format("[{0}] Dropship cooldown started. Blocking all interact input for {1} seconds.", "NicheTweaks", seconds)); } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] [HarmonyPrefix] private static bool Prefix(PlayerControllerB __instance, CallbackContext context) { if (!blockActive) { return true; } if (Time.time >= blockUntilTime) { blockActive = false; Plugin.mls.LogDebug((object)"[NicheTweaks] Cooldown ended. Interact input restored."); return true; } Plugin.mls.LogDebug((object)("[NicheTweaks] BLOCKED interact performed for player " + __instance.playerUsername + " (cooldown active)")); return false; } [HarmonyPatch(typeof(InteractTrigger), "Interact")] [HarmonyPostfix] private static void Postfix(InteractTrigger __instance) { ItemDropship componentInParent = ((Component)__instance).GetComponentInParent<ItemDropship>(); if (!((Object)(object)componentInParent == (Object)null)) { StartCooldown(ConfigManager.DropshipPickupDelayTime.Value); } } } 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> 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> ButlerCollisionAdjustment { get; private set; } internal static ConfigEntry<bool> DisableUtilitySlot { get; private set; } internal static ConfigEntry<bool> PreventCheckDeadPlayersCheese { 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> 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> ChangeFriendsOnlyTextToPrivate { get; private set; } internal static ConfigEntry<bool> DisableControlTips { 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> 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> DisableInspectItem { 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> UncapFPS { get; private set; } internal static ConfigEntry<bool> PreventErrorFromSteamImage { get; private set; } internal static ConfigEntry<bool> DisableAchievementPopups { 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> 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> FixDisabledWatcherSoftlock { 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> KeepUnlocksExtraShipUpgradesToggle { get; private set; } internal static ConfigEntry<string> KeepUnlocksExtraShipUpgrades { 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."); 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."); 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."); 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."); 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."); 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)."); 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!"); 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."); 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."); DisableInspectItem = Bind(config, "Visuals", "Disable item inspection", defaultValue: false, "If true, disables the ability to inspect items."); 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, attempts to bypass the lag spike of the Jester when it starts to wind up for the first time in an instance by doing it at the start of the day."); 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, "EXPERIMENTAL | If true, fixes a vanilla bug that causes harmless errors to be thrown when players join a lobby. I don't know if this works because I don't have two steam accounts."); DisableAchievementPopups = Bind(config, "zOther mods", "Hide and mute DawnLib achievement popups", defaultValue: false, "If true, hides DawnLib's achievement popup and sound."); 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."); 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."); FixDisabledWatcherSoftlock = Bind(config, "zOther mods", "Prevent softlock from disabled watcher", defaultValue: false, "If true, fixes the softlock when launching the ship when the watcher is disabled. Requires Diversity 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."); KeepUnlocksExtraShipUpgradesToggle = Bind(config, "zOther mods", "KeepUnlocks extra ship upgrades toggle", defaultValue: false, "If true, enables extra unlockables that can be saved upon being fired via KeepUnlocks. Requires KeepUnlocks to be installed."); KeepUnlocksExtraShipUpgrades = Bind(config, "zOther mods", "KeepUnlocks extra ship upgrades list", string.Empty, "Unlockables that KeepUnlocks should save alongside the default, uses unlockable names (see in terminal) and is separated by commas. E.g. 'HouseTeleporter,Bodycam,Shutter'. Requires KeepUnlocks to be installed and 'Keep upgrades' enabled in KeepUnlocks config."); 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.1")] [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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.NicheTweaks"; internal const string modName = "NicheTweaks"; internal const string modVersion = "0.4.1"; 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); ChainloaderPluginKeys.Init(); ApplyPatches(); StartRunners(); } private static void Patch(params Type[] patchTypes) { for (int i = 0; i < patchTypes.Length; i++) { _harmony.PatchAll(patchTypes[i]); } } private static void PatchIf(bool condition, params Type[] patchTypes) { if (condition) { mls.LogDebug((object)("[NicheTweaks] Patch ran: " + patchTypes[0].Name)); 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; } private static void StartRunners() { if (ChainloaderPluginKeys.EladsHUDHideStaminaPercentageOn || ChainloaderPluginKeys.EladsHUDHideInsanityPercentageOn) { GameObject val = CreateRunner("PercentageHideRunner"); if (ChainloaderPluginKeys.EladsHUDHideStaminaPercentageOn) { val.AddComponent<HideStaminaPercentageRunner>(); } if (ChainloaderPluginKeys.EladsHUDHideInsanityPercentageOn) { val.AddComponent<HideInsanityPercentageRunner>(); } } if (ChainloaderPluginKeys.EladsHUDAutoHideInsanityOn) { CreateRunner("InsanityAutoHideRunner").AddComponent<InsanityAutoHideUpdate>(); } if (ChainloaderPluginKeys.EladsHUDAutoHideOxygenOn) { CreateRunner("OxygenAutoHideRunner").AddComponent<OxygenAutoHideUpdate>(); } } private static void ApplyPatches() { PatchIf(ChainloaderPluginKeys.PlayerScanNodeRedOn, typeof(GeneralImprovementsPatches)); PatchIf(ChainloaderPluginKeys.PreventErrorFromSteamImageOn, typeof(GetTextureFromImagePatch)); PatchIf(ChainloaderPluginKeys.PreventCheckDeadPlayersCheeseOn, typeof(SubmitChat_performedPatch)); PatchIf(ChainloaderPluginKeys.RemoveLobbyCommandOn, typeof(LobbyControlPatches)); PatchIf(ChainloaderPluginKeys.EladsHUDV80CompatOn, typeof(EladsHUDV80Compat)); PatchIf(ChainloaderPluginKeys.UncapFPSOn, typeof(IngamePlayerSettingsPatches)); PatchIf(ChainloaderPluginKeys.DisableUtilitySlotOn, typeof(DisableUtilitySlot), typeof(UseUtilitySlot_performedPatch)); PatchIf(ChainloaderPluginKeys.SavePlayerVolumeOn, typeof(SavePlayerVolumePatches)); if (ChainloaderPluginKeys.SavePlayerVolumeOn) { SavePlayerVolumeRuntime.SaveFileSetup(); } PatchIf(ChainloaderPluginKeys.KeepUnlocksExtraShipUpgradesOn, typeof(KeepUnlocksPatches)); PatchIf(ChainloaderPluginKeys.MirrorDecorFPSCapOn, typeof(MirrorDecorPatches)); PatchIf(ChainloaderPluginKeys.RemoveEnhancedMonstersVersionNumberOn, typeof(EnhancedMonstersPatches)); PatchIf(ChainloaderPluginKeys.JesterWarmupOn, typeof(JesterAIPatches)); PatchIf(ChainloaderPluginKeys.RadmechLargerHitColliderOn, typeof(RadMechAIPatches)); PatchIf(ChainloaderPluginKeys.DiversityWatcherOn, typeof(DiversitySpawnEnemyPatch)); PatchIf(ChainloaderPluginKeys.ChangeFriendsOnlyTextToPrivateOn, typeof(MenuManagerClickHostButtonPatches)); PatchIf(ChainloaderPluginKeys.FixHoarderBugManEaterTargetOn, typeof(HoarderBugAIPatch)); PatchIf(ChainloaderPluginKeys.GrabbableToEnemiesItemBlacklistToggleOn, typeof(GrabbableToEnemiesBlacklist)); PatchIf(ChainloaderPluginKeys.LethalNukeFixOn, typeof(NuclearBombPatches)); PatchIf(ChainloaderPluginKeys.FixChatColonOn, typeof(AddChatMessagePatch)); PatchIf(ChainloaderPluginKeys.ShipWindowsOpenCloseOn, typeof(ShipWindowsPatches)); PatchIf(ChainloaderPluginKeys.ImmersiveVisorHurricaneOn, typeof(ImmersiveVisorTranspiler)); PatchIf(ChainloaderPluginKeys.SilenceLightningStaticOn, typeof(EntranceTeleportPatches)); PatchIf(ChainloaderPluginKeys.ItemLightningBorderOn, typeof(LightningBorderHUDManagerStartPatch), typeof(LightningBorderPatches)); PatchIf(ChainloaderPluginKeys.SilenceRingingEarsAudioOn, typeof(SetEarsRingingPatch)); PatchIf(ChainloaderPluginKeys.BetterSavesTextOn, typeof(BetterSavesPatches)); PatchIf(ChainloaderPluginKeys.LobbyImprovementsTextOn, typeof(ImprovedLobbyPatches)); PatchIf(ChainloaderPluginKeys.ShipTeleporterBlockCheckOn, typeof(ShipTeleporterBeamCoroutinePatch), typeof(Interact_performedPatch)); PatchIf(ChainloaderPluginKeys.DawnlibAchievementsOn, typeof(DawnLibAchievementPopupPatch)); PatchIf(ChainloaderPluginKeys.HideLethalConfigMenuOn, typeof(HideMainMenuLethalConfig)); PatchIf(ChainloaderPluginKeys.AddSpaceToLethalConfigOn, typeof(LethalConfigSpaceInsert)); PatchIf(ChainloaderPluginKeys.MoreBloodOn, typeof(MoreBloodPatch)); PatchIf(ChainloaderPluginKeys.MZCoMagicShippingDestroyOn, typeof(MagicShippingCratePatch), typeof(MagicShippingCrateDestroyOnLoadPatch)); PatchIf(ChainloaderPluginKeys.HideMoreCompanyMenuButtonOn, typeof(MoreCompanyCosmeticsPatch)); PatchIf(ChainloaderPluginKeys.HideMoreCompanyCrewCountOn, typeof(MoreCompanyCrewCountPatchOnline), typeof(MoreCompanyCrewCountPatchLAN)); PatchIf(ChainloaderPluginKeys.MoreCompanyOrangeLogoOn, typeof(MoreCompanySetColourHUDManagerPatch), typeof(MoreCompanySetColourMenuManagerPatch)); PatchIf(ChainloaderPluginKeys.LethalThingsUIBeltAlignmentAllowedOn, typeof(LethalThingsPatch)); PatchIf(ChainloaderPluginKeys.EladsHUDAutoHideStaminaOn, typeof(StaminaAutoHide)); PatchIf(ChainloaderPluginKeys.FixStaminaTenPercentOn, typeof(StaminaTenPercentFix)); PatchIf(ChainloaderPluginKeys.EladsHUDTriggerHealthShowOnHealOn, typeof(HealthAppearOnHeal)); PatchIf(ChainloaderPluginKeys.EladsHUDReorderOn, typeof(EladsHUDStaminaCompat), typeof(InsanityDisplayCompat), typeof(InsanityDisplayPercentagePatch), typeof(OxygenCompat)); PatchIf(ChainloaderPluginKeys.DecalProjectorPatchOn, typeof(DecalProjectorPatch)); PatchIf(ChainloaderPluginKeys.FilmGrainPatchOn, typeof(FilmGrainPatch)); PatchIf(ChainloaderPluginKeys.HelmetCondensationDropsPatchOn, typeof(HelmetCondensationDropsPatch)); PatchIf(ChainloaderPluginKeys.DropshipItemInteractCooldownOn, typeof(DropshipItemInteractCooldown)); PatchIf(ChainloaderPluginKeys.InspectItemPatchOn, typeof(InspectItemPatch)); PatchIf(ChainloaderPluginKeys.ItemTooltipRenamerOn, typeof(ItemTooltipRenamer)); PatchIf(ChainloaderPluginKeys.LandminePatchesOn, typeof(LandminePatches)); PatchIf(ChainloaderPluginKeys.SetClockPatchOn, typeof(SetClockPatch)); PatchIf(ChainloaderPluginKeys.PlayerBloodNetworkOn, typeof(PlayerBloodSpill), typeof(DamagePlayerPatch)); PatchIf(ChainloaderPluginKeys.PlayerSelfShadowPatchOn, typeof(PlayerSelfShadowPatch)); PatchIf(ChainloaderPluginKeys.PlayerSelfShadowPatchOn, typeof(GrabbableObjectShadowPatch)); PatchIf(ChainloaderPluginKeys.TooManyEmotesCompat, typeof(TooManyEmotesCompat)); PatchIf(ChainloaderPluginKeys.LocalFlashlightCompat, typeof(LocalFlashlightCompat)); PatchIf(ChainloaderPluginKeys.GlobalVolumeMeterOn, typeof(GlobalVolumeSlider), typeof(GlobalVoiceOverlay)); PatchIf(ChainloaderPluginKeys.FootprintPoolOverrideOn, typeof(InstantiateFootprintsPooledObjectsPatch)); PatchIf(ChainloaderPluginKeys.PlayerArmsHiddenOn, typeof(PlayerControllerBUpdatePatch)); PatchIf(ChainloaderPluginKeys.HideKeybindsLegacyInputUtilsOn, typeof(KepRemapPanelPatch)); PatchIf(ChainloaderPluginKeys.HideHUDAtTerminalOn, typeof(BeginUsingTerminalPatch), typeof(QuitTerminalPatch)); PatchIf(ChainloaderPluginKeys.LODOverrideOn, typeof(PlayerControllerBStart)); PatchIf(ChainloaderPluginKeys.CloseShipDoorOnLeverPullOn, typeof(StartMatchLeverPatches)); Patch(typeof(StartOfRoundStartPatches), typeof(StartOfRoundOnDestroyPatches), typeof(HUDManagerPatches), typeof(MenuManagerStartPatches), typeof(QuickMenuManagerPatches), typeof(RoundManagerPatches), typeof(GameNetworkManagerPatches), typeof(StartOfRoundIHATETIMINGSPatch)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NicheTweaks"; public const string PLUGIN_NAME = "NicheTweaks"; public const string PLUGIN_VERSION = "0.4.1"; } } namespace NicheTweaks.Utils { internal static class ChainloaderPluginKeys { 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 bool TooManyEmotesCompat { get; private set; } internal static bool LocalFlashlightCompat { get; private set; } internal static bool DawnlibAchievementsOn { get; private set; } internal static bool EladsHUDReorderOn { get; private set; } internal static bool DiversityWatcherOn { get; private set; } internal static bool MoreCompanyOrangeLogoOn { get; private set; } internal static bool HideKeybindsLegacyInputUtilsOn { get; private set; } internal static bool LethalThingsUIBeltAlignmentAllowedOn { get; private set; } internal static bool MZCoMagicShippingDestroyOn { get; private set; } internal static bool MoreBloodOn { get; private set; } internal static bool DividerToggleOn { get; private set; } internal static bool OxygenPercentToggleOn { get; private set; } internal static bool EladsHUDWeightToggleOn { get; private set; } internal static bool HideLethalConfigMenuOn { get; private set; } internal static bool AddSpaceToLethalConfigOn { get; private set; } internal static bool HideMoreCompanyMenuButtonOn { get; private set; } internal static bool HideMoreCompanyCrewCountOn { get; private set; } internal static bool EladsHUDHideStaminaPercentageOn { get; private set; } internal static bool EladsHUDHideInsanityPercentageOn { get; private set; } internal static bool EladsHUDAutoHideStaminaOn { get; private set; } internal static bool FixStaminaTenPercentOn { get; private set; } internal static bool EladsHUDTriggerHealthShowOnHealOn { get; private set; } internal static bool EladsHUDAutoHideInsanityOn { get; private set; } internal static bool EladsHUDAutoHideOxygenOn { get; private set; } internal static bool LobbyImprovementsTextOn { get; private set; } internal static bool BetterSavesTextOn { get; private set; } internal static bool ImmersiveVisorHurricaneOn { get; private set; } internal static bool ShipWindowsOpenCloseOn { get; private set; } internal static bool LethalNukeFixOn { get; private set; } internal static bool KeepUnlocksExtraShipUpgradesOn { get; private set; } internal static bool MirrorDecorFPSCapOn { get; private set; } internal static bool RemoveEnhancedMonstersVersionNumberOn { get; private set; } internal static bool EladsHUDV80CompatOn { get; private set; } internal static bool RemoveLobbyCommandOn { get; private set; } internal static bool PlayerScanNodeRedOn { get; private set; } internal static bool DecalProjectorPatchOn { get; private set; } internal static bool FilmGrainPatchOn { get; private set; } internal static bool HelmetCondensationDropsPatchOn { get; private set; } internal static bool DropshipItemInteractCooldownOn { get; private set; } internal static bool InspectItemPatchOn { get; private set; } internal static bool ItemTooltipRenamerOn { get; private set; } internal static bool LandminePatchesOn { get; private set; } internal static bool SetClockPatchOn { get; private set; } internal static bool PlayerBloodNetworkOn { get; private set; } internal static bool PlayerSelfShadowPatchOn { get; private set; } internal static bool GlobalVolumeMeterOn { get; private set; } internal static bool FootprintPoolOverrideOn { get; private set; } internal static bool PlayerArmsHiddenOn { get; private set; } internal static bool HideHUDAtTerminalOn { get; private set; } internal static bool LODOverrideOn { get; private set; } internal static bool CloseShipDoorOnLeverPullOn { get; private set; } internal static bool ToyCubeTextureFixOn { get; private set; } internal static bool ShipTeleporterBlockCheckOn { get; private set; } internal static bool BlockCustomMoonVFXOn { get; private set; } internal static bool SilenceRingingEarsAudioOn { get; private set; } internal static bool ItemLightningBorderOn { get; private set; } internal static bool SilenceLightningStaticOn { get; private set; } internal static bool FixChatColonOn { get; private set; } internal static bool GrabbableToEnemiesItemBlacklistToggleOn { get; private set; } internal static bool FixHoarderBugManEaterTargetOn { get; private set; } internal static bool ChangeFriendsOnlyTextToPrivateOn { get; private set; } internal static bool JesterWarmupOn { get; private set; } internal static bool RadmechLargerHitColliderOn { get; private set; } internal static bool SavePlayerVolumeOn { get; private set; } internal static bool DisableUtilitySlotOn { get; private set; } internal static bool UncapFPSOn { get; private set; } internal static bool PreventCheckDeadPlayersCheeseOn { get; private set; } internal static bool PreventErrorFromSteamImageOn { 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"); DawnlibAchievementsOn = hasDawnLib && ConfigManager.DisableAchievementPopups.Value; EladsHUDReorderOn = hasInsanityDisplay && hasEladsHUD && hasOxygen && ConfigManager.EnableEladsHUDReorder.Value; DiversityWatcherOn = hasDiversity && ConfigManager.FixDisabledWatcherSoftlock.Value; MoreCompanyOrangeLogoOn = hasMoreCompany && ConfigManager.MoreCompanyOrangeCosmeticButton.Value; HideKeybindsLegacyInputUtilsOn = hasInputUtils && ConfigManager.HideKeybindsLegacyButton.Value; LethalThingsUIBeltAlignmentAllowedOn = hasLethalThings && ConfigManager.EnableLIUtilBeltAlign.Value; MZCoMagicShippingDestroyOn = hasMZCoMagicShipping && ConfigManager.MZCoMagicShippingNeverRespawns.Value; MoreBloodOn = hasMoreBlood && ConfigManager.FixMoreBloodFootprints.Value; DividerToggleOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDHidePercentDividers.Value; OxygenPercentToggleOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDHideOxygenPercentage.Value; EladsHUDWeightToggleOn = hasEladsHUD && ConfigManager.HideEladsHUDWeight.Value; HideLethalConfigMenuOn = hasLethalConfig && ConfigManager.HideLethalConfigMenu.Value; AddSpaceToLethalConfigOn = hasLethalConfig && ConfigManager.AddSpaceToLethalConfig.Value; HideMoreCompanyMenuButtonOn = hasMoreCompany && ConfigManager.HideMoreCompanyMenuButton.Value; HideMoreCompanyCrewCountOn = hasMoreCompany && ConfigManager.HideMoreCompanyCrewCount.Value; EladsHUDHideStaminaPercentageOn = hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value; EladsHUDHideInsanityPercentageOn = hasEladsHUD && hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value; EladsHUDAutoHideStaminaOn = hasEladsHUD && ConfigManager.EladsHUDAutoHideStamina.Value; FixStaminaTenPercentOn = hasEladsHUD && ConfigManager.FixStaminaTenPercent.Value; EladsHUDTriggerHealthShowOnHealOn = hasEladsHUD && ConfigManager.EladsHUDTriggerHealthShowOnHeal.Value; EladsHUDAutoHideInsanityOn = hasEladsHUD && hasInsanityDisplay && ConfigManager.EladsHUDAutoHideInsanity.Value; EladsHUDAutoHideOxygenOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDAutoHideOxygen.Value; LobbyImprovementsTextOn = hasLobbyImprovements && ConfigManager.LobbyImprovementsTextEdit.Value; BetterSavesTextOn = hasLCBetterSaves && ConfigManager.BetterSavesTextEdit.Value; ImmersiveVisorHurricaneOn = hasImmersiveVisor && ConfigManager.ImmersiveVisorWorksWithHurricane.Value; ShipWindowsOpenCloseOn = hasShipWindows && ConfigManager.ShipWindowsOpenClose.Value; LethalNukeFixOn = hasLethalNuke && ConfigManager.LethalNukeFix.Value; KeepUnlocksExtraShipUpgradesOn = hasKeepUnlocks && ConfigManager.KeepUnlocksExtraShipUpgradesToggle.Value; MirrorDecorFPSCapOn = hasMirrorDecor && ConfigManager.MirrorDecorFPSCapToggle.Value; RemoveEnhancedMonstersVersionNumberOn = hasEnhancedMonsters && ConfigManager.RemoveEnhancedMonstersVersionNumber.Value; EladsHUDV80CompatOn = hasEladsHUD && ConfigManager.V80Compat.Value; RemoveLobbyCommandOn = hasLobbyControl && ConfigManager.RemoveLobbyCommand.Value; PlayerScanNodeRedOn = hasGeneralImprovements && ConfigManager.PlayerScanNodeRed.Value; DecalProjectorPatchOn = ConfigManager.EnableDecalDrawDistanceOverride.Value; FilmGrainPatchOn = ConfigManager.DisableFilmGrain.Value; HelmetCondensationDropsPatchOn = ConfigManager.EnableFloodedCondensation.Value; DropshipItemInteractCooldownOn = ConfigManager.EnableDropshipPickupDelay.Value; InspectItemPatchOn = ConfigManager.DisableInspectItem.Value; ItemTooltipRenamerOn = ConfigManager.EnableTooltipRename.Value; LandminePatchesOn = ConfigManager.EnableLandmineFix.Value; SetClockPatchOn = ConfigManager.AddClockToDeathScreen.Value; PlayerBloodNetworkOn = ConfigManager.EnablePlayerBlood.Value; PlayerSelfShadowPatchOn = ConfigManager.DisableLocalPlayerSelfShadow.Value; TooManyEmotesCompat = PlayerSelfShadowPatchOn && hasTooManyEmotes; LocalFlashlightCompat = PlayerSelfShadowPatchOn && hasLocalFlashlight; GlobalVolumeMeterOn = ConfigManager.EnableGlobalVolumeMeter.Value; FootprintPoolOverrideOn = ConfigManager.EnableFootprintPoolOverride.Value; PlayerArmsHiddenOn = ConfigManager.HidePlayerArms.Value; HideHUDAtTerminalOn = ConfigManager.HideHUDAtTerminal.Value; LODOverrideOn = ConfigManager.EnableLODOverride.Value; CloseShipDoorOnLeverPullOn = ConfigManager.CloseShipDoorOnLeverPull.Value; ToyCubeTextureFixOn = ConfigManager.ToyCubeTextureFix.Value; ShipTeleporterBlockCheckOn = ConfigManager.EnableShipTeleporterBlock.Value; BlockCustomMoonVFXOn = ConfigManager.BlockCustomMoonVFX.Value; SilenceRingingEarsAudioOn = ConfigManager.SilenceRingingEarsAudio.Value; ItemLightningBorderOn = ConfigManager.ItemLightningBorder.Value; SilenceLightningStaticOn = ConfigManager.SilenceLightningStatic.Value; FixChatColonOn = ConfigManager.FixChatColon.Value; GrabbableToEnemiesItemBlacklistToggleOn = ConfigManager.GrabbableToEnemiesItemBlacklistToggle.Value; FixHoarderBugManEaterTargetOn = ConfigManager.FixHoarderBugManEaterTarget.Value; ChangeFriendsOnlyTextToPrivateOn = ConfigManager.ChangeFriendsOnlyTextToPrivate.Value; JesterWarmupOn = ConfigManager.JesterWarmup.Value; RadmechLargerHitColliderOn = ConfigManager.RadmechLargerHitCollider.Value; SavePlayerVolumeOn = ConfigManager.SavePlayerVolume.Value; DisableUtilitySlotOn = ConfigManager.DisableUtilitySlot.Value; UncapFPSOn = ConfigManager.UncapFPS.Value; PreventCheckDeadPlayersCheeseOn = ConfigManager.PreventCheckDeadPlayersCheese.Value; PreventErrorFromSteamImageOn = ConfigManager.PreventErrorFromSteamImage.Value; } } internal enum HandsFullTextPreset { DefaultNoChange, BelowInventory, AboveInventory, TopOfScreen, AboveVanillaStaminaHealthUI, BelowChat, AboveTooltips } } namespace NicheTweaks.Tweaks { [HarmonyPatch(typeof(GrabbableObject), "Start")] internal static class GrabbableToEnemiesBlacklist { private static readonly HashSet<string> BlacklistedItemNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static string cachedBlacklist = string.Empty; private static void RefreshBlacklist() { string text = ConfigManager.GrabbableToEnemiesItemBlacklist.Value ?? string.Empty; if (cachedBlacklist == text) { return; } cachedBlacklist = text; BlacklistedItemNames.Clear(); foreach (string item in ConfigStringHelper.SplitCommaSeparated(text)) { BlacklistedItemNames.Add(item); } Plugin.mls.LogDebug((object)$"Loaded grabbable to enemies item blacklist entries: {BlacklistedItemNames.Count}"); } private static bool IsBlacklisted(GrabbableObject item) { RefreshBlacklist(); return (Object)(object)item.itemProperties != (Object)null && !string.IsNullOrWhiteSpace(item.itemProperties.itemName) && BlacklistedItemNames.Contains(item.itemProperties.itemName); } private static void Postfix(GrabbableObject __instance) { if (IsBlacklisted(__instance)) { __instance.grabbableToEnemies = false; HoarderBugAI.grabbableObjectsInMap.Remove(((Component)__instance).gameObject); Plugin.mls.LogDebug((object)("Hoarder bug blacklisted item: " + __instance.itemProperties.itemName)); } } } internal static class HUDManagerTweaks { internal static TextMeshProUGUI deathScreenClock; internal static void DisableClock() { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.transform.Find("Container"); if ((Object)(object)val2 != (Object)null) { for (int i = 0; i < val2.childCount; i++) { Transform child = val2.GetChild(i); if ((Object)(object)child.Find("TimeNumber") != (Object)null && (Object)(object)child.Find("Image") != (Object)null) { ((Component)child).gameObject.SetActive(false); break; } } } UIPathHelper.SetActive("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota/ShipLeavingIcon", active: false); } internal static void AddClockToDeathScreen() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota/Container/Box/TimeNumber"); if (!((Object)(object)val == (Object)null)) { GameObject val2 = GameObject.Find("Systems/UI/Canvas/DeathScreen/SpectateUI"); if (!((Object)(object)val2 == (Object)null)) { GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "DeathScreenClock"; val3.SetActive(true); RectTransform component = val3.GetComponent<RectTransform>(); ((Transform)component).localScale = new Vector3(0.8f, 0.8f, 0.8f); ((Transform)component).localPosition = new Vector3(-369.5971f, 217.0461f, 0f); deathScreenClock = val3.GetComponentInChildren<TextMeshProUGUI>(); } } } internal static void DisableChat() { UIPathHelper.SetDirectChildrenActive("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner", active: false); } internal static void DisableCompass() { UIPathHelper.SetAllNamedActive("CompassImage", active: false); } internal static void DisableControlTips() { string text = "Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner/"; UIPathHelper.SetCanvasGroupHidden(text + "ControlTip1"); UIPathHelper.SetCanvasGroupHidden(text + "ControlTip2"); UIPathHelper.SetCanvasGroupHidden(text + "ControlTip3"); UIPathHelper.SetCanvasGroupHidden(text + "ControlTip4"); } internal static void DisableWeightUI() { UIPathHelper.SetActive("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI", active: false); } internal static void RepositionHandsFullText() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) HandsFullTextPreset value = ConfigManager.HandsFullTextPresetSelection.Value; if (value == HandsFullTextPreset.DefaultNoChange) { return; } GameObject val = GameObject.Find("UI/Canvas/IngamePlayerHUD"); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = val.transform.Find("HandsFullText"); if (Object.op_Implicit((Object)(object)val2)) { Vector3 localPosition = default(Vector3); Vector3 zero = default(Vector3); Vector3 localScale = default(Vector3); float num; switch (value) { default: return; case HandsFullTextPreset.BelowInventory: ((Vector3)(ref localPosition))..ctor(0f, -262.6901f, 24.8253f); zero = Vector3.zero; ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.AboveInventory: ((Vector3)(ref localPosition))..ctor(0f, -153.6261f, 24.8253f); zero = Vector3.zero; ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.TopOfScreen: ((Vector3)(ref localPosition))..ctor(0f, 230.464f, 24.8253f); zero = Vector3.zero; ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.AboveVanillaStaminaHealthUI: ((Vector3)(ref localPosition))..ctor(-327.2649f, 216.0129f, 24.8253f); zero = Vector3.zero; ((Vector3)(ref localScale))..ctor(1.4248f, 1.4248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.BelowChat: ((Vector3)(ref localPosition))..ctor(-343.9384f, -248.2916f, 24.8253f); ((Vector3)(ref zero))..ctor(0f, 0f, 4.3f); ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 0.366f; break; case HandsFullTextPreset.AboveTooltips: ((Vector3)(ref localPosition))..ctor(377.8974f, 205.0974f, 24.8253f); ((Vector3)(ref zero))..ctor(0f, 16.8352f, 0f); ((Vector3)(ref localScale))..ctor(1.2f, 1.2f, 1.7248f); num = 1f; break; } val2.localPosition = localPosition; val2.localRotation = Quaternion.Euler(zero); val2.localScale = localScale; TextMeshProUGUI component = ((Component)val2).GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component)) { Color color = ((Graphic)component).color; color.a = Mathf.Clamp01(num); ((Graphic)component).color = color; } } } internal static void DisableUtilitySlot() { UIPathHelper.SetActive("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/UtilitySlot", active: false); } } internal class IngamePlayerSettingsTweaks { internal static void UncapFPS() { Application.targetFrameRate = -1; } } internal static class MenuManagerTweaks { internal static void HideJoinButtons() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) UIPathHelper.SetActive("Canvas/MenuContainer/MainButtons/StartLAN", active: false); UIPathHelper.SetActive("Canvas/MenuContainer/MainButtons/JoinACrew", active: false); UIPathHelper.SetLocalPosition("Canvas/MenuContainer/MainButtons/HostButton", new Vector3(-259.5365f, -81.5155f, -2f)); } internal static void ChangeFriendsOnlyTextToPrivate() { UIPathHelper.SetTmpText("Canvas/MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Private/Text (TMP)", "Private"); } } internal static class QuickMenuManagerTweaks { internal static void FixConfirmLeaveGameHighlightColors() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.431f, 0f, 0.49f); UIPathHelper.SetImageColor("UI/Canvas/QuickMenu/ConfirmLeaveGame", color); UIPathHelper.SetImageColor("UI/Canvas/QuickMenu/ConfirmLeaveGame/Quit (1)/SelectionHighlight", color); UIPathHelper.SetImageColor("UI/Canvas/QuickMenu/ConfirmLeaveGame/Quit (2)/SelectionHighlight", color); } internal static void QuitGameColourConsistency() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) UIPathHelper.SetTmpColor("Systems/UI/Canvas/QuickMenu/ConfirmLeaveGame/Text (TMP) (1)", new Color(1f, 0.5647f, 0f, 1f)); } } internal static class ScanNodeOverride { internal static void ApplyConfiguredScanNodeTypes() { string value = ConfigManager.ScanNodeOverrides.Value; if (string.IsNullOrWhiteSpace(value)) { return; } Dictionary<string, int> dictionary = ParseOverrides(value); if (dictionary.Count == 0) { return; } GameObject[] allGameObjects = Resources.FindObjectsOfTypeAll<GameObject>(); foreach (KeyValuePair<string, int> item in dictionary) { ApplyOverride(allGameObjects, item.Key, item.Value); } } private static Dictionary<string, int> ParseOverrides(string configValue) { return ConfigStringHelper.ParseIntAssignments(configValue, ':', 0, 2); } private static void ApplyOverride(GameObject[] allGameObjects, string gameObjectName, int scanNodeType) { foreach (GameObject val in allGameObjects) { if (((Object)val).name != gameObjectName) { continue; } ScanNodeProperties[] componentsInChildren = val.GetComponentsInChildren<ScanNodeProperties>(true); if (componentsInChildren.Length != 0) { for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].nodeType = scanNodeType; } Plugin.mls.LogDebug((object)(((Object)val).name + " scan node changed to " + GetScanNodeColorName(scanNodeType) + "!")); } } } private static string GetScanNodeColorName(int scanNodeType) { if (1 == 0) { } string result = scanNodeType switch { 0 => "Blue", 1 => "Red", 2 => "Green", _ => scanNodeType.ToString(), }; if (1 == 0) { } return result; } } internal static class StartOfRoundTweaks { internal class StayDisabledForever : MonoBehaviour { private void Awake() { if (((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(false); Plugin.mls.LogDebug((object)$"Prevented {((Component)this).gameObject} from enabling itself"); } } private void OnEnable() { ((Component)this).gameObject.SetActive(false); } } private static GameObject PlanetVideoReel; internal static void FindScanNodeAndSetInactive() { UIPathHelper.SetActive("Environment/HangarShip/ShipModels2b/ChargeStation/ScanNode (1)", active: false); } internal static void AddPlanetVideoReelDisabler() { if (!Object.op_Implicit((Object)(object)PlanetVideoReel)) { PlanetVideoReel = GameObject.Find("MapScreenUI/PlanetVideoReel"); } if (Object.op_Implicit((Object)(object)PlanetVideoReel) && !Object.op_Implicit((Object)(object)PlanetVideoReel.GetComponent<StayDisabledForever>())) { PlanetVideoReel.AddComponent<StayDisabledForever>(); } } } internal static class ToyCubeMaterialOverride { private static Material fixedToyCubeMaterial; internal static void Apply() { if ((Object)(object)fixedToyCubeMaterial == (Object)null) { string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location); string text = Path.Combine(directoryName, "toycubefixassets"); AssetBundle val = AssetBundle.LoadFromFile(text); fixedToyCubeMaterial = val.LoadAsset<Material>("Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat"); } GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); GrabbableObject val3 = default(GrabbableObject); foreach (GameObject val2 in array) { if (!val2.TryGetComponent<GrabbableObject>(ref val3)) { continue; } Item itemProperties = val3.itemProperties; if (!((Object)(object)itemProperties == (Object)null) && IsToyCubeName(itemProperties.itemName)) { MeshRenderer componentInChildren = val2.GetComponentInChildren<MeshRenderer>(true); if (!((Object)(object)componentInChildren == (Object)null)) { ((Renderer)componentInChildren).sharedMaterial = fixedToyCubeMaterial; Plugin.mls.LogInfo((object)"ToyCube fixed material applied"); 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.VFX { [HarmonyPatch(typeof(DecalProjector), "Awake")] internal static class DecalProjectorPatch { private const float DecalDistance = 1001f; [HarmonyPostfix] private static void Postfix(DecalProjector __instance) { typeof(DecalProjector).GetField("m_DrawDistance", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, 1001f); } } [HarmonyPatch(typeof(FilmGrain))] internal static class FilmGrainPatch { [HarmonyPatch("IsActive")] [HarmonyPrefix] private static bool Prefix(ref bool __result) { __result = false; return false; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] internal static class PlayerControllerBStart { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { HDAdditionalCameraData component = ((Component)__instance.gameplayCamera).GetComponent<HDAdditionalCameraData>(); if ((Object)(object)component != (Object)null) { LODPatch.Apply(component); } } } internal static class LODPatch { 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; } } 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 BlockVFX(string commaSeparatedMoonNames) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) enabled = true; SceneHooks(); SetMoonFilterInternal(commaSeparatedMoonNames); 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 SetMoonFilterInternal(string commaSeparatedMoonNames) { if (string.Equals(lastRawFilter, commaSeparatedMoonNames, StringComparison.Ordinal)) { return; } lastRawFilter = commaSeparatedMoonNames; moonFilterKeys.Clear(); if (string.IsNullOrWhiteSpace(commaSeparatedMoonNames)) { return; } string[] array = commaSeparatedMoonNames.Split(','); for (int i = 0; i < array.Length; i++) { string text = NormaliseMoonKey(array[i]); 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)(object)level != (Object)null) ? ((Object)level).name : null); if (string.IsNullOrWhiteSpace(text)) { return false; } return moonFilterKeys.Contains(text); } private static void ApplyIfLoadedSceneIsCurrentLevel(Scene loadedScene) { //IL_00a5: 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); Plugin.mls.LogDebug((object)string.Format("[{0}] Loaded Scene={1} VFX Found={2} VFX Disabled={3} Volumes Found={4} Volumes Disabled={5}", "NicheTweaks", ((Scene)(ref loadedScene)).name, vfxFound, vfxDisabled, volumesFound, volumesDisabled)); } } } 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++; } } } } } } } namespace NicheTweaks.Tweaks.ShipDoorClose { internal static class ShipDoorClose { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnApply; } private const string Request = "ShipDoorCloseRequest"; private const string Apply = "ShipDoorCloseApply"; internal 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("ShipDoorCloseRequest"); customMessagingManager.UnregisterNamedMessageHandler("ShipDoorCloseApply"); object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("ShipDoorCloseRequest", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnApply; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnApply; <>O.<1>__OnApply = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("ShipDoorCloseApply", (HandleNamedMessageDelegate)obj2); } 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("ShipDoorCloseApply", val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } internal 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("ShipDoorCloseRequest", 0uL, 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.PlayerVolumeSaving { internal static class SavePlayerVolume { private static GameObject controllerObject; private static SavePlayerVolumeController controller; internal static void Create() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!((Object)(object)controllerObject != (Object)null)) { controllerObject = new GameObject("SavePlayerVolume Controller"); Object.DontDestroyOnLoad((Object)(object)controllerObject); controller = controllerObject.AddComponent<SavePlayerVolumeController>(); controller.RefreshFromShipPhase(); } } internal static void RefreshControllerState() { if (!((Object)(object)controller == (Object)null)) { controller.RefreshFromShipPhase(); } } } internal static class SavePlayerVolumePatches { [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPostfix] private static void RoundManagerStartPostfix() { SavePlayerVolume.Create(); SavePlayerVolume.RefreshControllerState(); } [HarmonyPatch(typeof(QuickMenuManager), "Start")] [HarmonyPostfix] private static void QuickMenuStartPostfix(QuickMenuManager __instance) { SavePlayerVolumeRuntime.RegisterQuickMenu(__instance); SavePlayerVolumeRuntime.LoadFromFile(); SavePlayerVolume.RefreshControllerState(); } [HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")] [HarmonyPostfix] private static void CloseQuickMenuPostfix() { SavePlayerVolumeRuntime.SaveCurrentVolumes(); SavePlayerVolume.RefreshControllerState(); } [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] [HarmonyPostfix] private static void StartOfRoundDestroyPostfix() { SavePlayerVolumeRuntime.ClearQuickMenu(); SavePlayerVolume.RefreshControllerState(); } [HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")] [HarmonyPostfix] private static void ResetPlayersLoadedValueClientRpcPostfix() { SavePlayerVolume.RefreshControllerState(); } [HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")] [HarmonyPostfix] private static void SetShipReadyToLandPostfix() { SavePlayerVolume.RefreshControllerState(); } } internal static class SavePlayerVolumeRuntime { private static readonly Dictionary<string, float> savedVolumes = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase); private static QuickMenuManager quickMenuManager; private static string savePath; private static float? savedGlobalVolume; private static bool pendingGlobalRestore; internal static void SaveFileSetup() { savePath = Path.Combine(Application.persistentDataPath, "NicheTweaksPlayerVolumes.txt"); if (!File.Exists(savePath)) { File.WriteAllText(savePath, string.Empty); } } internal static void RegisterQuickMenu(QuickMenuManager instance) { quickMenuManager = instance; } internal static void ClearQuickMenu() { quickMenuManager = null; } internal static void LoadFromFile() { savedVolumes.Clear(); savedGlobalVolume = null; pendingGlobalRestore = false; if (!File.Exists(savePath)) { return; } string[] array = File.ReadAllLines(savePath); foreach (string text in array) { if (string.IsNullOrWhiteSpace(text)) { continue; } string[] array2 = text.Split(';'); if (array2.Length == 2) { ulong result2; float result3; if (array2[0].Equals("global", StringComparison.OrdinalIgnoreCase)) { if (float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { savedGlobalVolume = result; } } else if (ulong.TryParse(array2[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out result2) && float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out result3)) { savedVolumes["steam:" + result2.ToString(CultureInfo.InvariantCulture)] = result3; } continue; } int num = text.IndexOf(';'); if (num < 0) { continue; } int num2 = text.IndexOf(';', num + 1); if (num2 < 0) { continue; } string text2 = text.Substring(0, num); string text3 = text.Substring(num + 1, num2 - num - 1); string text4 = text; int num3 = num2 + 1; string s = text4.Substring(num3, text4.Length - num3); if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result4)) { continue; } if (text2.Equals("steam", StringComparison.OrdinalIgnoreCase)) { if (ulong.TryParse(text3, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result5)) { savedVolumes["steam:" + result5.ToString(CultureInfo.InvariantCulture)] = result4; } } else if (text2.Equals("name", StringComparison.OrdinalIgnoreCase)) { string text5 = DecodePlayerName(text3); if (!string.IsNullOrWhiteSpace(text5)) { savedVolumes["name:" + text5.Trim()] = result4; } } } pendingGlobalRestore = savedGlobalVolume.HasValue && ChainloaderPluginKeys.GlobalVolumeMeterOn; } internal static void ApplySavedVolumes() { if ((Object)(object)quickMenuManager == (Object)null || quickMenuManager.playerListSlots == null) { return; } PlayerListSlot[] playerListSlots = quickMenuManager.playerListSlots; foreach (PlayerListSlot val in playerListSlots) { if (val.isConnected && !((Object)(object)val.volumeSlider == (Object)null) && val.volumeSlider.value == 0f && TryGetPlayerKey(val, out var playerKey) && savedVolumes.TryGetValue(playerKey, out var value)) { val.volumeSlider.value = value; } } TryRestoreGlobalSlider(); } internal static void SaveCurrentVolumes() { if ((Object)(object)quickMenuManager == (Object)null || quickMenuManager.playerListSlots == null) { return; } PlayerListSlot[] playerListSlots = quickMenuManager.playerListSlots; foreach (PlayerListSlot val in playerListSlots) { if (val.isConnected && !((Object)(object)val.volumeSlider == (Object)null)) { float value = val.volumeSlider.value; if (value != 0f && TryGetPlayerKey(val, out var playerKey)) { savedVolumes[playerKey] = value; } } } if (ChainloaderPluginKeys.GlobalVolumeMeterOn && (Object)(object)GlobalVoiceOverlay.GlobalSlider != (Object)null) { savedGlobalVolume = GlobalVoiceOverlay.GlobalSlider.value; } else { savedGlobalVolume = null; } SaveToFile(); Plugin.mls.LogDebug((object)$"Saved player volumes. Total entries: {savedVolumes.Count}"); } private static bool TryGetPlayerKey(PlayerListSlot playerListSlot, out string playerKey) { if (playerListSlot.playerSteamId != 0) { playerKey = "steam:" + playerListSlot.playerSteamId.ToString(CultureInfo.InvariantCulture); return true; } string text = ((TMP_Text)playerListSlot.usernameHeader).text.Trim(); if (text.Length != 0) { playerKey = "name:" + text; return true; } playerKey = null; return false; } private static void TryRestoreGlobalSlider() { if (pendingGlobalRestore && savedGlobalVolume.HasValue) { Slider globalSlider = GlobalVoiceOverlay.GlobalSlider; if (!((Object)(object)globalSlider == (Object)null)) { globalSlider.SetValueWithoutNotify(savedGlobalVolume.Value); pendingGlobalRestore = false; } } } private static void SaveToFile() { List<string> list = new List<string>(savedVolumes.Count + (savedGlobalVolume.HasValue ? 1 : 0)); if (savedGlobalVolume.HasValue) { list.Add("global;" + savedGlobalVolume.Value.ToString(CultureInfo.InvariantCulture)); } foreach (KeyValuePair<string, float> savedVolume in savedVolumes) { string text = savedVolume.Value.ToString(CultureInfo.InvariantCulture); if (savedVolume.Key.StartsWith("steam:", StringComparison.Ordinal)) { string key = savedVolume.Key; list.Add("steam;" + key.Substring(6, key.Length - 6) + ";" + text); } else if (savedVolume.Key.StartsWith("name:", StringComparison.Ordinal)) { string key = savedVolume.Key; list.Add("name;" + EncodePlayerName(key.Substring(5, key.Length - 5)) + ";" + text); } } File.WriteAllLines(savePath, list); } private static string EncodePlayerName(string playerName) { return Convert.ToBase64String(Encoding.UTF8.GetBytes(playerName)); } private static string DecodePlayerName(string encodedPlayerName) { try { return Encoding.UTF8.GetString(Convert.FromBase64String(encodedPlayerName)); } catch { return string.Empty; } } } } namespace NicheTweaks.Tweaks.PlayerVolumeSaving.MonoBehaviours { internal sealed class SavePlayerVolumeController : MonoBehaviour { private GameObject workerObject; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown workerObject = new GameObject("SavePlayerVolume"); workerObject.transform.SetParent(((Component)this).transform, false); workerObject.AddComponent<SavePlayerVolumeToggle>(); } internal void RefreshFromShipPhase() { bool flag = (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase; if (workerObject.activeSelf != flag) { workerObject.SetActive(flag); } } } internal sealed class SavePlayerVolumeToggle : MonoBehaviour { private void Awake() { ((Component)this).gameObject.SetActive(false); } private void OnEnable() { ((MonoBehaviour)this).InvokeRepeating("ApplySavedVolumes", 0f, 0.1f); } private void OnDisable() { ((MonoBehaviour)this).CancelInvoke("ApplySavedVolumes"); } private void ApplySavedVolumes() { SavePlayerVolumeRuntime.ApplySavedVolumes(); } } } namespace NicheTweaks.Tweaks.PlayerSelfShadow { internal static class GrabbableObjectShadowCache { private sealed class CachedItemShadowState { public readonly CachedRendererShadowState[] renderers; public readonly bool hasAnyShadowEnabled; public bool shadowsHidden; public CachedItemShadowState(CachedRendererShadowState[] renderers, bool hasAnyShadowEnabled) { this.renderers = renderers; this.hasAnyShadowEnabled = hasAnyShadowEnabled; base..ctor(); } } private readonly struct CachedRendererShadowState { public readonly Renderer renderer; public readonly ShadowCastingMode shadowCastingMode; public CachedRendererShadowState(Renderer renderer) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) this.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 ((Object)(object)item == (Object)null || !item.isHeld || !cachedItems.TryGetValue(item, out var 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 var 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 (!((Object)(object)item == (Object)null) && item.hasHitGround) { Restore(item); } } internal static void Clear() { cachedItems.Clear(); } } [HarmonyPatch] internal static class LocalFlashlightCompat { private static FieldInfo cachedPublicFlashStateField; 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)) { PlayerSelfShadowPatch.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 PlayerSelfShadowPatch { [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) ? ((C