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.9
NicheTweaks.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn.Internal; using Dissonance; using Dusk; using GameNetcodeStuff; using GeneralImprovements.API; using GeneralImprovements.Utilities; using HarmonyLib; using LCBetterSaves; using Lethal_Nuke; using MZCoMagicShipping.Content; using Microsoft.CodeAnalysis; using MoreShipUpgrades; using NicheTweaks.ExternalTweaks.BetterSaves; using NicheTweaks.ExternalTweaks.DawnLib; using NicheTweaks.ExternalTweaks.EladsHUD; using NicheTweaks.ExternalTweaks.EladsHUD.AutoHide; using NicheTweaks.ExternalTweaks.EladsHUD.HUDReorder; using NicheTweaks.ExternalTweaks.EladsHUD.Misc; using NicheTweaks.ExternalTweaks.EnhancedMonsters; using NicheTweaks.ExternalTweaks.GeneralImprovements; using NicheTweaks.ExternalTweaks.ImmersiveVisor; using NicheTweaks.ExternalTweaks.InputUtils; using NicheTweaks.ExternalTweaks.LateGameUpgrades; using NicheTweaks.ExternalTweaks.LethalCasino; using NicheTweaks.ExternalTweaks.LethalConfig; using NicheTweaks.ExternalTweaks.LethalNuke; using NicheTweaks.ExternalTweaks.LobbyControl; using NicheTweaks.ExternalTweaks.LobbyImprovements; using NicheTweaks.ExternalTweaks.MagicShippingCrate; using NicheTweaks.ExternalTweaks.MirrorDecor; using NicheTweaks.ExternalTweaks.MoreBlood; using NicheTweaks.ExternalTweaks.MoreCompany; using NicheTweaks.ExternalTweaks.Oxygen; using NicheTweaks.ExternalTweaks.ShipInventory; using NicheTweaks.ExternalTweaks.ShipWindows; using NicheTweaks.ExternalTweaks.SolidLib; using NicheTweaks.NetcodePatcher; using NicheTweaks.Patches; using NicheTweaks.Tweaks.Audio; using NicheTweaks.Tweaks.Decals; using NicheTweaks.Tweaks.Gameplay; using NicheTweaks.Tweaks.HUD; using NicheTweaks.Tweaks.QoL; using NicheTweaks.Tweaks.Ship; using NicheTweaks.Tweaks.Visuals; using NicheTweaks.Tweaks.Visuals.PlayerSelfShadow; using NicheTweaks.Utils; using ShipInventoryUpdated.Objects; using ShipInventoryUpdated.Scripts; using ShipWindows; using ShipWindows.Api.events; using ShipWindows.ShutterSwitch; using ShipWindows.WindowDefinition; using TMPro; using TooManyEmotes.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using 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.9.0")] [assembly: AssemblyInformationalVersion("0.4.9")] [assembly: AssemblyProduct("NicheTweaks")] [assembly: AssemblyTitle("NicheTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NicheTweaks { internal static class ConfigManager { internal static ConfigEntry<bool> SilenceRingingEarsAudio { get; private set; } internal static ConfigEntry<bool> SilenceLightningStatic { get; private set; } internal static ConfigEntry<bool> MuteFearAudio { get; private set; } internal static ConfigEntry<bool> EnableDecalDrawDistanceOverride { get; private set; } internal static ConfigEntry<bool> EnableFootprintPoolOverride { get; private set; } internal static ConfigEntry<int> FootprintPoolSize { get; private set; } internal static ConfigEntry<bool> EnablePlayerBlood { get; private set; } internal static ConfigEntry<int> PlayerBloodPoolSize { 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> FixHoarderBugSpiderBodyTarget { get; private set; } internal static ConfigEntry<bool> GrabbableToEnemiesItemBlacklistToggle { get; private set; } internal static ConfigEntry<string> GrabbableToEnemiesItemBlacklist { get; private set; } internal static ConfigEntry<bool> RadmechLargerHitCollider { get; private set; } internal static ConfigEntry<bool> ButlerTallerHitCollider { get; private set; } internal static ConfigEntry<bool> JesterTallerHitCollider { get; private set; } internal static ConfigEntry<bool> ButlerCollisionAdjustment { get; private set; } internal static ConfigEntry<bool> DisableUtilitySlot { get; private set; } internal static ConfigEntry<bool> PreventCheckDeadPlayersCheese { get; private set; } internal static ConfigEntry<bool> TriggerDeadlineEjectionAtZeroDays { get; private set; } internal static ConfigEntry<bool> DisableInspectItem { get; private set; } internal static ConfigEntry<bool> FixZeroScaleItems { get; private set; } internal static ConfigEntry<bool> DisableClock { get; private set; } internal static ConfigEntry<bool> AddClockToDeathScreen { get; private set; } internal static ConfigEntry<bool> DisableChat { get; private set; } internal static ConfigEntry<bool> FixChatColon { get; private set; } internal static ConfigEntry<bool> DisableCompass { get; private set; } internal static ConfigEntry<bool> DisableWeight { get; private set; } internal static ConfigEntry<HandsFullTextPreset> HandsFullTextPresetSelection { get; private set; } internal static ConfigEntry<bool> ItemLightningBorder { get; private set; } internal static ConfigEntry<bool> RemoveItemSlotFade { get; private set; } internal static ConfigEntry<bool> HideHUDAtTerminal { get; private set; } internal static ConfigEntry<bool> EnableFloodedCondensation { get; private set; } internal static ConfigEntry<bool> FixQuitGameMenuHighlightColours { get; private set; } internal static ConfigEntry<bool> QuitGameColourConsistency { get; private set; } internal static ConfigEntry<bool> HideJoinButton { get; private set; } internal static ConfigEntry<bool> HideInviteFriendsButton { get; private set; } internal static ConfigEntry<bool> HideCreditsButton { get; private set; } internal static ConfigEntry<bool> ChangeFriendsOnlyTextToPrivate { get; private set; } internal static ConfigEntry<bool> DisableControlTips { get; private set; } internal static ConfigEntry<bool> FixUtilitySlotItemIconSize { get; private set; } internal static ConfigEntry<bool> EnableTooltipRename { get; private set; } internal static ConfigEntry<string> TooltipItemsToRename { get; private set; } internal static ConfigEntry<string> AllItemNamesList { get; private set; } internal static ConfigEntry<bool> ScanNodeOverridesToggle { get; private set; } internal static ConfigEntry<string> ScanNodeOverrides { get; private set; } internal static ConfigEntry<bool> HideWarningDisplayTipToggle { get; private set; } internal static ConfigEntry<bool> DisableFilmGrain { get; private set; } internal static ConfigEntry<bool> BlockCustomMoonVFX { get; private set; } internal static ConfigEntry<string> BlockCustomMoonVFXMoonFilter { get; private set; } internal static ConfigEntry<bool> DisableLocalPlayerSelfShadow { get; private set; } internal static ConfigEntry<bool> HidePlayerArms { get; private set; } internal static ConfigEntry<bool> ToyCubeTextureFix { get; private set; } internal static ConfigEntry<bool> EnableLODOverride { get; private set; } internal static ConfigEntry<float> LODBias { get; private set; } internal static ConfigEntry<bool> DisableChargeStationScanNode { get; private set; } internal static ConfigEntry<bool> CloseShipDoorOnLeverPull { get; private set; } internal static ConfigEntry<bool> PlanetVideoReelDisable { get; private set; } internal static ConfigEntry<bool> EnableGlobalVolumeMeter { get; private set; } internal static ConfigEntry<bool> SavePlayerVolume { get; private set; } internal static ConfigEntry<bool> RestartVoiceChatAfterLanding { get; private set; } internal static ConfigEntry<bool> EnableDropshipPickupDelay { get; private set; } internal static ConfigEntry<bool> EnableShipTeleporterBlock { get; private set; } internal static ConfigEntry<bool> EnableLandmineFix { get; private set; } internal static ConfigEntry<bool> JesterWarmup { get; private set; } internal static ConfigEntry<bool> AmbientMusicWarmup { get; private set; } internal static ConfigEntry<bool> NormaliseHelmetLightBrightness { get; private set; } internal static ConfigEntry<bool> UncapFPS { get; private set; } internal static ConfigEntry<bool> DeadPlayersSeeGhostGirl { get; private set; } internal static ConfigEntry<bool> DisableAchievementPopups { get; private set; } internal static ConfigEntry<bool> ReplaceDawnLibHotloadingPlayerImages { get; private set; } internal static ConfigEntry<bool> FixMoreBloodFootprints { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyMenuButton { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyCrewCount { get; private set; } internal static ConfigEntry<bool> MoreCompanyOrangeCosmeticButton { get; private set; } internal static ConfigEntry<bool> LobbyImprovementsTextEdit { get; private set; } internal static ConfigEntry<bool> BetterSavesTextEdit { get; private set; } internal static ConfigEntry<bool> BetterSavesAutoRename { get; private set; } internal static ConfigEntry<bool> BetterSavesStartCreditsFix { get; private set; } internal static ConfigEntry<bool> HideKeybindsLegacyButton { get; private set; } internal static ConfigEntry<bool> HideLethalConfigMenu { get; private set; } internal static ConfigEntry<bool> AddSpaceToLethalConfig { get; private set; } internal static ConfigEntry<bool> MZCoMagicShippingNeverRespawns { get; private set; } internal static ConfigEntry<bool> ImmersiveVisorWorksWithHurricane { get; private set; } internal static ConfigEntry<bool> ShipWindowsOpenClose { get; private set; } internal static ConfigEntry<bool> LethalNukeFix { get; private set; } internal static ConfigEntry<bool> MirrorDecorFPSCapToggle { get; private set; } internal static ConfigEntry<int> MirrorDecorFPSCap { get; private set; } internal static ConfigEntry<bool> RemoveEnhancedMonstersVersionNumber { get; private set; } internal static ConfigEntry<bool> RemoveLobbyCommand { get; private set; } internal static ConfigEntry<bool> PlayerScanNodeRed { get; private set; } internal static ConfigEntry<bool> FixSolidLibOutsideMusic { get; private set; } internal static ConfigEntry<bool> BetterSprayPaintGIFix { get; private set; } internal static ConfigEntry<bool> GeneralImprovementsShipInventoryMonitorCompatibility { get; private set; } internal static ConfigEntry<bool> ChangeGeneralImprovementsPlayersAliveToCrewAlive { get; private set; } internal static ConfigEntry<bool> RemoveLethalCasinoATM { get; private set; } internal static ConfigEntry<bool> FixLateGameUpgradesSampleColliders { get; private set; } internal static ConfigEntry<bool> OopsAllFloodedOxygenCompatibility { get; private set; } internal static ConfigEntry<bool> V80Compat { get; private set; } internal static ConfigEntry<bool> EnableEladsHUDReorder { get; private set; } internal static ConfigEntry<bool> FixStaminaTenPercent { get; private set; } internal static ConfigEntry<bool> DisableEladsHUDStaminaNotch { get; private set; } internal static ConfigEntry<bool> HideEladsHUDWeight { get; private set; } internal static ConfigEntry<bool> EladsHUDTriggerHealthShowOnHeal { get; private set; } internal static ConfigEntry<bool> EladsHUDHideStaminaPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideStamina { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideDelay { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideStartPercent { get; private set; } internal static ConfigEntry<bool> EladsHUDWeightTriggersStamina { get; private set; } internal static ConfigEntry<bool> EladsHUDHideOxygenPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideOxygen { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenDelay { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenValue { get; private set; } internal static ConfigEntry<bool> EladsHUDHidePercentDividers { get; private set; } internal static ConfigEntry<bool> EladsHUDHideInsanityPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideInsanity { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideInsanityDelay { get; private set; } private static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue, string description) { return config.Bind<T>(section, key, defaultValue, description); } internal static void CfgInit(ConfigFile config) { SilenceRingingEarsAudio = Bind(config, "Audio", "Silence ear ringing audio", defaultValue: false, "If true, silences the ear ringing audio from shotgun blasts."); SilenceLightningStatic = Bind(config, "Audio", "Silence lightning static audio", defaultValue: false, "If true, silences live lightning static that plays from a conductive item being targeted when entering the facility."); MuteFearAudio = Bind(config, "Audio", "Mute fear audio", defaultValue: false, "If true, stops the fear ambience and heartbeat audio driven by the local player's fear level."); EnableDecalDrawDistanceOverride = Bind(config, "Decals", "Enable decal draw distance override", defaultValue: false, "If true, breaks the decal draw distance and causes decals to always be rendered. LethalSponge is recommended to install."); 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", 400, "Number of footprints that are allowed to be present before the oldest footprints start culling visually, vanilla is 250."); EnablePlayerBlood = Bind(config, "Decals", "Enable player blood effects", defaultValue: false, "Enable blood effects when players take damage."); PlayerBloodPoolSize = Bind(config, "Decals", "Player blood pool size", 120, "Number of blood splatters that are allowed to be present before the oldest blood splatters start culling visually, vanilla is 50"); 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"); FixHoarderBugSpiderBodyTarget = Bind(config, "Gameplay", "Fix hoarder bug trying to grab spider body", defaultValue: false, "If true, prevents hoarder bugs from trying to pick up player corpses hung up by sand spiders"); GrabbableToEnemiesItemBlacklistToggle = Bind(config, "Gameplay", "Enable grabbable to enemies item blacklist", defaultValue: false, "If true, enables grabbable to enemies item blacklist"); GrabbableToEnemiesItemBlacklist = Bind(config, "Gameplay", "Grabbable to enemies item blacklist", "", "Uses itemProperties name, separated by commas. E.g. 'Big bolt,Large axle,Bowl of Apples'"); RadmechLargerHitCollider = Bind(config, "Gameplay", "Give Radmechs a larger hit collider", defaultValue: false, "If true, gives the Radmech/Old Bird enemies a larger hitbox, mainly for use with mods where they are no longer immortal. However, as an unavoidable consequence, they can now grab you far easier, making them more difficult. Can be used to increase their lethality as well."); ButlerTallerHitCollider = Bind(config, "Gameplay", "Give Butlers a taller player hit collider", defaultValue: false, "If true, increases the height of Butlers player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas."); JesterTallerHitCollider = Bind(config, "Gameplay", "Give Jesters a taller player hit collider", defaultValue: false, "If true, increases the height of Jesters player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas."); ButlerCollisionAdjustment = Bind(config, "Gameplay", "Lower size of Butler obstacle avoidance", defaultValue: false, "If true, resizes Butler's NavMeshAgent obstacle avoidance radius from 1.6 to 1.4 to help them fit through tighter spaces and open doors properly."); DisableUtilitySlot = Bind(config, "Gameplay", "Disable utility slot", defaultValue: false, "If true, disables the utility slot on the HUD and prevents items from using the utility slot."); PreventCheckDeadPlayersCheese = Bind(config, "Gameplay", "Prevent check dead players cheese", defaultValue: false, "If true, displays the 'No one can hear you' popup when sending a chat message when everyone is dead."); TriggerDeadlineEjectionAtZeroDays = Bind(config, "Gameplay", "Eject at zero days without ship loot", defaultValue: false, "If true, triggers the deadline firing sequence as soon as the crew reaches 0 days left when no ship scrap value is found. Also clears ShipInventory during this ejection to prevent stored items returning in the next save."); DisableInspectItem = Bind(config, "Gameplay", "Disable item inspection", defaultValue: false, "If true, disables the ability to inspect items."); FixZeroScaleItems = Bind(config, "Gameplay", "Fix zero scale items", defaultValue: false, "EXPERIMENTAL | If true, attempts to fix NaN errors. Reported to work, but still gathering results."); DisableClock = Bind(config, "UI", "Hide clock from HUD", defaultValue: false, "If true, hides the clock from the HUD."); AddClockToDeathScreen = Bind(config, "UI", "Add clock to death screen", defaultValue: false, "If true, adds clock to death screen."); DisableChat = Bind(config, "UI", "Hide chat from HUD", defaultValue: false, "If true, hides the chat from the HUD. Warning: It remains hidden even if you type in it."); FixChatColon = Bind(config, "UI", "Set chat colon colour to blue", defaultValue: false, "If true, sets the colon in the chat to blue and prevents the colon from changing colours when using <color> html attributes in chat messages."); DisableCompass = Bind(config, "UI", "Hide compass from HUD", defaultValue: false, "If true, hides the compass from the HUD."); DisableWeight = Bind(config, "UI", "Hide weight from HUD", defaultValue: false, "If true, hides the weight from the HUD."); HandsFullTextPresetSelection = Bind(config, "UI", "Hands full text preset", HandsFullTextPreset.DefaultNoChange, "Preset for HandsFullText position/rotation/scale/opacity. DefaultNoChange does not modify the HUD."); ItemLightningBorder = Bind(config, "UI", "Item Lightning Warning", defaultValue: false, "If true, warns the player which item is about to be struck by lightning with a visual indicator."); RemoveItemSlotFade = Bind(config, "UI", "Remove Item Slot Fade", defaultValue: false, "If true, removes the fade popout of the item slot frame when swapping item slots."); HideHUDAtTerminal = Bind(config, "UI", "Hide HUD at terminal", defaultValue: false, "If true, hides the HUD whilst at the terminal."); EnableFloodedCondensation = Bind(config, "UI", "Enable condensation on visor during flooded", defaultValue: false, "If true, shows helmet condensation during Flooded weather."); FixQuitGameMenuHighlightColours = Bind(config, "UI", "Fix quit game highlight colours", defaultValue: false, "If true, changes the green highlights and corners of the in-game quit menu to be highlighted orange like the rest of the game."); QuitGameColourConsistency = Bind(config, "UI", "Change quit game confirmation text to orange", defaultValue: false, "If true, changes the light blue 'Would you like to leave the game?' text to be orange."); HideJoinButton = Bind(config, "UI", "Hide join button", defaultValue: false, "If true, hides the join crew button in the main menu."); HideInviteFriendsButton = Bind(config, "UI", "Hide invite friends button", defaultValue: false, "If true, hides the invite friends button in the quick menu."); HideCreditsButton = Bind(config, "UI", "Hide credits button", defaultValue: false, "If true, hides the Credits button in the main menu."); ChangeFriendsOnlyTextToPrivate = Bind(config, "UI", "Change friends only text to private", defaultValue: false, "If true, changes the 'Friends only' lobby option in lobby creation menu to say 'Private'."); DisableControlTips = Bind(config, "UI", "Hide control tips from HUD", defaultValue: false, "If true, hides the control tip labels (top right of HUD)."); FixUtilitySlotItemIconSize = Bind(config, "UI", "Fix utility slot item icon size", defaultValue: false, "If true, fits the item icon to the utility slot."); EnableTooltipRename = Bind(config, "UI", "Customise control tip item name", defaultValue: false, "If true, enables the replacement of item control tip texts with their scan node text."); TooltipItemsToRename = Bind(config, "UI", "Items to change the control tip text of", "Brush = Hair brush,clipboard = Training manual,Bell = Brass bell,Gift = Gift box,Gold bar = Gold Bar,Hive = Bee hive,Ring = Wedding ring,Toy robot = Robot Toy,Metal sheet = Tattered metal sheet,Mug = Coffee mug,Rubber Ducky = Rubber ducky,Tea kettle = Tea Kettle,Ammo = Shotgun shell,Cookie pan = Cookie mold pan", "Items that will have their control tip text altered. E.g. 'ExampleItem1 = <desired control tip string>'"); AllItemNamesList = Bind(config, "UI", "Autogenerated item and scan node default text list", "Generates after loading a lobby", "Auto generated list of all item names and their respective default scan node text. Needs control tip renaming to be set to true"); ScanNodeOverridesToggle = Bind(config, "UI", "Scan node overrides toggle", defaultValue: false, "If true, enables the ability to override the type of any scan node"); ScanNodeOverrides = Bind(config, "UI", "Scan node overrides", "SnailCatRe:1, Fake SnailCatRe:1, Bandages:0, Defibrillator:0, Handlamp:0, MedicalKit:0, ProductivityAutoinjector:0, ShiftController:0, Toolbox:0, SeedCarrot:0, SeedGrape1:0, SeedGrape0:0, SeedPotato:0, SeedWheat:0, Fertilizer0:0", "Uses a GameObject/Item's name and ScanNodeType, separated by colons and commas. E.g. 'SnailCatRe:1,Fake SnailCatRe:1,Bandages:0,BigBolt:1'. Searches the target GameObject or item prefab hierarchy for ScanNodeProperties. 0 = Blue, 1 = Red, 2 = Green. A GameObject's name may not be the same as an item or enemy name!"); HideWarningDisplayTipToggle = Bind(config, "UI", "Hide warning display tips", defaultValue: false, "If true, hides all warning display tips (yellow display tips)"); DisableFilmGrain = Bind(config, "Visuals", "Disable film grain effect globally", defaultValue: false, "If true, globally disables film grain where it may be present."); BlockCustomMoonVFX = Bind(config, "Visuals", "Disable custom moon fog and colour adjustments", defaultValue: false, "If true, disables fog and colour adjustments on local volumes in matching moon level scenes."); BlockCustomMoonVFXMoonFilter = Bind(config, "Visuals", "Custom moon fog and colour adjustment filter", "", "Moons to disable local fog and colour adjustments on. Separate each moon with a comma. Example: Experimentation,Abaddon,Embrion. Leave empty to affect all moons."); DisableLocalPlayerSelfShadow = Bind(config, "Visuals", "Disable local player shadow", defaultValue: false, "If true, disables shadow casting for the local player only. Very useful for modded flashlights with very high intensities."); HidePlayerArms = Bind(config, "Visuals", "Hide player arms", defaultValue: false, "If true, hides the player arms."); ToyCubeTextureFix = Bind(config, "Visuals", "Enable texture fix for Toy cube", defaultValue: false, "If true, changes the texture of Toy cube (rubix cube) scrap to a texture of a rubix cube that is actually solvable."); EnableLODOverride = Bind(config, "Visuals", "Enable LOD bias override", defaultValue: false, "If true, enables custom LOD distance."); LODBias = Bind(config, "Visuals", "LOD bias", 1f, "LOD bias value. Increasing this will impact performance."); DisableChargeStationScanNode = Bind(config, "Ship", "Disable leftover charge station scan node", defaultValue: false, "If true, hides the scan node of the charge station inside the ship. This only affects the leftover scan node after moving the charge station with build mode."); CloseShipDoorOnLeverPull = Bind(config, "Ship", "Close ship doors when lever is pulled", defaultValue: false, "If true, closes the ship doors when the lever is pulled."); PlanetVideoReelDisable = Bind(config, "Ship", "Disable planet reel video on ship monitors", defaultValue: false, "If true, disables the planet reel video on the ship monitor."); EnableGlobalVolumeMeter = Bind(config, "QoL", "Enable global voice volume slider", defaultValue: false, "If true, enables the global voice volume slider in the player list."); SavePlayerVolume = Bind(config, "QoL", "Enable player volume saving", defaultValue: false, "If true, enables player volume saving. Works with global volume slider."); RestartVoiceChatAfterLanding = Bind(config, "QoL", "Restart voice chat after landing", defaultValue: false, "EXPERIMENTAL | If true, restarts voice chat once after loading a moon, this may help with large voice chat desyncs"); 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."); EnableShipTeleporterBlock = Bind(config, "QoL", "Enable teleporter item pickup block", defaultValue: false, "If true, block item pickup whilst you are being teleported."); EnableLandmineFix = Bind(config, "QoL", "Remove landmine invisible bump", defaultValue: false, "Removes the invisible bump left by landmines after exploding."); JesterWarmup = Bind(config, "QoL", "Jester Warmup", defaultValue: false, "If true, silently plays and stops the Jester's audio clips so they are decompressed before first real playback to prevent an in-game lag spike"); AmbientMusicWarmup = Bind(config, "QoL", "Ambient music warmup", defaultValue: false, "If true, silently plays and stops ambient music audio so they are decompressed before first real playback to prevent an in-game lag spike"); NormaliseHelmetLightBrightness = Bind(config, "QoL", "Normalise helmet light brightness", defaultValue: false, "If true, matches the helmet light brightness and beam to the flashlight when pocketed."); UncapFPS = Bind(config, "QoL", "Uncap FPS", defaultValue: false, "If true, removes the 250 fps cap."); DeadPlayersSeeGhostGirl = Bind(config, "QoL", "Dead players see ghost girl", defaultValue: false, "If true, dead players/spectators can see ghost girls haunting other players."); DisableAchievementPopups = Bind(config, "zDawnlib", "Hide and mute achievement popups", defaultValue: false, "If true, hides DawnLib's achievement popup and sound."); ReplaceDawnLibHotloadingPlayerImages = Bind(config, "zDawnlib", "Replace hotloadUI player images", defaultValue: false, "If true, replaces DawnLib hotloadUI player Steam images with a vanilla image."); FixMoreBloodFootprints = Bind(config, "zMoreBlood", "Fix footprint smearing", defaultValue: false, "If true, enable fix for MoreBlood footprint smearing."); HideMoreCompanyMenuButton = Bind(config, "zMoreCompany", "Hide main menu button", defaultValue: false, "If true, hides the MoreCompany cosmetics button in the main menu. Requires MoreCompany to be installed."); HideMoreCompanyCrewCount = Bind(config, "zMoreCompany", "Hide 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, "zMoreCompany", "Change 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, "zLobbyImprovements", "Change text", defaultValue: false, "If true, changes text on the create a lobby screen from 'ImprovedLobby' -> 'Lobby'. Requires LobbyImprovements to be installed."); BetterSavesTextEdit = Bind(config, "zLCBetterSaves", "Change text", defaultValue: false, "If true, changes text on the create a lobby screen from 'BetterSaves' -> 'Save Files'. Requires LCBetterSaves to be installed."); BetterSavesAutoRename = Bind(config, "zLCBetterSaves", "Auto rename", defaultValue: false, "If true, automatically renames new saves to the lobby name. Requires LCBetterSaves to be installed."); BetterSavesStartCreditsFix = Bind(config, "zLCBetterSaves", "Start credits fix", defaultValue: false, "If true, sets BetterSaves starting credits to 60 rather than 30. Requires LCBetterSaves to be installed."); HideKeybindsLegacyButton = Bind(config, "zInputUtils", "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, "zLethalConfig", "Hide main menu button", defaultValue: false, "If true, hides LethalConfig button in the main menu."); AddSpaceToLethalConfig = Bind(config, "zLethalConfig", "Add space", defaultValue: false, "If true, renames 'LethalConfig' to 'Lethal Config' in the main menu and in the pause menu in-game."); MZCoMagicShippingNeverRespawns = Bind(config, "zMZCoMagicShipping", "Crate never respawns", defaultValue: false, "If true, removes restored magic crates when the lobby loads and destroys newly delivered crates after one use. Requires MZCoMagicShipping to be installed."); ImmersiveVisorWorksWithHurricane = Bind(config, "zImmersiveVisor", "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, "zShipWindows", "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, "zLethalNuke", "Lethal nuke fix", defaultValue: false, "If true, prevents lethal nuke's particle effect from looping. Requires Lethal Nuke to be installed."); MirrorDecorFPSCapToggle = Bind(config, "zMirrorDecor", "Enable FPS cap", 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, "zMirrorDecor", "FPS cap", 30, "Sets the FPS for MirrorDecor."); RemoveEnhancedMonstersVersionNumber = Bind(config, "zEnhancedMonsters", "Remove 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, "zLobbyControl", "Remove lobby 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, "zGeneralImprovements", "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."); FixSolidLibOutsideMusic = Bind(config, "zSolidLib", "Fix outside music error", defaultValue: false, "If true, removes SolidLib's broken outside music patch and restores vanilla outside music. Requires SolidLib to be installed."); BetterSprayPaintGIFix = Bind(config, "zBetterSprayPaint", "GeneralImprovements compatibility", defaultValue: false, "EXPERIMENTAL | If true, removes GeneralImprovements' spray paint colour patches to prevent spray can particles from having no texture randomly. Requires BetterSprayPaint and GeneralImprovements to be installed."); GeneralImprovementsShipInventoryMonitorCompatibility = Bind(config, "zGeneralImprovements", "Add ShipInventory items to monitors", defaultValue: false, "If true, includes scrap stored in ShipInventory on GeneralImprovements' Ship Scrap monitor. Requires ShipInventory and GeneralImprovements to be installed."); ChangeGeneralImprovementsPlayersAliveToCrewAlive = Bind(config, "zGeneralImprovements", "Change Players Alive to Crew Alive", defaultValue: false, "If true, changes GeneralImprovements' 'Players Alive' monitor to 'Crew Alive'. Requires GeneralImprovements to be installed."); RemoveLethalCasinoATM = Bind(config, "zLethalCasino", "Remove ATM", defaultValue: false, "If true, disables LethalCasino's ATM at the Company. Requires LethalCasino to be installed."); FixLateGameUpgradesSampleColliders = Bind(config, "zLateGameUpgrades", "Fix sample colliders", defaultValue: false, "If true, aligns enemy sample colliders with their meshes. Requires LateGameUpgrades to be installed."); OopsAllFloodedOxygenCompatibility = Bind(config, "zOxygen", "Oops All Flooded Fixed compatibility", defaultValue: false, "If true, gives Oxygen's OxyBoost underwater stamina recovery. Requires Oops All Flooded Fixed and Oxygen 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.9")] [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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.NicheTweaks"; internal const string modName = "NicheTweaks"; internal const string modVersion = "0.4.9"; internal static Harmony _harmony; internal static ManualLogSource mls; internal static Plugin Instance; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.NicheTweaks"); _harmony = new Harmony("MrHat.NicheTweaks"); ConfigManager.CfgInit(((BaseUnityPlugin)this).Config); Keys.Init(); Log.Info("NicheTweaks initialised"); Patch(typeof(StartOfRoundPatches)); Patch(ConfigManager.SilenceRingingEarsAudio, typeof(RingingEarsAudioSilencerTweak)); Patch(ConfigManager.SilenceLightningStatic, typeof(LightningStaticAudioTweak)); Patch(ConfigManager.MuteFearAudio, typeof(FearAudioMuteTweak)); Patch(ConfigManager.EnableDecalDrawDistanceOverride, typeof(DecalDrawDistanceTweak)); Patch(ConfigManager.EnableFootprintPoolOverride, typeof(FootprintPoolOverrideTweak)); Patch(ConfigManager.EnablePlayerBlood, typeof(PlayerBloodTweak)); Patch(ConfigManager.FixHoarderBugManEaterTarget, typeof(HoarderBugManEaterTargetFixTweak)); Patch(ConfigManager.FixHoarderBugSpiderBodyTarget, typeof(HoarderBugSpiderBodyTargetFixTweak)); Patch(ConfigManager.GrabbableToEnemiesItemBlacklistToggle, typeof(GrabbableToEnemiesBlacklistTweak)); Patch(ConfigManager.RadmechLargerHitCollider, typeof(RadmechHitColliderTweak)); Patch(ConfigManager.ButlerTallerHitCollider, typeof(ButlerTallerDamageCollider)); Patch(ConfigManager.JesterTallerHitCollider, typeof(JesterTallerDamageCollider)); Patch(ConfigManager.ButlerCollisionAdjustment, typeof(ButlerCollisionAdjustmentTweak)); Patch(ConfigManager.DisableUtilitySlot, typeof(UtilitySlotDisableTweak), typeof(UtilitySlotHUDHideTweak)); Patch(ConfigManager.PreventCheckDeadPlayersCheese, typeof(DeadPlayerCheckCheesePreventionTweak)); Patch(ConfigManager.TriggerDeadlineEjectionAtZeroDays, typeof(DeadlineEjectionTweak)); Patch(ConfigManager.DisableInspectItem, typeof(ItemInspectionDisableTweak)); Patch(ConfigManager.FixZeroScaleItems, typeof(ZeroScaleItemFixTweak)); Patch(ConfigManager.DisableClock, typeof(ClockHUDHideTweak)); Patch(ConfigManager.AddClockToDeathScreen, typeof(DeathScreenClockSetupTweak), typeof(DeathScreenClockTweak)); Patch(ConfigManager.DisableChat, typeof(ChatHUDHideTweak)); Patch(ConfigManager.FixChatColon, typeof(ChatColonColorTweak)); Patch(ConfigManager.DisableCompass, typeof(CompassHUDHideTweak)); Patch(ConfigManager.DisableWeight, typeof(WeightHUDHideTweak)); if (ConfigManager.HandsFullTextPresetSelection.Value != HandsFullTextPreset.DefaultNoChange) { Log.Info(((ConfigEntryBase)ConfigManager.HandsFullTextPresetSelection).Definition.Key + " enabled"); Patch(typeof(HandsFullTextPositionTweak)); } Patch(ConfigManager.ItemLightningBorder, typeof(ItemLightningBorderSetupTweak), typeof(ItemLightningBorderTweak)); Patch(ConfigManager.RemoveItemSlotFade, typeof(RemoveItemSlotFadeTweak)); Patch(ConfigManager.HideHUDAtTerminal, typeof(TerminalHUDHideTweak), typeof(TerminalHUDRestoreTweak)); Patch(ConfigManager.EnableFloodedCondensation, typeof(FloodedCondensationTweak)); Patch(ConfigManager.FixQuitGameMenuHighlightColours, typeof(QuitGameHighlightColourTweak)); Patch(ConfigManager.QuitGameColourConsistency, typeof(QuitGameTextColourTweak)); Patch(ConfigManager.HideJoinButton, typeof(JoinButtonHideTweak)); Patch(ConfigManager.HideInviteFriendsButton, typeof(InviteFriendsButtonHideTweak)); Patch(ConfigManager.HideCreditsButton, typeof(CreditsButtonHideTweak)); Patch(ConfigManager.ChangeFriendsOnlyTextToPrivate, typeof(FriendsOnlyTextToPrivateTweak)); Patch(ConfigManager.DisableControlTips, typeof(ControlTipsHideTweak)); Patch(ConfigManager.FixUtilitySlotItemIconSize, typeof(UtilitySlotIconSizeTweak)); Patch(ConfigManager.EnableTooltipRename, typeof(ControlTipItemNameTweak), typeof(ControlTipItemNameListTweak)); Patch(ConfigManager.ScanNodeOverridesToggle, typeof(ScanNodeOverrideTweak)); Patch(ConfigManager.HideWarningDisplayTipToggle, typeof(HideWarningDisplayTip)); Patch(ConfigManager.DisableFilmGrain, typeof(FilmGrainDisableTweak)); Patch(ConfigManager.BlockCustomMoonVFX, typeof(MoonVFXBlock)); Patch(ConfigManager.DisableLocalPlayerSelfShadow, typeof(LocalPlayerShadowDisableTweak), typeof(HeldItemShadowDisableTweak)); if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.hasTooManyEmotes) { Patch(typeof(TooManyEmotesSelfShadowCompat)); } if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.hasLocalFlashlight) { Patch(typeof(LocalFlashlightSelfShadowCompat)); } Patch(ConfigManager.HidePlayerArms, typeof(PlayerArmsHideTweak)); Patch(ConfigManager.ToyCubeTextureFix, typeof(ToyCubeTextureFixTweak)); Patch(ConfigManager.EnableLODOverride, typeof(LODBiasOverrideSetupTweak)); Patch(ConfigManager.DisableChargeStationScanNode, typeof(ChargeStationScanNodeDisableTweak)); Patch(ConfigManager.CloseShipDoorOnLeverPull, typeof(ShipDoorCloseTweak)); Patch(ConfigManager.PlanetVideoReelDisable, typeof(PlanetVideoReelDisableTweak)); Patch(ConfigManager.EnableGlobalVolumeMeter, typeof(GlobalVoiceVolumeSliderTweak), typeof(GlobalVoiceVolumeOverlay)); Patch(ConfigManager.SavePlayerVolume, typeof(PlayerVolumeSavingTweak)); if (ConfigManager.SavePlayerVolume.Value) { SavePlayerVolumeRuntime.SaveFileSetup(); } Patch(ConfigManager.RestartVoiceChatAfterLanding, typeof(VoiceChatLandingRestartTweak)); Patch(ConfigManager.EnableDropshipPickupDelay, typeof(DropshipPickupDelayTweak)); Patch(ConfigManager.EnableShipTeleporterBlock, typeof(ShipTeleporterInteractBlock)); Patch(ConfigManager.EnableLandmineFix, typeof(LandmineInvisibleBumpTweak)); Patch(ConfigManager.JesterWarmup, typeof(JesterWarmupTweak)); Patch(ConfigManager.AmbientMusicWarmup, typeof(AmbientMusicPrewarmTweak)); Patch(ConfigManager.NormaliseHelmetLightBrightness, typeof(HelmetLightBrightnessTweak)); Patch(ConfigManager.UncapFPS, typeof(FpsUncapTweak)); Patch(typeof(DeadPlayersSeeGhostGirlTweak)); if (Keys.hasDawnLib && ConfigManager.ReplaceDawnLibHotloadingPlayerImages.Value) { DawnLibHotloadingPlayerImageTweak.Load(); } PatchIf(Keys.hasDawnLib, ConfigManager.DisableAchievementPopups, typeof(DawnLibAchievementPopupTweak)); PatchIf(Keys.hasDawnLib, ConfigManager.ReplaceDawnLibHotloadingPlayerImages, typeof(DawnLibHotloadingPlayerImageTweak)); PatchIf(Keys.hasMoreBlood, ConfigManager.FixMoreBloodFootprints, typeof(MoreBloodFootprintFixTweak)); if (Keys.hasMoreCompany) { Patch(typeof(MoreCompanyMenuTweak)); } PatchIf(Keys.hasMoreCompany, ConfigManager.HideMoreCompanyMenuButton); PatchIf(Keys.hasMoreCompany, ConfigManager.HideMoreCompanyCrewCount); PatchIf(Keys.hasMoreCompany, ConfigManager.MoreCompanyOrangeCosmeticButton); PatchIf(Keys.hasLobbyImprovements, ConfigManager.LobbyImprovementsTextEdit, typeof(LobbyImprovementsTextTweak)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesTextEdit, typeof(BetterSavesTextTweak)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesAutoRename, typeof(BetterSavesAutoRename)); PatchIf(Keys.hasLCBetterSaves, ConfigManager.BetterSavesStartCreditsFix, typeof(BetterSavesStartCreditsFix)); PatchIf(Keys.hasInputUtils, ConfigManager.HideKeybindsLegacyButton, typeof(InputUtilsLegacyButtonHideTweak)); PatchIf(Keys.hasLethalConfig, ConfigManager.HideLethalConfigMenu, typeof(LethalConfigMenuButtonTweak)); PatchIf(Keys.hasLethalConfig, ConfigManager.AddSpaceToLethalConfig, typeof(LethalConfigSpacingTweak)); PatchIf(Keys.hasMZCoMagicShipping, ConfigManager.MZCoMagicShippingNeverRespawns, typeof(MagicShippingCrateRespawnTweak)); PatchIf(Keys.hasImmersiveVisor, ConfigManager.ImmersiveVisorWorksWithHurricane, typeof(ImmersiveVisorHurricaneTweak)); PatchIf(Keys.hasShipWindows, ConfigManager.ShipWindowsOpenClose, typeof(ShipWindowsOpenCloseTweak)); PatchIf(Keys.hasLethalNuke, ConfigManager.LethalNukeFix, typeof(LethalNukeFixTweak)); PatchIf(Keys.hasMirrorDecor, ConfigManager.MirrorDecorFPSCapToggle, typeof(MirrorDecorFpsCapTweak)); PatchIf(Keys.hasEnhancedMonsters, ConfigManager.RemoveEnhancedMonstersVersionNumber, typeof(EnhancedMonstersVersionNumberRemovalTweak)); PatchIf(Keys.hasLobbyControl, ConfigManager.RemoveLobbyCommand, typeof(LobbyControlCommandRemovalTweak)); PatchIf(Keys.hasGeneralImprovements, ConfigManager.PlayerScanNodeRed, typeof(GeneralImprovementsPlayerScanNodeTweak)); PatchIf(Keys.hasShipInventory, ConfigManager.TriggerDeadlineEjectionAtZeroDays, typeof(ShipInventoryDeadlineEjectionCompat)); PatchIf(Keys.hasGeneralImprovements && Keys.hasShipInventory, ConfigManager.GeneralImprovementsShipInventoryMonitorCompatibility, typeof(GeneralImprovementsShipInventoryCompat)); PatchIf(Keys.hasGeneralImprovements, ConfigManager.ChangeGeneralImprovementsPlayersAliveToCrewAlive, typeof(GeneralImprovementsCrewAliveTweak)); PatchIf(Keys.hasLethalCasino, ConfigManager.RemoveLethalCasinoATM, typeof(LethalCasinoATMTweak)); PatchIf(Keys.hasLateGameUpgrades, ConfigManager.FixLateGameUpgradesSampleColliders, typeof(MonsterSampleColliderTweak)); PatchIf(Keys.hasOxygen && Keys.hasOopsAllFloodedFixed, ConfigManager.OopsAllFloodedOxygenCompatibility, typeof(OopsAllFloodedOxygenCompatibilityTweak)); PatchIf(Keys.hasSolidLib, ConfigManager.FixSolidLibOutsideMusic, typeof(SolidLibSoundTweak)); if (Keys.hasGeneralImprovements && ConfigManager.BetterSprayPaintGIFix.Value) { BetterSprayPaintCompat.UnpatchGeneralImprovements(); } if (Keys.hasEladsHUD) { Patch(ConfigManager.V80Compat, typeof(EladsHUDV80Compat)); Patch(ConfigManager.FixStaminaTenPercent, typeof(EladsHUDStaminaTenPercentTweak)); Patch(ConfigManager.EladsHUDTriggerHealthShowOnHeal, typeof(EladsHUDHealthPopupTweak)); PatchIf(Keys.hasInsanityDisplay && Keys.hasOxygen, ConfigManager.EnableEladsHUDReorder, typeof(EladsHUDStaminaReorderTweak), typeof(EladsHUDInsanityReorderTweak), typeof(EladsHUDInsanityPercentageReorderTweak), typeof(EladsHUDOxygenReorderTweak)); Patch(typeof(EladsHUDTweak)); Patch(ConfigManager.DisableEladsHUDStaminaNotch); Patch(ConfigManager.HideEladsHUDWeight); Patch(ConfigManager.EladsHUDAutoHideStamina); Patch(ConfigManager.EladsHUDWeightTriggersStamina); } PatchIf(Keys.hasEladsHUD, ConfigManager.EladsHUDHideStaminaPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDHideOxygenPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDAutoHideOxygen); PatchIf(Keys.hasEladsHUD && Keys.hasOxygen, ConfigManager.EladsHUDHidePercentDividers); PatchIf(Keys.hasEladsHUD && Keys.hasInsanityDisplay, ConfigManager.EladsHUDHideInsanityPercentage); PatchIf(Keys.hasEladsHUD && Keys.hasInsanityDisplay, ConfigManager.EladsHUDAutoHideInsanity); if ((Keys.hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value) || (Keys.hasEladsHUD && Keys.hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value)) { GameObject val = CreateRunner("MrHat.NicheTweaks.PercentageHideRunner"); if (Keys.hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value) { val.AddComponent<HideStaminaPercentageRunner>(); } if (Keys.hasEladsHUD && Keys.hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value) { val.AddComponent<HideInsanityPercentageRunner>(); } } } private static void Patch(params Type[] patchTypes) { for (int i = 0; i < patchTypes.Length; i++) { _harmony.PatchAll(patchTypes[i]); } } private static void Patch(ConfigEntry<bool> configEntry, params Type[] patchTypes) { PatchIf(condition: true, configEntry, patchTypes); } private static void PatchIf(bool condition, ConfigEntry<bool> configEntry, params Type[] patchTypes) { if (condition && configEntry.Value) { Log.Info(((ConfigEntryBase)configEntry).Definition.Key + " enabled"); Patch(patchTypes); } } private static GameObject CreateRunner(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; return val; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NicheTweaks"; public const string PLUGIN_NAME = "NicheTweaks"; public const string PLUGIN_VERSION = "0.4.9"; } } namespace NicheTweaks.Utils { internal enum HandsFullTextPreset { DefaultNoChange, BelowInventory, AboveInventory, TopOfScreen, AboveVanillaStaminaHealthUI, BelowChat, AboveTooltips } internal static class Keys { internal static bool hasLCBetterSaves { get; private set; } internal static bool hasLethalNuke { get; private set; } internal static bool hasImmersiveVisor { get; private set; } internal static bool hasLobbyImprovements { get; private set; } internal static bool hasInsanityDisplay { get; private set; } internal static bool hasEladsHUD { get; private set; } internal static bool hasOxygen { get; private set; } internal static bool hasOopsAllFloodedFixed { 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 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 hasSolidLib { get; private set; } internal static bool hasShipInventory { get; private set; } internal static bool hasLethalCasino { get; private set; } internal static bool hasLateGameUpgrades { 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"); hasOopsAllFloodedFixed = Chainloader.PluginInfos.ContainsKey("NoteBoxz.OopsAllFloodedFixed"); 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"); 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"); hasSolidLib = Chainloader.PluginInfos.ContainsKey("solidlib"); hasShipInventory = Chainloader.PluginInfos.ContainsKey("org.lethalcompanymodding.shipinventoryupdated"); hasLethalCasino = Chainloader.PluginInfos.ContainsKey("mrgrm7.LethalCasino"); hasLateGameUpgrades = Chainloader.PluginInfos.ContainsKey("com.malco.lethalcompany.moreshipupgrades"); } } internal static class Log { internal static void Debug(string message) { Write((LogLevel)32, message); } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } internal static class SceneObjectUtils { private static readonly Dictionary<string, GameObject> cachedObjects = new Dictionary<string, GameObject>(); internal static void CacheObject(string path) { GameObject val = Find(path); if ((Object)(object)val == (Object)null) { cachedObjects.Remove(path); } else { cachedObjects[path] = val; } } internal static GameObject? GetCachedObject(string path) { GameObject value; return cachedObjects.TryGetValue(path, out value) ? value : null; } internal static void Clear() { cachedObjects.Clear(); } internal static GameObject? Find(string path) { GameObject val = GameObject.Find(path); return val ?? null; } internal static Transform? FindChild(string path, string childPath) { GameObject? obj = Find(path); return (obj != null) ? obj.transform.Find(childPath) : null; } internal static void SetActive(string path, bool active) { GameObject val = Find(path); if (val != null) { val.SetActive(active); } } internal static void SetLocalPosition(string path, Vector3 localPosition) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = Find(path); if (val != null) { val.transform.localPosition = localPosition; } } internal static void SetText(string path, string textValue) { WithComponent<TextMeshProUGUI>(path, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI text) { ((TMP_Text)text).text = textValue; }); } internal static void SetTextColor(string path, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) WithComponent<TextMeshProUGUI>(path, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI text) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)text).color = color; }); } internal static void SetImageColor(string path, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) WithComponent<Image>(path, (Action<Image>)delegate(Image image) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)image).color = color; }); } internal static void HideCanvasGroup(string path) { GameObject val = Find(path); if (!((Object)(object)val == (Object)null)) { CanvasGroupUtils.Hide(val); } } internal static void SetDirectChildObjectsActive(string path, bool active) { GameObject val = Find(path); if (!((Object)(object)val == (Object)null)) { Transform transform = val.transform; for (int i = 0; i < transform.childCount; i++) { ((Component)transform.GetChild(i)).gameObject.SetActive(active); } } } internal static void SetObjectsNamedActive(string objectName, bool active) { IEnumerable<Transform> enumerable = from transform in Object.FindObjectsOfType<Transform>(true) where ((Object)transform).name == objectName select transform; foreach (Transform item in enumerable) { ((Component)item).gameObject.SetActive(active); } } private static void WithComponent<T>(string path, Action<T> action) where T : Component { T component = GetComponent<T>(path); if ((Object)(object)component != (Object)null) { action(component); } } private static T? GetComponent<T>(string path) where T : Component { GameObject val = Find(path); return (val != null) ? val.GetComponent<T>() : default(T); } } internal static class ResourceUtils { internal static T[] FindAll<T>() where T : Object { return Resources.FindObjectsOfTypeAll<T>(); } internal static T FindFirst<T>() where T : Object { return FindAll<T>()[0]; } internal static GameObject? FindGameObject(Func<GameObject, bool> predicate) { GameObject[] array = ResourceUtils.FindAll<GameObject>(); foreach (GameObject val in array) { if (predicate(val)) { return val; } } return null; } } internal static class CoroutineUtils { internal static IEnumerator DelayThen(float seconds, Action action) { yield return (object)new WaitForSeconds(seconds); action(); } internal static IEnumerator NextFrameThen(Action action) { yield return null; action(); } } internal static class AudioPrewarmUtils { internal static int Prewarm(AudioSource audioSource, IEnumerable<AudioClip?> clips, HashSet<int> prewarmedClipIds) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 AudioClip clip = audioSource.clip; float volume = audioSource.volume; float time = audioSource.time; bool isPlaying = audioSource.isPlaying; int num = 0; foreach (AudioClip clip2 in clips) { if (!((Object)(object)clip2 == (Object)null) && (int)clip2.loadType != 2 && prewarmedClipIds.Add(((Object)clip2).GetInstanceID())) { audioSource.clip = clip2; audioSource.volume = 0f; audioSource.Play(); audioSource.Pause(); audioSource.Stop(); audioSource.time = 0f; num++; } } audioSource.clip = clip; audioSource.volume = volume; if (isPlaying && (Object)(object)clip != (Object)null) { audioSource.time = Mathf.Min(time, clip.length); audioSource.Play(); } else { audioSource.Stop(); } return num; } } internal static class ConfigStringUtils { internal static List<string> SplitCommaSeparated(string raw) { List<string> list = new List<string>(); if (string.IsNullOrWhiteSpace(raw)) { return list; } string[] array = raw.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0) { list.Add(text); } } return list; } internal static Dictionary<string, string> ParseAssignments(string raw, char separator) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); if (string.IsNullOrWhiteSpace(raw)) { return dictionary; } foreach (string item in SplitCommaSeparated(raw)) { int num = item.IndexOf(separator); if (num > 0 && num < item.Length - 1) { string text = item.Substring(0, num).Trim(); string text2 = item; int num2 = num + 1; string text3 = text2.Substring(num2, text2.Length - num2).Trim(); if (text.Length != 0 && text3.Length != 0) { dictionary[text] = text3; } } } return dictionary; } internal static Dictionary<string, int> ParseIntAssignments(string raw, char separator, int minValue, int maxValue) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); if (string.IsNullOrWhiteSpace(raw)) { return dictionary; } foreach (string item in SplitCommaSeparated(raw)) { int num = item.LastIndexOf(separator); if (num > 0 && num < item.Length - 1) { string text = item.Substring(0, num).Trim(); string text2 = item; int num2 = num + 1; string s = text2.Substring(num2, text2.Length - num2).Trim(); if (text.Length != 0 && int.TryParse(s, out var result) && result >= minValue && result <= maxValue) { dictionary[text] = result; } } } return dictionary; } } internal static class CanvasGroupUtils { internal static CanvasGroup GetOrAdd(GameObject gameObject) { CanvasGroup component = gameObject.GetComponent<CanvasGroup>(); return Object.op_Implicit((Object)(object)component) ? component : gameObject.AddComponent<CanvasGroup>(); } internal static CanvasGroup GetOrAdd(Transform transform) { return GetOrAdd(((Component)transform).gameObject); } internal static float GetAlpha(Transform transform) { CanvasGroup component = ((Component)transform).GetComponent<CanvasGroup>(); return Object.op_Implicit((Object)(object)component) ? component.alpha : 1f; } internal static void SetAlpha(Transform transform, float alpha) { GetOrAdd(((Component)transform).gameObject).alpha = alpha; } internal static void SetAlpha(float alpha, CanvasGroup? first, CanvasGroup? second, CanvasGroup? third, CanvasGroup? fourth) { if (first != null) { first.alpha = alpha; } if (second != null) { second.alpha = alpha; } if (third != null) { third.alpha = alpha; } if (fourth != null) { fourth.alpha = alpha; } } internal static void Hide(GameObject gameObject) { CanvasGroup orAdd = GetOrAdd(gameObject); orAdd.alpha = 0f; orAdd.interactable = false; orAdd.blocksRaycasts = false; } } internal static class AssetBundleUtils { internal static bool TryLoadAsset<T>(string bundleFileName, string assetPath, out T? asset, out string bundlePath) where T : Object { string path = Path.GetDirectoryName(typeof(Plugin).Assembly.Location) ?? string.Empty; bundlePath = Path.Combine(path, bundleFileName); AssetBundle val = AssetBundle.LoadFromFile(bundlePath); if ((Object)(object)val == (Object)null) { asset = default(T); return false; } asset = val.LoadAsset<T>(assetPath); val.Unload(false); return (Object)(object)asset != (Object)null; } } } namespace NicheTweaks.Tweaks.Visuals { [HarmonyPatch(typeof(FilmGrain))] internal static class FilmGrainDisableTweak { [HarmonyPatch("IsActive")] [HarmonyPrefix] private static bool Prefix(ref bool __result) { __result = false; return false; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] internal static class LODBiasOverrideSetupTweak { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { HDAdditionalCameraData cam = default(HDAdditionalCameraData); if (((Component)__instance.gameplayCamera).TryGetComponent<HDAdditionalCameraData>(ref cam)) { LODBiasOverride.Apply(cam); } } } internal static class LODBiasOverride { internal static void Apply(HDAdditionalCameraData cam) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) cam.customRenderingSettings = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true; ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true); ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true); cam.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2; cam.renderingPathCustomFrameSettings.lodBias = ConfigManager.LODBias.Value; } } internal static class MoonVFXBlock { [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] private static void Postfix(RoundManager __instance) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) SelectableLevel currentLevel = __instance.currentLevel; string sceneName = currentLevel.sceneName; HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string item2 in ConfigStringUtils.SplitCommaSeparated(ConfigManager.BlockCustomMoonVFXMoonFilter.Value)) { string text = item2.Trim(); string item; if (!text.EndsWith("Level", StringComparison.OrdinalIgnoreCase)) { item = text; } else { string text2 = text; item = text2.Substring(0, text2.Length - 5); } hashSet.Add(item); } string text3 = ((Object)currentLevel).name.Trim(); if (text3.EndsWith("Level", StringComparison.OrdinalIgnoreCase)) { string text2 = text3; text3 = text2.Substring(0, text2.Length - 5); } if (hashSet.Count > 0 && !hashSet.Contains(text3)) { Log.Debug("Custom moon volume changes skipped for " + text3); return; } Scene sceneByName = SceneManager.GetSceneByName(sceneName); if (!((Scene)(ref sceneByName)).IsValid() || !((Scene)(ref sceneByName)).isLoaded) { Log.Debug("Moon level scene " + sceneName + " was not ready for volume changes"); return; } int num = 0; int num2 = 0; int num3 = 0; WeatherEffect[] effects = TimeOfDay.Instance.effects; GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); Fog val4 = default(Fog); ColorAdjustments val5 = default(ColorAdjustments); for (int i = 0; i < rootGameObjects.Length; i++) { LocalVolumetricFog[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren<LocalVolumetricFog>(true); for (int j = 0; j < componentsInChildren.Length; j++) { bool flag = false; foreach (WeatherEffect val in effects) { if (((Object)(object)val.effectObject != (Object)null && ((Component)componentsInChildren[j]).transform.IsChildOf(val.effectObject.transform)) || ((Object)(object)val.effectPermanentObject != (Object)null && ((Component)componentsInChildren[j]).transform.IsChildOf(val.effectPermanentObject.transform))) { flag = true; break; } } if (!flag && ((Behaviour)componentsInChildren[j]).enabled) { ((Behaviour)componentsInChildren[j]).enabled = false; num2++; } } Volume[] componentsInChildren2 = rootGameObjects[i].GetComponentsInChildren<Volume>(true); foreach (Volume val2 in componentsInChildren2) { if (val2.isGlobal || (Object)(object)val2.sharedProfile == (Object)null) { continue; } bool flag2 = false; foreach (WeatherEffect val3 in effects) { if (((Object)(object)val3.effectObject != (Object)null && ((Component)val2).transform.IsChildOf(val3.effectObject.transform)) || ((Object)(object)val3.effectPermanentObject != (Object)null && ((Component)val2).transform.IsChildOf(val3.effectPermanentObject.transform))) { flag2 = true; break; } } if (!flag2) { num++; if (val2.profile.TryGet<Fog>(ref val4) && ((VolumeComponent)val4).active) { ((VolumeComponent)val4).active = false; num2++; } if (val2.profile.TryGet<ColorAdjustments>(ref val5) && ((VolumeComponent)val5).active) { ((VolumeComponent)val5).active = false; num3++; } } } } Log.Info($"Disabled {num2} local fog components and {num3} local volume colour adjustments in {num} volumes in {sceneName}"); } [HarmonyPatch(typeof(NetworkManager), "SetSingleton")] [HarmonyPostfix] private static void RegisterPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MrHat.NicheTweaks.MoonVFXBlock"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash("MrHat.NicheTweaks")); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } internal static class PlayerArmsHideTweak { [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { ((Renderer)__instance.thisPlayerModelArms).enabled = false; } } internal static class ToyCubeTextureFixTweak { private const string BundleFileName = "toycubefixassets"; private const string MaterialAssetPath = "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat"; private static Material? fixedToyCubeMaterial; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void OnGameNetworkManagerStart() { if ((Object)(object)fixedToyCubeMaterial == (Object)null && !AssetBundleUtils.TryLoadAsset<Material>("toycubefixassets", "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat", out fixedToyCubeMaterial, out string bundlePath)) { Log.Error("toy cube material missing from asset bundle at " + bundlePath); return; } GameObject[] array = ResourceUtils.FindAll<GameObject>(); GrabbableObject val2 = default(GrabbableObject); foreach (GameObject val in array) { if (!val.TryGetComponent<GrabbableObject>(ref val2)) { continue; } Item itemProperties = val2.itemProperties; if (!((Object)(object)itemProperties == (Object)null) && IsToyCubeName(itemProperties.itemName)) { MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(true); if (!((Object)(object)componentInChildren == (Object)null)) { ((Renderer)componentInChildren).sharedMaterial = fixedToyCubeMaterial; break; } } } } private static bool IsToyCubeName(string itemName) { if (string.IsNullOrWhiteSpace(itemName)) { return false; } string text = itemName.Replace(" ", ""); return text.Equals("ToyCube", StringComparison.OrdinalIgnoreCase); } } } namespace NicheTweaks.Tweaks.Visuals.PlayerSelfShadow { internal static class HeldItemShadowDisableTweak { [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] [HarmonyPostfix] private static void GrabItemPostfix(GrabbableObject __instance) { Refresh(__instance); } [HarmonyPatch(typeof(GrabbableObject), "EquipItem")] [HarmonyPostfix] private static void EquipItemPostfix(GrabbableObject __instance) { Refresh(__instance); } [HarmonyPatch(typeof(GrabbableObject), "DiscardItem")] [HarmonyPostfix] private static void DiscardItemPostfix(GrabbableObject __instance) { if (__instance.hasHitGround) { HeldItemShadowCache.RestoreIfGrounded(__instance); } } [HarmonyPatch(typeof(GrabbableObject), "OnHitGround")] [HarmonyPostfix] private static void OnHitGroundPostfix(GrabbableObject __instance) { HeldItemShadowCache.RestoreIfGrounded(__instance); } internal static void RefreshHeldItems(PlayerControllerB player) { if ((Object)(object)player == (Object)null || player.ItemSlots == null) { return; } for (int i = 0; i < player.ItemSlots.Length; i++) { GrabbableObject val = player.ItemSlots[i]; if (!((Object)(object)val == (Object)null)) { Refresh(val); } } } private static void Refresh(GrabbableObject item) { if ((Object)(object)item == (Object)null) { return; } if (!item.isHeld) { if (item.hasHitGround) { HeldItemShadowCache.RestoreIfGrounded(item); } return; } PlayerControllerB playerHeldBy = item.playerHeldBy; if (playerHeldBy != null && ((NetworkBehaviour)playerHeldBy).IsOwner) { HeldItemShadowCache.Cache(item); if (LocalPlayerShadowDisableTweak.ShouldHideHeldItemShadows(playerHeldBy)) { HeldItemShadowCache.ApplyHeld(item); } else { HeldItemShadowCache.Restore(item); } } } } internal static class HeldItemShadowCache { private class CachedItemShadowState(CachedRendererShadowState[] renderers, bool hasAnyShadowEnabled) { public readonly CachedRendererShadowState[] Renderers = renderers; public readonly bool HasAnyShadowEnabled = hasAnyShadowEnabled; public bool ShadowsHidden; } private readonly struct CachedRendererShadowState { public readonly Renderer Renderer; public readonly ShadowCastingMode ShadowCastingMode; public CachedRendererShadowState(Renderer renderer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Renderer = renderer; ShadowCastingMode = renderer.shadowCastingMode; } } private static readonly Dictionary<GrabbableObject, CachedItemShadowState> cachedItems = new Dictionary<GrabbableObject, CachedItemShadowState>(); internal static void Cache(GrabbableObject item) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 if ((Object)(object)item == (Object)null || cachedItems.ContainsKey(item)) { return; } Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren<Renderer>(true); List<CachedRendererShadowState> list = new List<CachedRendererShadowState>(componentsInChildren.Length); bool hasAnyShadowEnabled = false; foreach (Renderer val in componentsInChildren) { if (val is MeshRenderer || val is SkinnedMeshRenderer) { list.Add(new CachedRendererShadowState(val)); if ((int)val.shadowCastingMode > 0) { hasAnyShadowEnabled = true; } } } if (list.Count != 0) { cachedItems[item] = new CachedItemShadowState(list.ToArray(), hasAnyShadowEnabled); } } internal static void ApplyHeld(GrabbableObject item) { if (item == null || !item.isHeld || !cachedItems.TryGetValue(item, out CachedItemShadowState value) || !value.hasAnyShadowEnabled || value.ShadowsHidden) { return; } for (int i = 0; i < value.renderers.Length; i++) { Renderer renderer = value.renderers[i].Renderer; if (!((Object)(object)renderer == (Object)null)) { renderer.shadowCastingMode = (ShadowCastingMode)0; } } value.ShadowsHidden = true; } internal static void Restore(GrabbableObject item) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || !cachedItems.TryGetValue(item, out CachedItemShadowState value) || !value.hasAnyShadowEnabled || !value.ShadowsHidden) { return; } for (int i = 0; i < value.renderers.Length; i++) { CachedRendererShadowState cachedRendererShadowState = value.renderers[i]; if (!((Object)(object)cachedRendererShadowState.Renderer == (Object)null)) { cachedRendererShadowState.Renderer.shadowCastingMode = cachedRendererShadowState.ShadowCastingMode; } } value.ShadowsHidden = false; } internal static void RestoreIfGrounded(GrabbableObject item) { if (item != null && item.hasHitGround) { Restore(item); } } internal static void Clear() { cachedItems.Clear(); } } [HarmonyPatch] internal static class LocalFlashlightSelfShadowCompat { private static FieldInfo? cachedPublicFlashStateField; [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method("LocalFlashlight.LightScript:Toggle", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { LocalPlayerShadowDisableTweak.Refresh(val); } } private static bool GetPublicFlashState() { if (cachedPublicFlashStateField == null) { Type type = Type.GetType("LocalFlashlight.LightScript, LocalFlashlight"); if (type == null) { return false; } cachedPublicFlashStateField = type.GetField("publicFlashState", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (cachedPublicFlashStateField == null) { return false; } } return (bool)cachedPublicFlashStateField.GetValue(null); } internal static bool IsLocalFlashlightOn() { return GetPublicFlashState(); } } [HarmonyPatch] internal static class LocalPlayerShadowDisableTweak { private static readonly HashSet<FlashlightItem> cachedFlashlights = new HashSet<FlashlightItem>(); private static PlayerControllerB? cachedPlayer; private static SkinnedMeshRenderer? cachedLod1Renderer; private static SkinnedMeshRenderer? cachedLod2Renderer; private static bool CacheRenderers(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if (!((NetworkBehaviour)player).IsOwner) { return false; } if ((Object)(object)cachedPlayer == (Object)(object)player && ((Object)(object)cachedLod1Renderer != (Object)null || (Object)(object)cachedLod2Renderer != (Object)null)) { return true; } cachedPlayer = player; Transform val = ((Component)player).transform.Find("ScavengerModel"); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = val.Find("LOD1"); Transform val3 = val.Find("LOD2"); cachedLod1Renderer = ((val2 != null) ? ((Component)val2).GetComponent<SkinnedMeshRenderer>() : null); cachedLod2Renderer = ((val3 != null) ? ((Component)val3).GetComponent<SkinnedMeshRenderer>() : null); return (Object)(object)cachedLod1Renderer != (Object)null || (Object)(object)cachedLod2Renderer != (Object)null; } private static void SetLODRenderers(PlayerControllerB player, bool enabled) { if (CacheRenderers(player)) { SkinnedMeshRenderer? obj = cachedLod1Renderer; if (obj != null) { ((Renderer)obj).enabled = enabled; } SkinnedMeshRenderer? obj2 = cachedLod2Renderer; if (obj2 != null) { ((Renderer)obj2).enabled = enabled; } } } internal static void RegisterFlashlight(FlashlightItem flashlight) { if (!((Object)(object)flashlight == (Object)null)) { cachedFlashlights.Add(flashlight); } } internal static void UnregisterFlashlight(FlashlightItem flashlight) { if (!((Object)(object)flashlight == (Object)null)) { cachedFlashlights.Remove(flashlight); } } internal static void ClearCache() { cachedFlashlights.Clear(); cachedPlayer = null; cachedLod1Renderer = null; cachedLod2Renderer = null; } private static void Refresh(PlayerControllerB player, bool hide) { SetLODRenderers(player, !hide); } private static bool ShouldHidePlayerSelfShadow(PlayerControllerB player) { if (player == null || !((NetworkBehaviour)player).IsOwner) { return false; } if (Keys.hasLocalFlashlight && LocalFlashlightSelfShadowCompat.IsLocalFlashlightOn()) { return true; } bool flag = IsAnyFlashlightOn(player); Light helmetLight = player.helmetLight; bool flag2 = helmetLight != null && ((Behaviour)helmetLight).enabled; return flag || flag2; } internal static bool ShouldHideHeldItemShadows(PlayerControllerB player) { if (player == null || !((NetworkBehaviour)player).IsOwner) { return false; } return !TooManyEmotesSelfShadowCompat.IsLocalPlayerEmoting() && ((Keys.hasLocalFlashlight && LocalFlashlightSelfShadowCompat.IsLocalFlashlightOn()) || IsAnyFlashlightOn(player)); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] private static void Postfix_StartOfRound() { ClearCache(); } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "Start")] private static void Postfix_FlashlightStart(FlashlightItem __instance) { RegisterFlashlight(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ChangeHelmetLight")] private static void Postfix_ChangeHelmetLight(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { Refresh(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void Postfix_PlayerStart(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { Refresh(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] private static void Postfix_SwitchFlashlight(FlashlightItem __instance) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner) { Refresh(playerHeldBy); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "DiscardItem")] private static void Postfix_DropFlashlight() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).IsOwner) { Refresh(val); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] private static void Postfix_EquipFlashlight(FlashlightItem __instance) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner) { Refresh(playerHeldBy); } } internal static void Refresh(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { bool hide = !TooManyEmotesSelfShadowCompat.IsLocalPlayerEmoting() && ShouldHidePlayerSelfShadow(player); Refresh(player, hide); HeldItemShadowDisableTweak.RefreshHeldItems(player); } } private static void Refresh() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { Refresh(val); } } internal static void ApplyHideFromEmote(PlayerControllerB player) { Refresh(player, hide: true); HeldItemShadowDisableTweak.RefreshHeldItems(player); } internal static void ApplyShowFromEmote(PlayerControllerB player) { Refresh(player, hide: false); HeldItemShadowDisableTweak.RefreshHeldItems(player); } private static bool IsAnyFlashlightOn(PlayerControllerB player) { if (cachedFlashlights.Count == 0) { return false; } List<FlashlightItem> list = null; bool result = false; foreach (FlashlightItem cachedFlashlight in cachedFlashlights) { if ((Object)(object)cachedFlashlight == (Object)null) { if (list == null) { list = new List<FlashlightItem>(); } list.Add(cachedFlashlight); } else if (!((Object)(object)((GrabbableObject)cachedFlashlight).playerHeldBy != (Object)(object)player) && ((GrabbableObject)cachedFlashlight).isBeingUsed) { result = true; break; } } if (list != null) { for (int i = 0; i < list.Count; i++) { cachedFlashlights.Remove(list[i]); } } return result; } internal static void RefreshLocalPlayerNextFrame() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { ((MonoBehaviour)val).StartCoroutine(DelayedRefresh()); } } private static IEnumerator DelayedRefresh() { yield return null; Refresh(); } } [HarmonyPatch] internal static class TooManyEmotesSelfShadowCompat { private static bool localPlayerIsEmoting; internal static bool IsLocalPlayerEmoting() { return localPlayerIsEmoting; } [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStartCustomEmoteLocal")] [HarmonyPostfix] private static void OnStartEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { localPlayerIsEmoting = true; LocalPlayerShadowDisableTweak.ApplyShowFromEmote(val); } } [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStopCustomEmoteLocal")] [HarmonyPostfix] private static void OnStopEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { localPlayerIsEmoting = false; LocalPlayerShadowDisableTweak.Refresh(val); LocalPlayerShadowDisableTweak.RefreshLocalPlayerNextFrame(); } } } } namespace NicheTweaks.Tweaks.Ship { [HarmonyPatch(typeof(StartOfRound), "Start")] internal static class ChargeStationScanNodeDisableTweak { [HarmonyPostfix] private static void OnStart() { SceneObjectUtils.SetActive("Environment/HangarShip/ShipModels2b/ChargeStation/ScanNode (1)", active: false); } } [HarmonyPatch] internal static class PlanetVideoReelDisableTweak { internal class StayDisabledForever : MonoBehaviour { private void Awake() { if (((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(false); } } private void OnEnable() { ((Component)this).gameObject.SetActive(false); } } private static GameObject? planetVideoReel; [HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")] [HarmonyPatch(typeof(StartOfRound), "PlayerLoadedClientRpc")] [HarmonyPatch(typeof(StartOfRound), "PlayerLoadedServerRpc")] [HarmonyPostfix] private static void Postfix() { if ((Object)(object)planetVideoReel == (Object)null) { planetVideoReel = SceneObjectUtils.Find("MapScreenUI/PlanetVideoReel"); } if (!((Object)(object)planetVideoReel == (Object)null) && (Object)(object)planetVideoReel.GetComponent<StayDisabledForever>() == (Object)null) { planetVideoReel.AddComponent<StayDisabledForever>(); } } } internal static class ShipDoorCloseTweak { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnApply; } private const string Request = "MrHat.NicheTweaks.ShipDoorClose.Request"; private const string Apply = "MrHat.NicheTweaks.ShipDoorClose.Apply"; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRoundStartPostfix() { Wired(); } [HarmonyPatch(typeof(StartMatchLever), "StartGame")] [HarmonyPostfix] private static void StartMatchLeverStartGamePostfix() { Wired(); SendRequest(); } private static void Wired() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; customMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Request"); customMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Apply"); object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Request", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnApply; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnApply; <>O.<1>__OnApply = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("MrHat.NicheTweaks.ShipDoorClose.Apply", (HandleNamedMessageDelegate)obj2); } private unsafe static void SendRequest() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessage("MrHat.NicheTweaks.ShipDoorClose.Request", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void OnRequest(ulong sender, FastBufferReader reader) { if (NetworkManager.Singleton.IsServer) { Broadcast(); ApplyLocal(); } } private static void OnApply(ulong sender, FastBufferReader reader) { ApplyLocal(); } private unsafe static void Broadcast() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessageToAll("MrHat.NicheTweaks.ShipDoorClose.Apply", val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void ApplyLocal() { StartOfRound instance = StartOfRound.Instance; HangarShipDoor val = Object.FindObjectOfType<HangarShipDoor>(); instance.SetShipDoorsClosed(true); val.PlayDoorAnimation(true); val.SetDoorButtonsEnabled(false); } } } namespace NicheTweaks.Tweaks.QoL { internal static class AmbientMusicPrewarmTweak { private static readonly HashSet<int> prewarmedClipIds = new HashSet<int>(); [HarmonyPatch(typeof(SoundManager), "Start")] [HarmonyPostfix] private static void Postfix(SoundManager __instance) { AudioSource musicSource = __instance.musicSource; if ((Object)(object)musicSource == (Object)null) { Log.Error("Ambient music warmup skipped because music source was not ready"); return; } Stopwatch stopwatch = Stopwatch.StartNew(); List<AudioClip> list = GetAmbientMusicClips(__instance).ToList(); int num = AudioPrewarmUtils.Prewarm(musicSource, list, prewarmedClipIds); stopwatch.Stop(); Log.Debug(string.Format("Ambient music warmup completed in {0:F2} ms with {1} clips prewarmed; {2}", stopwatch.Elapsed.TotalMilliseconds, num, string.Join(", ", from clip in list where (Object)(object)clip != (Object)null select ((Object)clip).name))); } private static IEnumerable<AudioClip?> GetAmbientMusicClips(SoundManager soundManager) { AudioClip[] daytimeMusic = soundManager.DaytimeMusic; for (int i = 0; i < daytimeMusic.Length; i++) { yield return daytimeMusic[i]; } AudioClip[] eveningMusic = soundManager.EveningMusic; for (int j = 0; j < eveningMusic.Length; j++) { yield return eveningMusic[j]; } } } internal static class DeadPlayersSeeGhostGirlTweak { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnApply; } private const string Request = "MrHat.NicheTweaks.GhostGirlVisibility.Request"; private const string Apply = "MrHat.NicheTweaks.GhostGirlVisibility.Apply"; private static readonly HashSet<ulong> visibleGhostGirlIds = new HashSet<ulong>(); private static readonly HashSet<ulong> shownGhostGirlIds = new HashSet<ulong>(); [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRoundStartPostfix() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown try { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Request"); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Apply"); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Request", (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnApply; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnApply; <>O.<1>__OnApply = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Apply", (HandleNamedMessageDelegate)obj2); Log.Debug("Ghost Girl visibility network handlers connected"); } catch (Exception arg) { Log.Error($"Ghost Girl visibility network handlers could not be connected because {arg}"); } } [HarmonyPatch(typeof(GameNetworkManager), "SetInstanceValuesBackToDefault")] [HarmonyPostfix] private static void GameNetworkManagerSetInstanceValuesBackToDefaultPostfix() { if ((Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } try { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Request"); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("MrHat.NicheTweaks.GhostGirlVisibility.Apply"); Log.Debug("Ghost Girl visibility network handlers disconnected");