Decompiled source of NicheTweaks v0.3.3
NicheTweaks.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.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 GameNetcodeStuff; using HarmonyLib; using LethalThings; using Lethal_Nuke; using Microsoft.CodeAnalysis; using NicheTweaks; using NicheTweaks.ExternalTweaks.BetterSavesImprovedLobby; using NicheTweaks.ExternalTweaks.DawnLib; using NicheTweaks.ExternalTweaks.Diversity; using NicheTweaks.ExternalTweaks.EladsHUD.AutoHide; using NicheTweaks.ExternalTweaks.EladsHUD.HUDReorder; using NicheTweaks.ExternalTweaks.EladsHUD.Misc; using NicheTweaks.ExternalTweaks.ImmersiveVisor; using NicheTweaks.ExternalTweaks.InputUtils; using NicheTweaks.ExternalTweaks.LethalConfig; using NicheTweaks.ExternalTweaks.LethalNuke; using NicheTweaks.ExternalTweaks.LethalThings; using NicheTweaks.ExternalTweaks.MagicShippingCrate; using NicheTweaks.ExternalTweaks.MoreBlood; using NicheTweaks.ExternalTweaks.MoreCompany; using NicheTweaks.ExternalTweaks.ShipWindows; using NicheTweaks.NetcodePatcher; using NicheTweaks.Patches; using NicheTweaks.Tweaks; using NicheTweaks.Tweaks.GlobalVolumeSlider; using NicheTweaks.Tweaks.InteractCooldowns; using NicheTweaks.Tweaks.ItemTooltipRenamer; using NicheTweaks.Tweaks.LightningOverlay; using NicheTweaks.Tweaks.PlayerBloodSpill; using NicheTweaks.Tweaks.PlayerSelfShadow; using NicheTweaks.Tweaks.ShipDoorClose; using NicheTweaks.Tweaks.VFX; using NicheTweaks.Utils; using ShipWindows; using ShipWindows.Api; 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.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.VFX; [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.3.3.0")] [assembly: AssemblyInformationalVersion("0.3.3")] [assembly: AssemblyProduct("NicheTweaks")] [assembly: AssemblyTitle("NicheTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class DropshipItemInteractCooldown { private static float blockUntilTime; private static bool blockActive; internal static void StartCooldown(float seconds) { blockUntilTime = Time.time + seconds; blockActive = true; Plugin.mls.LogDebug((object)string.Format("[{0}] Dropship cooldown started. Blocking all interact input for {1} seconds.", "NicheTweaks", seconds)); } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] [HarmonyPrefix] private static bool Prefix(PlayerControllerB __instance, CallbackContext context) { if (!blockActive) { return true; } if (Time.time >= blockUntilTime) { blockActive = false; Plugin.mls.LogDebug((object)"[NicheTweaks] Cooldown ended. Interact input restored."); return true; } Plugin.mls.LogDebug((object)("[NicheTweaks] BLOCKED interact performed for player " + __instance.playerUsername + " (cooldown active)")); return false; } [HarmonyPatch(typeof(InteractTrigger), "Interact")] [HarmonyPostfix] private static void Postfix(InteractTrigger __instance) { ItemDropship componentInParent = ((Component)__instance).GetComponentInParent<ItemDropship>(); if (!((Object)(object)componentInParent == (Object)null)) { StartCooldown(ConfigManager.DropshipPickupDelayTime.Value); } } } namespace NicheTweaks { internal static class ConfigManager { internal const string Audio = "Audio"; internal const string Decals = "Decals"; internal const string UI = "UI"; internal const string Visuals = "Visuals"; internal const string Ship = "Ship"; internal const string QoL = "QoL"; internal const string OtherMods = "zOther mods"; internal const string EladsHUD = "zzEladsHUD"; internal static ConfigEntry<bool> SilenceRingingEarsAudio { get; private set; } internal static ConfigEntry<bool> SilenceLightningStatic { get; private set; } internal static ConfigEntry<bool> EnableDecalDrawDistanceOverride { get; private set; } internal static ConfigEntry<bool> EnableFootprintPoolOverride { get; private set; } internal static ConfigEntry<int> FootprintPoolSize { get; private set; } internal static ConfigEntry<bool> EnablePlayerBlood { get; private set; } internal static ConfigEntry<int> MinimumDamageForBlood { get; private set; } internal static ConfigEntry<int> BloodAmount { get; private set; } internal static ConfigEntry<float> BloodDecalSize { get; private set; } internal static ConfigEntry<bool> 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> RepositionInventory { get; private set; } internal static ConfigEntry<string> InventoryPosition { get; private set; } internal static ConfigEntry<bool> ItemLightningBorder { get; private set; } internal static ConfigEntry<bool> HideHUDAtTerminal { get; private set; } internal static ConfigEntry<bool> EnableFloodedCondensation { get; private set; } internal static ConfigEntry<bool> FixQuitGameMenuHighlightColours { get; private set; } internal static ConfigEntry<bool> QuitGameColourConsistency { get; private set; } internal static ConfigEntry<bool> HideInviteFriendsMoveResume { get; private set; } internal static ConfigEntry<bool> HideJoinButton { get; private set; } internal static ConfigEntry<bool> DisableControlTips { get; private set; } internal static ConfigEntry<bool> EnableTooltipRename { get; private set; } internal static ConfigEntry<string> TooltipItemsToRename { get; private set; } internal static ConfigEntry<string> AllItemNamesList { get; private set; } internal static ConfigEntry<bool> DisableFilmGrain { get; private set; } internal static ConfigEntry<bool> BlockCustomMoonVFX { get; private set; } internal static ConfigEntry<string> BlockCustomMoonVFXMoonFilter { get; private set; } internal static ConfigEntry<bool> DisableLocalPlayerSelfShadow { get; private set; } internal static ConfigEntry<bool> HidePlayerArms { get; private set; } internal static ConfigEntry<bool> DisableInspectItem { get; private set; } internal static ConfigEntry<bool> ToyCubeTextureFix { get; private set; } internal static ConfigEntry<bool> EnableLODOverride { get; private set; } internal static ConfigEntry<float> LODBias { get; private set; } internal static ConfigEntry<bool> DisableChargeStationScanNode { get; private set; } internal static ConfigEntry<bool> CloseShipDoorOnLeverPull { get; private set; } internal static ConfigEntry<bool> EnableTerminalDecorStringPrefix { get; private set; } internal static ConfigEntry<bool> EnableGlobalVolumeMeter { get; private set; } internal static ConfigEntry<bool> EnableDropshipPickupDelay { get; private set; } internal static ConfigEntry<float> DropshipPickupDelayTime { get; private set; } internal static ConfigEntry<bool> EnableShipTeleporterBlock { get; private set; } internal static ConfigEntry<bool> EnableLandmineFix { get; private set; } internal static ConfigEntry<bool> DisableAchievementPopups { get; private set; } internal static ConfigEntry<bool> FixMoreBloodFootprints { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyMenuButton { get; private set; } internal static ConfigEntry<bool> HideMoreCompanyCrewCount { get; private set; } internal static ConfigEntry<bool> MoreCompanyOrangeCosmeticButton { get; private set; } internal static ConfigEntry<bool> LobbyImprovementsTextEdit { get; private set; } internal static ConfigEntry<bool> BetterSavesTextEdit { get; private set; } internal static ConfigEntry<bool> HideKeybindsLegacyButton { get; private set; } internal static ConfigEntry<bool> HideLethalConfigMenu { get; private set; } internal static ConfigEntry<bool> AddSpaceToLethalConfig { get; private set; } internal static ConfigEntry<bool> EnableLIUtilBeltAlign { get; private set; } internal static ConfigEntry<bool> MZCoMagicShippingNeverRespawns { get; private set; } internal static ConfigEntry<bool> FixDisabledWatcherSoftlock { get; private set; } internal static ConfigEntry<bool> ImmersiveVisorWorksWithHurricane { get; private set; } internal static ConfigEntry<bool> ShipWindowsOpenClose { get; private set; } internal static ConfigEntry<bool> LethalNukeFix { get; private set; } internal static ConfigEntry<bool> EnableEladsHUDReorder { get; private set; } internal static ConfigEntry<bool> FixStaminaTenPercent { get; private set; } internal static ConfigEntry<bool> DisableEladsHUDStaminaNotch { get; private set; } internal static ConfigEntry<bool> HideEladsHUDWeight { get; private set; } internal static ConfigEntry<bool> EladsHUDTriggerHealthShowOnHeal { get; private set; } internal static ConfigEntry<bool> EladsHUDHideStaminaPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideStamina { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideDelay { get; private set; } internal static ConfigEntry<float> EladsHUDStaminaAutoHideStartPercent { get; private set; } internal static ConfigEntry<bool> EladsHUDWeightTriggersStamina { get; private set; } internal static ConfigEntry<bool> EladsHUDHideOxygenPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideOxygen { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenDelay { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideOxygenValue { get; private set; } internal static ConfigEntry<bool> EladsHUDHidePercentDividers { get; private set; } internal static ConfigEntry<bool> EladsHUDHideInsanityPercentage { get; private set; } internal static ConfigEntry<bool> EladsHUDAutoHideInsanity { get; private set; } internal static ConfigEntry<float> EladsHUDAutoHideInsanityDelay { get; private set; } private static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue, string description) { return config.Bind<T>(section, key, defaultValue, description); } internal static void CfgInit(ConfigFile config) { SilenceRingingEarsAudio = Bind(config, "Audio", "Silence ear ringing audio", defaultValue: false, "If true, silences the ear ringing audio from shotgun blasts."); SilenceLightningStatic = Bind(config, "Audio", "Silence lightning static audio", defaultValue: false, "If true, silences live lightning static that plays from a conductive item being targeted when entering the facility."); EnableDecalDrawDistanceOverride = Bind(config, "Decals", "Enable decal draw distance override", defaultValue: false, "If true, breaks the decal draw distance and causes decals to always be rendered. Will impact performance, not recommended without LethalSponge."); EnableFootprintPoolOverride = Bind(config, "Decals", "Enable footprint pool override", defaultValue: false, "If true, overrides the number of footprint decals allowed to exist."); FootprintPoolSize = Bind(config, "Decals", "Footprint pool size", 250, "Number of footprints that are allowed to be present before the oldest footprints start culling visually. Increasing this will impact performance."); EnablePlayerBlood = Bind(config, "Decals", "Enable player blood effects", defaultValue: false, "Enable blood effects when players take damage."); MinimumDamageForBlood = Bind(config, "Decals", "Minimum damage for blood", 5, "Minimum damage before blood splatter appears."); BloodAmount = Bind(config, "Decals", "Blood amount", 3, "Number of blood splatters a player takes damage."); BloodDecalSize = Bind(config, "Decals", "BloodDecalSize", 3f, "Size of blood splats created by players taking damage."); 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."); RepositionInventory = Bind(config, "UI", "Reposition inventory slots", defaultValue: false, "If true, enables repositioning of the inventory."); InventoryPosition = Bind(config, "UI", "Inventory position", "X:87, Y:-124.125, Z:30.0001", "Position of Inventory UI/Hotbar. I recommend only touching the X and Y axis."); ItemLightningBorder = Bind(config, "UI", "Item Lightning Warning", defaultValue: false, "If true, warns the player which item is about to be struck by lightning with a visual indicator."); HideHUDAtTerminal = Bind(config, "UI", "Hide HUD at terminal", defaultValue: false, "If true, hides the HUD whilst at the terminal."); EnableFloodedCondensation = Bind(config, "UI", "Enable condensation on visor during flooded", defaultValue: false, "If true, shows helmet condensation during Flooded weather."); FixQuitGameMenuHighlightColours = Bind(config, "UI", "Fix quit game highlight colours", defaultValue: false, "If true, changes the green highlights and corners of the in-game quit menu to be highlighted orange like the rest of the game."); QuitGameColourConsistency = Bind(config, "UI", "Change quit game confirmation text to orange", defaultValue: false, "If true, changes the light blue 'Would you like to leave the game?' text to be orange."); HideInviteFriendsMoveResume = Bind(config, "UI", "Hide Invite Friends from pause menu", defaultValue: false, "If true, hides the Invite Friends button from the pause menu."); HideJoinButton = Bind(config, "UI", "Hide join button", defaultValue: false, "If true, hides the join crew button in the main menu."); DisableControlTips = Bind(config, "UI", "Hide control tips from HUD", defaultValue: false, "If true, hides the control tip labels (top right of HUD)."); EnableTooltipRename = Bind(config, "UI", "Customise control tip item name", defaultValue: false, "If true, enables the replacement of item control tip texts with their scan node text."); TooltipItemsToRename = Bind(config, "UI", "Items to change the control tip text of", "Brush = Hair brush,clipboard = Training manual,Bell = Brass bell,Gift = Gift box,Gold bar = Gold Bar,Hive = Bee hive,Ring = Wedding ring,Toy robot = Robot Toy,Metal sheet = Tattered metal sheet,Mug = Coffee mug,Rubber Ducky = Rubber ducky,Tea kettle = Tea Kettle,Ammo = Shotgun shell", "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"); DisableFilmGrain = Bind(config, "Visuals", "Disable film grain effect globally", defaultValue: false, "If true, globally disables film grain where it may be present."); BlockCustomMoonVFX = Bind(config, "Visuals", "Disable custom VFX on moons", defaultValue: false, "If true, disables all visual effects on moons, primarily for use with custom moons."); BlockCustomMoonVFXMoonFilter = Bind(config, "Visuals", "Disable custom VFX moon filter", "", "Moons to enable custom VFX disabling on. Separated by commas, example: Experimentation,Abaddon,Embrion. Empty = all moons."); DisableLocalPlayerSelfShadow = Bind(config, "Visuals", "Disable local player shadow", defaultValue: false, "If true, disables shadow casting for the local player only. Very useful for modded flashlights with very high intensities."); HidePlayerArms = Bind(config, "Visuals", "Hide player arms", defaultValue: false, "If true, hides the player arms."); DisableInspectItem = Bind(config, "Visuals", "Disable item inspection", defaultValue: false, "If true, disables the ability to inspect items."); ToyCubeTextureFix = Bind(config, "Visuals", "Enable texture fix for Toy cube", defaultValue: false, "If true, changes the texture of Toy cube (rubix cube) scrap to a texture of a rubix cube that is actually solvable."); EnableLODOverride = Bind(config, "Visuals", "Enable LOD bias override", defaultValue: false, "If true, enables custom LOD distance."); LODBias = Bind(config, "Visuals", "LOD bias", 1f, "LOD bias value. Increasing this will impact performance."); DisableChargeStationScanNode = Bind(config, "Ship", "Disable leftover charge station scan node", defaultValue: false, "If true, hides the scan node of the charge station inside the ship. This only affects the leftover scan node after moving the charge station with build mode."); CloseShipDoorOnLeverPull = Bind(config, "Ship", "Close ship doors when lever is pulled", defaultValue: false, "If true, closes the ship doors when the lever is pulled."); EnableTerminalDecorStringPrefix = Bind(config, "Ship", "Enable terminal decor prefix", defaultValue: false, "If true, gives decor listings a \"* \" prefix to match tool items and ship upgrade listings in the terminal store."); EnableGlobalVolumeMeter = Bind(config, "QoL", "Enable global voice volume slider", defaultValue: false, "If true, enables the global voice volume slider in the player list."); EnableDropshipPickupDelay = Bind(config, "QoL", "Enable dropship item pickup delay", defaultValue: false, "If true, adds a short delay to items dropped by the dropship before they can be grabbed."); DropshipPickupDelayTime = Bind(config, "QoL", "Dropship item pickup delay time", 1f, "Time in seconds before dropped items can be picked up."); EnableShipTeleporterBlock = Bind(config, "QoL", "Enable teleporter item pickup block", defaultValue: false, "If true, block item pickup whilst you are being teleported."); EnableLandmineFix = Bind(config, "QoL", "Remove landmine invisible bump", defaultValue: false, "Removes the invisible bump left by landmines after exploding."); DisableAchievementPopups = Bind(config, "zOther mods", "Hide and mute DawnLib achievement popups", defaultValue: false, "If true, hides DawnLib's achievement popup and sound."); FixMoreBloodFootprints = Bind(config, "zOther mods", "Fix MoreBlood footprint smearing", defaultValue: false, "If true, enable fix for MoreBlood footprint smearing."); HideMoreCompanyMenuButton = Bind(config, "zOther mods", "Hide MoreCompany main menu button", defaultValue: false, "If true, hides the MoreCompany cosmetics button in the main menu. Requires MoreCompany to be installed."); HideMoreCompanyCrewCount = Bind(config, "zOther mods", "Hide MoreCompany crew count in create lobby menu", defaultValue: false, "If true, hides the MoreCompany crew count in the create lobby menu. Requires MoreCompany to be installed."); MoreCompanyOrangeCosmeticButton = Bind(config, "zOther mods", "Change MoreCompany cosmetic button icon to orange", defaultValue: false, "If true, changes the cosmetic button in the main menu and the pause menu from green to orange. Requires MoreCompany to be installed."); LobbyImprovementsTextEdit = Bind(config, "zOther mods", "Change LobbyImprovements text", defaultValue: false, "If true, changes text on the create a lobby screen from 'ImprovedLobby' -> 'Lobby'. Requires LobbyImprovements to be installed."); BetterSavesTextEdit = Bind(config, "zOther mods", "Change BetterSaves text", defaultValue: false, "If true, changes text on the create a lobby screen from 'BetterSaves' -> 'Save Files'. Requires LCBetterSaves to be installed."); HideKeybindsLegacyButton = Bind(config, "zOther mods", "Hide legacy control button inside control settings", defaultValue: false, "If true, hide legacy control button inside control settings. Requires LethalCompany InputUtils to be installed."); HideLethalConfigMenu = Bind(config, "zOther mods", "Hide LethalConfig main menu button", defaultValue: false, "If true, hides LethalConfig button in the main menu."); AddSpaceToLethalConfig = Bind(config, "zOther mods", "Add space to LethalConfig", defaultValue: false, "If true, renames 'LethalConfig' to 'Lethal Config' in the main menu and in the pause menu in-game."); EnableLIUtilBeltAlign = Bind(config, "zOther mods", "Enable Utility Belt UI alignment fix", defaultValue: false, "If true, aligns Utility Belt item slots to the middle for consistency purposes. Requires LethalThings to be installed."); MZCoMagicShippingNeverRespawns = Bind(config, "zOther mods", "MZCoMagicShipping crate never respawns", defaultValue: false, "If true, the magic crate does not respawn and is single use only. Requires MZCoMagicShipping to be installed."); FixDisabledWatcherSoftlock = Bind(config, "zOther mods", "Prevent softlock from disabled watcher", defaultValue: false, "If true, fixes the softlock when launching the ship when the watcher is disabled. Requires Diversity to be installed."); ImmersiveVisorWorksWithHurricane = Bind(config, "zOther mods", "ImmersiveVisor works with Hurricane", defaultValue: false, "If true, Immersive Visor shows rain drops on the visor during hurricane weather. Requires ImmersiveVisor and Wesleys Weathers to be installed."); ShipWindowsOpenClose = Bind(config, "zOther mods", "Ship window shutters close on departure", defaultValue: false, "If true, ship window shutters close when the ship doors close on departure. Requires ShipWindows to be installed."); LethalNukeFix = Bind(config, "zOther mods", "Lethal Nuke Fix", defaultValue: false, "If true, prevents lethal nuke's particle effect from looping. Requires Lethal Nuke to be installed."); 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."); } internal static Vector3 ParseVector3(string value) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) float result = 0f; float result2 = 0f; float result3 = 0f; string[] array = value.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.StartsWith("X:")) { string text2 = text; float.TryParse(text2.Substring(2, text2.Length - 2), out result); } else if (text.StartsWith("Y:")) { string text2 = text; float.TryParse(text2.Substring(2, text2.Length - 2), out result2); } else if (text.StartsWith("Z:")) { string text2 = text; float.TryParse(text2.Substring(2, text2.Length - 2), out result3); } } return new Vector3(result, result2, result3); } internal static Quaternion ParseQuaternion(string value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(ParseVector3(value)); } internal static Vector3 ParseScale(string value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ParseVector3(value); } } [BepInPlugin("MrHat.NicheTweaks", "NicheTweaks", "0.3.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.NicheTweaks"; internal const string modName = "NicheTweaks"; internal const string modVersion = "0.3.3"; internal static Harmony _harmony; internal static ManualLogSource mls; internal static Plugin Instance; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.NicheTweaks"); _harmony = new Harmony("MrHat.NicheTweaks"); ConfigManager.CfgInit(((BaseUnityPlugin)this).Config); ChainloaderPluginKeys.Init(); ApplyPatches(); StartRunners(); if (ChainloaderPluginKeys.DiversityWatcherOn) { DiversitySpawnEnemyPatch.TryApply(_harmony); } } private static void Patch(params Type[] patchTypes) { for (int i = 0; i < patchTypes.Length; i++) { _harmony.PatchAll(patchTypes[i]); } } private static void PatchIf(bool condition, params Type[] patchTypes) { if (condition) { mls.LogDebug((object)("[NicheTweaks] Patch ran: " + patchTypes[0].Name)); Patch(patchTypes); } } private static GameObject CreateRunner(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; return val; } private static void StartRunners() { if (ChainloaderPluginKeys.EladsHUDHideStaminaPercentageOn || ChainloaderPluginKeys.EladsHUDHideInsanityPercentageOn) { GameObject val = CreateRunner("PercentageHideRunner"); if (ChainloaderPluginKeys.EladsHUDHideStaminaPercentageOn) { val.AddComponent<HideStaminaPercentageRunner>(); } if (ChainloaderPluginKeys.EladsHUDHideInsanityPercentageOn) { val.AddComponent<HideInsanityPercentageRunner>(); } } if (ChainloaderPluginKeys.EladsHUDAutoHideInsanityOn) { CreateRunner("InsanityAutoHideRunner").AddComponent<InsanityAutoHideUpdate>(); } if (ChainloaderPluginKeys.EladsHUDAutoHideOxygenOn) { CreateRunner("OxygenAutoHideRunner").AddComponent<OxygenAutoHideUpdate>(); } } private static void ApplyPatches() { PatchIf(ChainloaderPluginKeys.LethalNukeFixOn, typeof(NuclearBombPatches)); PatchIf(ChainloaderPluginKeys.FixChatColonOn, typeof(AddChatMessagePatch)); PatchIf(ChainloaderPluginKeys.ShipWindowsOpenCloseOn, typeof(ShipWindowsPatches)); PatchIf(ChainloaderPluginKeys.ImmersiveVisorHurricaneOn, typeof(ImmersiveVisorTranspiler)); PatchIf(ChainloaderPluginKeys.SilenceLightningStaticOn, typeof(EntranceTeleportPatches)); PatchIf(ChainloaderPluginKeys.ItemLightningBorderOn, typeof(LightningBorderHUDManagerStartPatch), typeof(LightningBorderHarmonyPatches)); PatchIf(ChainloaderPluginKeys.SilenceRingingEarsAudioOn, typeof(SetEarsRingingPatch)); PatchIf(ChainloaderPluginKeys.BetterSavesTextOn, typeof(BetterSavesPatches)); PatchIf(ChainloaderPluginKeys.LobbyImprovementsTextOn, typeof(ImprovedLobbyPatches)); PatchIf(ChainloaderPluginKeys.BlockCustomMoonVFXOn, typeof(RoundManagerPatches)); PatchIf(ChainloaderPluginKeys.ShipTeleporterBlockCheckOn, typeof(ShipTeleporterBeamCoroutinePatch), typeof(Interact_performedPatch)); PatchIf(ChainloaderPluginKeys.DawnlibAchievementsOn, typeof(DawnLibAchievementPopupPatch)); PatchIf(ChainloaderPluginKeys.HideLethalConfigMenuOn, typeof(HideMainMenuLethalConfig)); PatchIf(ChainloaderPluginKeys.AddSpaceToLethalConfigOn, typeof(LethalConfigSpaceInsert)); PatchIf(ChainloaderPluginKeys.MoreBloodOn, typeof(MoreBloodPatch)); PatchIf(ChainloaderPluginKeys.MZCoMagicShippingDestroyOn, typeof(MagicShippingCratePatch), typeof(MagicShippingCrateDestroyOnLoadPatch)); PatchIf(ChainloaderPluginKeys.HideMoreCompanyMenuButtonOn, typeof(MoreCompanyCosmeticsPatch)); PatchIf(ChainloaderPluginKeys.HideMoreCompanyCrewCountOn, typeof(MoreCompanyCrewCountPatchOnline), typeof(MoreCompanyCrewCountPatchLAN)); PatchIf(ChainloaderPluginKeys.MoreCompanyOrangeLogoOn, typeof(MoreCompanySetColourHUDManagerPatch), typeof(MoreCompanySetColourMenuManagerPatch)); PatchIf(ChainloaderPluginKeys.LethalThingsUIBeltAlignmentAllowedOn, typeof(LethalThingsPatch)); PatchIf(ChainloaderPluginKeys.EladsHUDAutoHideStaminaOn, typeof(StaminaAutoHide)); PatchIf(ChainloaderPluginKeys.FixStaminaTenPercentOn, typeof(StaminaTenPercentFix)); PatchIf(ChainloaderPluginKeys.EladsHUDTriggerHealthShowOnHealOn, typeof(HealthAppearOnHeal)); PatchIf(ChainloaderPluginKeys.EladsHUDReorderOn, typeof(EladsHUDStaminaCompat), typeof(InsanityDisplayCompat), typeof(InsanityDisplayPercentagePatch), typeof(OxygenCompat)); PatchIf(ChainloaderPluginKeys.DecalProjectorPatchOn, typeof(DecalProjectorPatch)); PatchIf(ChainloaderPluginKeys.FilmGrainPatchOn, typeof(FilmGrainPatch)); PatchIf(ChainloaderPluginKeys.HelmetCondensationDropsPatchOn, typeof(HelmetCondensationDropsPatch)); PatchIf(ChainloaderPluginKeys.DropshipItemInteractCooldownOn, typeof(DropshipItemInteractCooldown)); PatchIf(ChainloaderPluginKeys.InspectItemPatchOn, typeof(InspectItemPatch)); PatchIf(ChainloaderPluginKeys.ItemTooltipRenamerOn, typeof(ItemTooltipRenamer)); PatchIf(ChainloaderPluginKeys.LandminePatchesOn, typeof(LandminePatches)); PatchIf(ChainloaderPluginKeys.SetClockPatchOn, typeof(SetClockPatch)); PatchIf(ChainloaderPluginKeys.PlayerBloodNetworkOn, typeof(PlayerBloodSpill), typeof(DamagePlayerPatch)); PatchIf(ChainloaderPluginKeys.PlayerSelfShadowPatchOn, typeof(PlayerSelfShadowPatch)); PatchIf(ChainloaderPluginKeys.TooManyEmotesCompat, typeof(TooManyEmotesCompat)); PatchIf(ChainloaderPluginKeys.LocalFlashlightCompat, typeof(LocalFlashlightCompat)); PatchIf(ChainloaderPluginKeys.GlobalVolumeMeterOn, typeof(GlobalVolumeSlider), typeof(GlobalVoiceOverlay), typeof(AddUserToPlayerListPatch)); PatchIf(ChainloaderPluginKeys.FootprintPoolOverrideOn, typeof(InstantiateFootprintsPooledObjectsPatch)); Patch(typeof(StartOfRoundPatches), typeof(HUDManagerPatches), typeof(MenuManagerPatches), typeof(QuickMenuManagerPatches)); PatchIf(ChainloaderPluginKeys.PlayerArmsHiddenOn, typeof(PlayerControllerBUpdatePatch)); PatchIf(ChainloaderPluginKeys.HideKeybindsLegacyInputUtilsOn, typeof(KepRemapPanelPatch)); PatchIf(ChainloaderPluginKeys.TerminalDecorStringPrefixOn, typeof(TextPostProcessPatch)); PatchIf(ChainloaderPluginKeys.HideHUDAtTerminalOn, typeof(BeginUsingTerminalPatch), typeof(QuitTerminalPatch)); PatchIf(ChainloaderPluginKeys.LODOverrideOn, typeof(PlayerControllerBStart)); PatchIf(ChainloaderPluginKeys.CloseShipDoorOnLeverPullOn, typeof(StartMatchLeverPatches)); PatchIf(ChainloaderPluginKeys.ToyCubeTextureFixOn, typeof(ToyCubeMaterialPatch)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NicheTweaks"; public const string PLUGIN_NAME = "NicheTweaks"; public const string PLUGIN_VERSION = "0.3.3"; } } namespace NicheTweaks.Utils { internal static class ChainloaderPluginKeys { internal static bool hasLCBetterSaves { get; private set; } internal static bool hasLethalNuke { get; private set; } internal static bool hasMalfunctions { get; private set; } internal static bool hasImmersiveVisor { get; private set; } internal static bool hasLobbyImprovements { get; private set; } internal static bool hasInsanityDisplay { get; private set; } internal static bool hasEladsHUD { get; private set; } internal static bool hasOxygen { get; private set; } internal static bool hasHotbarPlus { get; private set; } internal static bool hasGeneralImprovements { get; private set; } internal static bool hasDawnLib { get; private set; } internal static bool hasLethalConfig { get; private set; } internal static bool hasMoreBlood { get; private set; } internal static bool hasMoreCompany { get; private set; } internal static bool hasLethalThings { get; private set; } internal static bool hasMZCoMagicShipping { get; private set; } internal static bool hasDiversity { get; private set; } internal static bool hasInputUtils { get; private set; } internal static bool hasTooManyEmotes { get; private set; } internal static bool hasLocalFlashlight { get; private set; } internal static bool hasShipWindows { get; private set; } internal static bool TooManyEmotesCompat { get; private set; } internal static bool LocalFlashlightCompat { get; private set; } internal static bool DawnlibAchievementsOn { get; private set; } internal static bool EladsHUDReorderOn { get; private set; } internal static bool DiversityWatcherOn { get; private set; } internal static bool MoreCompanyOrangeLogoOn { get; private set; } internal static bool HideKeybindsLegacyInputUtilsOn { get; private set; } internal static bool LethalThingsUIBeltAlignmentAllowedOn { get; private set; } internal static bool MZCoMagicShippingDestroyOn { get; private set; } internal static bool MoreBloodOn { get; private set; } internal static bool DividerToggleOn { get; private set; } internal static bool OxygenPercentToggleOn { get; private set; } internal static bool EladsHUDWeightToggleOn { get; private set; } internal static bool HideLethalConfigMenuOn { get; private set; } internal static bool AddSpaceToLethalConfigOn { get; private set; } internal static bool HideMoreCompanyMenuButtonOn { get; private set; } internal static bool HideMoreCompanyCrewCountOn { get; private set; } internal static bool EladsHUDHideStaminaPercentageOn { get; private set; } internal static bool EladsHUDHideInsanityPercentageOn { get; private set; } internal static bool EladsHUDAutoHideStaminaOn { get; private set; } internal static bool FixStaminaTenPercentOn { get; private set; } internal static bool EladsHUDTriggerHealthShowOnHealOn { get; private set; } internal static bool EladsHUDAutoHideInsanityOn { get; private set; } internal static bool EladsHUDAutoHideOxygenOn { get; private set; } internal static bool LobbyImprovementsTextOn { get; private set; } internal static bool BetterSavesTextOn { get; private set; } internal static bool ImmersiveVisorHurricaneOn { get; private set; } internal static bool ShipWindowsOpenCloseOn { get; private set; } internal static bool LethalNukeFixOn { get; private set; } internal static bool DecalProjectorPatchOn { get; private set; } internal static bool FilmGrainPatchOn { get; private set; } internal static bool HelmetCondensationDropsPatchOn { get; private set; } internal static bool DropshipItemInteractCooldownOn { get; private set; } internal static bool InspectItemPatchOn { get; private set; } internal static bool ItemTooltipRenamerOn { get; private set; } internal static bool LandminePatchesOn { get; private set; } internal static bool SetClockPatchOn { get; private set; } internal static bool PlayerBloodNetworkOn { get; private set; } internal static bool PlayerSelfShadowPatchOn { get; private set; } internal static bool GlobalVolumeMeterOn { get; private set; } internal static bool FootprintPoolOverrideOn { get; private set; } internal static bool PlayerArmsHiddenOn { get; private set; } internal static bool TerminalDecorStringPrefixOn { get; private set; } internal static bool HideHUDAtTerminalOn { get; private set; } internal static bool LODOverrideOn { get; private set; } internal static bool CloseShipDoorOnLeverPullOn { get; private set; } internal static bool ToyCubeTextureFixOn { get; private set; } internal static bool ShipTeleporterBlockCheckOn { get; private set; } internal static bool BlockCustomMoonVFXOn { get; private set; } internal static bool SilenceRingingEarsAudioOn { get; private set; } internal static bool ItemLightningBorderOn { get; private set; } internal static bool SilenceLightningStaticOn { get; private set; } internal static bool FixChatColonOn { get; private set; } internal static void Init() { hasLCBetterSaves = Chainloader.PluginInfos.ContainsKey("LCBetterSaves"); hasLethalNuke = Chainloader.PluginInfos.ContainsKey("Lethal_Nuke"); hasImmersiveVisor = Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"); hasLobbyImprovements = Chainloader.PluginInfos.ContainsKey("uk.1a3.lobbyimprovements"); hasInsanityDisplay = Chainloader.PluginInfos.ContainsKey("InsanityDisplay.Confusified.com.GitHub"); hasEladsHUD = Chainloader.PluginInfos.ContainsKey("me.eladnlg.customhud"); hasOxygen = Chainloader.PluginInfos.ContainsKey("consequential.Oxygen"); hasHotbarPlus = Chainloader.PluginInfos.ContainsKey("FlipMods.HotbarPlus"); hasGeneralImprovements = Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements"); hasDawnLib = Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib"); hasLethalConfig = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); hasMoreBlood = Chainloader.PluginInfos.ContainsKey("FlipMods.MoreBlood"); hasMoreCompany = Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany"); hasLethalThings = Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings"); hasMZCoMagicShipping = Chainloader.PluginInfos.ContainsKey("com.github.xuuxiaolan.mzcomagicshipping"); hasDiversity = Chainloader.PluginInfos.ContainsKey("Chaos.Diversity"); hasInputUtils = Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils"); hasTooManyEmotes = Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes"); hasLocalFlashlight = Chainloader.PluginInfos.ContainsKey("command.localFlashlight"); hasShipWindows = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindows"); DawnlibAchievementsOn = hasDawnLib && ConfigManager.DisableAchievementPopups.Value; EladsHUDReorderOn = hasInsanityDisplay && hasEladsHUD && hasOxygen && ConfigManager.EnableEladsHUDReorder.Value; DiversityWatcherOn = hasDiversity && ConfigManager.FixDisabledWatcherSoftlock.Value; MoreCompanyOrangeLogoOn = hasMoreCompany && ConfigManager.MoreCompanyOrangeCosmeticButton.Value; HideKeybindsLegacyInputUtilsOn = hasInputUtils && ConfigManager.HideKeybindsLegacyButton.Value; LethalThingsUIBeltAlignmentAllowedOn = hasLethalThings && ConfigManager.EnableLIUtilBeltAlign.Value; MZCoMagicShippingDestroyOn = hasMZCoMagicShipping && ConfigManager.MZCoMagicShippingNeverRespawns.Value; MoreBloodOn = hasMoreBlood && ConfigManager.FixMoreBloodFootprints.Value; DividerToggleOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDHidePercentDividers.Value; OxygenPercentToggleOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDHideOxygenPercentage.Value; EladsHUDWeightToggleOn = hasEladsHUD && ConfigManager.HideEladsHUDWeight.Value; HideLethalConfigMenuOn = hasLethalConfig && ConfigManager.HideLethalConfigMenu.Value; AddSpaceToLethalConfigOn = hasLethalConfig && ConfigManager.AddSpaceToLethalConfig.Value; HideMoreCompanyMenuButtonOn = hasMoreCompany && ConfigManager.HideMoreCompanyMenuButton.Value; HideMoreCompanyCrewCountOn = hasMoreCompany && ConfigManager.HideMoreCompanyCrewCount.Value; EladsHUDHideStaminaPercentageOn = hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value; EladsHUDHideInsanityPercentageOn = hasEladsHUD && hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value; EladsHUDAutoHideStaminaOn = hasEladsHUD && ConfigManager.EladsHUDAutoHideStamina.Value; FixStaminaTenPercentOn = hasEladsHUD && ConfigManager.FixStaminaTenPercent.Value; EladsHUDTriggerHealthShowOnHealOn = hasEladsHUD && ConfigManager.EladsHUDTriggerHealthShowOnHeal.Value; EladsHUDAutoHideInsanityOn = hasEladsHUD && hasInsanityDisplay && ConfigManager.EladsHUDAutoHideInsanity.Value; EladsHUDAutoHideOxygenOn = hasEladsHUD && hasOxygen && ConfigManager.EladsHUDAutoHideOxygen.Value; LobbyImprovementsTextOn = hasLobbyImprovements && ConfigManager.LobbyImprovementsTextEdit.Value; BetterSavesTextOn = hasLCBetterSaves && ConfigManager.BetterSavesTextEdit.Value; ImmersiveVisorHurricaneOn = hasImmersiveVisor && ConfigManager.ImmersiveVisorWorksWithHurricane.Value; ShipWindowsOpenCloseOn = hasShipWindows && ConfigManager.ShipWindowsOpenClose.Value; LethalNukeFixOn = hasLethalNuke && ConfigManager.LethalNukeFix.Value; DecalProjectorPatchOn = ConfigManager.EnableDecalDrawDistanceOverride.Value; FilmGrainPatchOn = ConfigManager.DisableFilmGrain.Value; HelmetCondensationDropsPatchOn = ConfigManager.EnableFloodedCondensation.Value; DropshipItemInteractCooldownOn = ConfigManager.EnableDropshipPickupDelay.Value; InspectItemPatchOn = ConfigManager.DisableInspectItem.Value; ItemTooltipRenamerOn = ConfigManager.EnableTooltipRename.Value; LandminePatchesOn = ConfigManager.EnableLandmineFix.Value; SetClockPatchOn = ConfigManager.AddClockToDeathScreen.Value; PlayerBloodNetworkOn = ConfigManager.EnablePlayerBlood.Value; PlayerSelfShadowPatchOn = ConfigManager.DisableLocalPlayerSelfShadow.Value; TooManyEmotesCompat = PlayerSelfShadowPatchOn && hasTooManyEmotes; LocalFlashlightCompat = PlayerSelfShadowPatchOn && hasLocalFlashlight; GlobalVolumeMeterOn = ConfigManager.EnableGlobalVolumeMeter.Value; FootprintPoolOverrideOn = ConfigManager.EnableFootprintPoolOverride.Value; PlayerArmsHiddenOn = ConfigManager.HidePlayerArms.Value; TerminalDecorStringPrefixOn = ConfigManager.EnableTerminalDecorStringPrefix.Value; HideHUDAtTerminalOn = ConfigManager.HideHUDAtTerminal.Value; LODOverrideOn = ConfigManager.EnableLODOverride.Value; CloseShipDoorOnLeverPullOn = ConfigManager.CloseShipDoorOnLeverPull.Value; ToyCubeTextureFixOn = ConfigManager.ToyCubeTextureFix.Value; ShipTeleporterBlockCheckOn = ConfigManager.EnableShipTeleporterBlock.Value; BlockCustomMoonVFXOn = ConfigManager.BlockCustomMoonVFX.Value; SilenceRingingEarsAudioOn = ConfigManager.SilenceRingingEarsAudio.Value; ItemLightningBorderOn = ConfigManager.ItemLightningBorder.Value; SilenceLightningStaticOn = ConfigManager.SilenceLightningStatic.Value; FixChatColonOn = ConfigManager.FixChatColon.Value; } } internal enum HandsFullTextPreset { DefaultNoChange, BelowInventory, AboveInventory, TopOfScreen, AboveVanillaStaminaHealthUI, BelowChat, AboveTooltips } } namespace NicheTweaks.Tweaks { internal static class HUDManagerTweaks { internal static TextMeshProUGUI deathScreenClock; internal static void DisableClock() { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.transform.Find("Container"); if ((Object)(object)val2 != (Object)null) { for (int i = 0; i < val2.childCount; i++) { Transform child = val2.GetChild(i); if ((Object)(object)child.Find("TimeNumber") != (Object)null && (Object)(object)child.Find("Image") != (Object)null) { ((Component)child).gameObject.SetActive(false); break; } } } Transform val3 = val.transform.Find("ShipLeavingIcon"); if (val3 != null) { ((Component)val3).gameObject.SetActive(false); } } internal static void AddClockToDeathScreen() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota/Container/Box/TimeNumber"); if (!((Object)(object)val == (Object)null)) { GameObject val2 = GameObject.Find("Systems/UI/Canvas/DeathScreen/SpectateUI"); if (!((Object)(object)val2 == (Object)null)) { GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "DeathScreenClock"; val3.SetActive(true); RectTransform component = val3.GetComponent<RectTransform>(); ((Transform)component).localScale = new Vector3(0.8f, 0.8f, 0.8f); ((Transform)component).localPosition = new Vector3(-369.5971f, 217.0461f, 0f); deathScreenClock = val3.GetComponentInChildren<TextMeshProUGUI>(); } } } internal static void DisableChat() { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner"); if (!((Object)(object)val == (Object)null)) { for (int i = 0; i < val.transform.childCount; i++) { Transform child = val.transform.GetChild(i); ((Component)child).gameObject.SetActive(false); } } } internal static void DisableCompass() { IEnumerable<Transform> enumerable = from t in Object.FindObjectsOfType<Transform>(true) where ((Object)t).name == "CompassImage" select t; foreach (Transform item in enumerable) { ((Component)item).gameObject.SetActive(false); } } internal static void DisableControlTips() { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner"); if ((Object)(object)val == (Object)null) { return; } string[] array = new string[4] { "ControlTip1", "ControlTip2", "ControlTip3", "ControlTip4" }; string[] array2 = array; foreach (string text in array2) { Transform val2 = val.transform.Find(text); if (!((Object)(object)val2 == (Object)null)) { CanvasGroup val3 = ((Component)val2).GetComponent<CanvasGroup>() ?? ((Component)val2).gameObject.AddComponent<CanvasGroup>(); val3.alpha = 0f; val3.interactable = false; val3.blocksRaycasts = false; } } } internal static void DisableWeightUI() { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI"); if (!((Object)(object)val == (Object)null)) { val.SetActive(false); } } internal static void RepositionHandsFullText() { //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) HandsFullTextPreset value = ConfigManager.HandsFullTextPresetSelection.Value; if (value == HandsFullTextPreset.DefaultNoChange) { return; } GameObject val = GameObject.Find("UI/Canvas/IngamePlayerHUD"); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = val.transform.Find("HandsFullText"); if (Object.op_Implicit((Object)(object)val2)) { Vector3 localPosition = default(Vector3); Vector3 val3 = default(Vector3); Vector3 localScale = default(Vector3); float num; switch (value) { default: return; case HandsFullTextPreset.BelowInventory: ((Vector3)(ref localPosition))..ctor(0f, -262.6901f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 0f, 0f); ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.AboveInventory: ((Vector3)(ref localPosition))..ctor(0f, -153.6261f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 0f, 0f); ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.TopOfScreen: ((Vector3)(ref localPosition))..ctor(0f, 230.464f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 0f, 0f); ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.AboveVanillaStaminaHealthUI: ((Vector3)(ref localPosition))..ctor(-327.2649f, 216.0129f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 0f, 0f); ((Vector3)(ref localScale))..ctor(1.4248f, 1.4248f, 1.7248f); num = 1f; break; case HandsFullTextPreset.BelowChat: ((Vector3)(ref localPosition))..ctor(-343.9384f, -248.2916f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 0f, 4.3f); ((Vector3)(ref localScale))..ctor(1.7248f, 1.7248f, 1.7248f); num = 0.366f; break; case HandsFullTextPreset.AboveTooltips: ((Vector3)(ref localPosition))..ctor(377.8974f, 205.0974f, 24.8253f); ((Vector3)(ref val3))..ctor(0f, 16.8352f, 0f); ((Vector3)(ref localScale))..ctor(1.2f, 1.2f, 1.7248f); num = 1f; break; } val2.localPosition = localPosition; val2.localRotation = Quaternion.Euler(val3); val2.localScale = localScale; TextMeshProUGUI component = ((Component)val2).GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component)) { Color color = ((Graphic)component).color; color.a = Mathf.Clamp01(num); ((Graphic)component).color = color; } } } internal static void RepositionInventory() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("UI/Canvas/IngamePlayerHUD/Inventory"); if (Object.op_Implicit((Object)(object)val)) { val.transform.localPosition = ConfigManager.ParseVector3(ConfigManager.InventoryPosition.Value); } } } internal static class MenuManagerTweaks { internal static void HideJoinButtons() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Canvas"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.transform.Find("MenuContainer/MainButtons"); if (!((Object)(object)val2 == (Object)null)) { Transform val3 = val2.Find("StartLAN"); if (val3 != null) { ((Component)val3).gameObject.SetActive(false); } Transform val4 = val2.Find("JoinACrew"); if (val4 != null) { ((Component)val4).gameObject.SetActive(false); } Transform val5 = val2.Find("HostButton"); if (val5 != null) { val5.localPosition = new Vector3(-259.5365f, -81.5155f, -2f); } } } } internal static class QuickMenuManagerTweaks { internal static void FixConfirmLeaveGameHighlightColors() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("UI/Canvas/QuickMenu"); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = val.transform.Find("ConfirmLeaveGame"); if (!Object.op_Implicit((Object)(object)val2)) { return; } Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.431f, 0f, 0.49f); Image component = ((Component)val2).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component)) { ((Graphic)component).color = color; } for (int i = 1; i <= 2; i++) { Transform val3 = val2.Find("Quit (" + i + ")"); if (!Object.op_Implicit((Object)(object)val3)) { continue; } Transform val4 = val3.Find("SelectionHighlight"); if (Object.op_Implicit((Object)(object)val4)) { Image component2 = ((Component)val4).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component2)) { ((Graphic)component2).color = color; } } } } internal static void QuitGameColourConsistency() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/ConfirmLeaveGame/Text (TMP) (1)"); if (!((Object)(object)val == (Object)null)) { TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>(); if (!((Object)(object)component == (Object)null)) { ((Graphic)component).color = new Color(1f, 0.5647f, 0f, 1f); } } } internal static void RemoveInviteAndMoveResume() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/InvitePlayers"); if (val != null) { val.SetActive(false); } GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Resume"); if (val2 != null) { val2.transform.localPosition = new Vector3(-379.515f, -66.6875f, 0f); } } } internal static class StartOfRoundTweaks { internal static void FindScanNodeAndSetInactive() { GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/ChargeStation/ScanNode (1)"); if (val != null) { val.SetActive(false); } } } } namespace NicheTweaks.Tweaks.VFX { [HarmonyPatch(typeof(DecalProjector), "Awake")] internal static class DecalProjectorPatch { private const float DecalDistance = 1001f; [HarmonyPostfix] private static void Postfix(DecalProjector __instance) { typeof(DecalProjector).GetField("m_DrawDistance", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, 1001f); } } [HarmonyPatch(typeof(FilmGrain))] internal static class FilmGrainPatch { [HarmonyPatch("IsActive")] [HarmonyPrefix] private static bool Prefix(ref bool __result) { __result = false; return false; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] internal static class PlayerControllerBStart { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance) { HDAdditionalCameraData component = ((Component)__instance.gameplayCamera).GetComponent<HDAdditionalCameraData>(); if ((Object)(object)component != (Object)null) { LODPatch.Apply(component); } } } internal static class LODPatch { internal static void Apply(HDAdditionalCameraData cam) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) cam.customRenderingSettings = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true; ((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true; ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true); ((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true); cam.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2; cam.renderingPathCustomFrameSettings.lodBias = ConfigManager.LODBias.Value; } } internal static class MoonVFXBlock { private static readonly HashSet<string> moonFilterKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly Regex levelSuffixRegex = new Regex("Level$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static bool enabled; private static bool hooksInstalled; private static string lastRawFilter; internal static void BlockVFX(string commaSeparatedMoonNames) { enabled = true; SceneHooks(); SetMoonFilterInternal(commaSeparatedMoonNames); } internal static void ClearAll() { enabled = false; moonFilterKeys.Clear(); lastRawFilter = null; } private static void SceneHooks() { if (!hooksInstalled) { hooksInstalled = true; SceneManager.sceneLoaded += OnSceneLoaded; } } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (enabled) { ApplyIfLoadedSceneIsCurrentLevel(scene); } } private static void SetMoonFilterInternal(string commaSeparatedMoonNames) { if (string.Equals(lastRawFilter, commaSeparatedMoonNames, StringComparison.Ordinal)) { return; } lastRawFilter = commaSeparatedMoonNames; moonFilterKeys.Clear(); if (string.IsNullOrWhiteSpace(commaSeparatedMoonNames)) { return; } string[] array = commaSeparatedMoonNames.Split(','); for (int i = 0; i < array.Length; i++) { string text = NormalizeMoonKey(array[i]); if (!string.IsNullOrWhiteSpace(text)) { moonFilterKeys.Add(text); } } } private static string NormalizeMoonKey(string raw) { if (string.IsNullOrWhiteSpace(raw)) { return string.Empty; } string input = raw.Trim(); return levelSuffixRegex.Replace(input, string.Empty).Trim(); } private static bool LevelMatchesFilter(SelectableLevel level) { if (moonFilterKeys.Count == 0) { return true; } string text = NormalizeMoonKey(((Object)(object)level != (Object)null) ? ((Object)level).name : null); if (string.IsNullOrWhiteSpace(text)) { return false; } return moonFilterKeys.Contains(text); } private static void ApplyIfLoadedSceneIsCurrentLevel(Scene loadedScene) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (!((Scene)(ref loadedScene)).IsValid() || !((Scene)(ref loadedScene)).isLoaded || string.Equals(((Scene)(ref loadedScene)).name, "SampleSceneRelay", StringComparison.OrdinalIgnoreCase)) { return; } SelectableLevel val = StartOfRound.Instance?.currentLevel; if (!((Object)(object)val == (Object)null) && LevelMatchesFilter(val)) { string sceneName = val.sceneName; if (!string.IsNullOrWhiteSpace(sceneName) && string.Equals(((Scene)(ref loadedScene)).name, sceneName, StringComparison.Ordinal)) { DisableVfxInScene(loadedScene, out var vfxFound, out var vfxDisabled, out var volumesFound, out var volumesDisabled); Plugin.mls.LogInfo((object)("[NicheTweaks] Loaded Scene=" + ((Scene)(ref loadedScene)).name + " VFX Found=" + vfxFound + " VFX Disabled=" + vfxDisabled + " Volumes Found=" + volumesFound + " Volumes Disabled=" + volumesDisabled)); } } } private static void DisableVfxInScene(Scene scene, out int vfxFound, out int vfxDisabled, out int volumesFound, out int volumesDisabled) { vfxFound = 0; vfxDisabled = 0; volumesFound = 0; volumesDisabled = 0; GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { if ((Object)(object)val == (Object)null) { continue; } VisualEffect[] componentsInChildren = val.GetComponentsInChildren<VisualEffect>(true); foreach (VisualEffect val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { vfxFound++; if (((Behaviour)val2).enabled) { ((Behaviour)val2).enabled = false; vfxDisabled++; } } } Volume[] componentsInChildren2 = val.GetComponentsInChildren<Volume>(true); foreach (Volume val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null)) { volumesFound++; bool flag = false; if (((Behaviour)val3).enabled) { ((Behaviour)val3).enabled = false; flag = true; } if (val3.weight > 0f) { val3.weight = 0f; flag = true; } if (flag) { volumesDisabled++; } } } } } } } namespace NicheTweaks.Tweaks.ShipDoorClose { internal static class ShipDoorClose { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnApply; } private const string Request = "ShipDoorCloseRequest"; private const string Apply = "ShipDoorCloseApply"; internal static void Wired() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; customMessagingManager.UnregisterNamedMessageHandler("ShipDoorCloseRequest"); customMessagingManager.UnregisterNamedMessageHandler("ShipDoorCloseApply"); object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("ShipDoorCloseRequest", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnApply; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnApply; <>O.<1>__OnApply = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("ShipDoorCloseApply", (HandleNamedMessageDelegate)obj2); } private static void OnRequest(ulong sender, FastBufferReader reader) { if (NetworkManager.Singleton.IsServer) { Broadcast(); ApplyLocal(); } } private static void OnApply(ulong sender, FastBufferReader reader) { ApplyLocal(); } private static void Broadcast() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessageToAll("ShipDoorCloseApply", val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } internal static void SendRequest() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { customMessagingManager.SendNamedMessage("ShipDoorCloseRequest", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void ApplyLocal() { StartOfRound instance = StartOfRound.Instance; HangarShipDoor val = Object.FindObjectOfType<HangarShipDoor>(); instance.SetShipDoorsClosed(true); val.PlayDoorAnimation(true); val.SetDoorButtonsEnabled(false); } } } namespace NicheTweaks.Tweaks.PlayerSelfShadow { [HarmonyPatch] internal static class LocalFlashlightCompat { private static FieldInfo cachedPublicFlashStateField; private static MethodBase TargetMethod() { return AccessTools.Method("LocalFlashlight.LightScript:Toggle", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { if (GetPublicFlashState()) { PlayerSelfShadowPatch.ApplyHideFromEmote(val); } else { PlayerSelfShadowPatch.Refresh(val); } } } private static bool GetPublicFlashState() { if (cachedPublicFlashStateField == null) { Type type = Type.GetType("LocalFlashlight.LightScript, LocalFlashlight"); if (type == null) { return false; } cachedPublicFlashStateField = type.GetField("publicFlashState", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (cachedPublicFlashStateField == null) { return false; } } return (bool)cachedPublicFlashStateField.GetValue(null); } internal static bool IsLocalFlashlightOn() { return GetPublicFlashState(); } } [HarmonyPatch] internal static class PlayerSelfShadowPatch { [CompilerGenerated] private sealed class <DelayedRefresh>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedRefresh>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; Refresh(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static void SetLODRenderers(PlayerControllerB player, bool enabled) { if ((Object)(object)player == (Object)null || !((NetworkBehaviour)player).IsOwner) { return; } Transform val = ((Component)player).transform.Find("ScavengerModel"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.Find("LOD1"); if ((Object)(object)val2 != (Object)null) { SkinnedMeshRenderer component = ((Component)val2).GetComponent<SkinnedMeshRenderer>(); if (component != null) { ((Renderer)component).enabled = enabled; } } Transform val3 = val.Find("LOD2"); if ((Object)(object)val3 != (Object)null) { SkinnedMeshRenderer component2 = ((Component)val3).GetComponent<SkinnedMeshRenderer>(); if (component2 != null) { ((Renderer)component2).enabled = enabled; } } } private static void Refresh(PlayerControllerB player, bool hide) { SetLODRenderers(player, !hide); } [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(FlashlightItem __instance) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner) { Refresh(playerHeldBy, hide: false); } } [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)) { if (ChainloaderPluginKeys.hasLocalFlashlight && LocalFlashlightCompat.IsLocalFlashlightOn()) { SetLODRenderers(player, enabled: false); return; } bool flag = IsAnyFlashlightOn(player); bool flag2 = (Object)(object)player.helmetLight != (Object)null && ((Behaviour)player.helmetLight).enabled; bool hide = flag || flag2; Refresh(player, hide); } } 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); } internal static void ApplyShowFromEmote(PlayerControllerB player) { Refresh(player, hide: false); } private static bool IsAnyFlashlightOn(PlayerControllerB player) { FlashlightItem[] array = Object.FindObjectsOfType<FlashlightItem>(); foreach (FlashlightItem val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((GrabbableObject)val).playerHeldBy != (Object)(object)player) && ((GrabbableObject)val).isBeingUsed) { return true; } } return false; } internal static void RefreshLocalPlayerNextFrame() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { ((MonoBehaviour)val).StartCoroutine(DelayedRefresh()); } } [IteratorStateMachine(typeof(<DelayedRefresh>d__13))] private static IEnumerator DelayedRefresh() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedRefresh>d__13(0); } } [HarmonyPatch] internal static class TooManyEmotesCompat { [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStartCustomEmoteLocal")] [HarmonyPostfix] private static void OnStartEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { PlayerSelfShadowPatch.ApplyShowFromEmote(val); } } [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStopCustomEmoteLocal")] [HarmonyPostfix] private static void OnStopEmote() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { if (ChainloaderPluginKeys.hasLocalFlashlight && LocalFlashlightCompat.IsLocalFlashlightOn()) { PlayerSelfShadowPatch.ApplyHideFromEmote(val); PlayerSelfShadowPatch.RefreshLocalPlayerNextFrame(); } else { PlayerSelfShadowPatch.ApplyHideFromEmote(val); PlayerSelfShadowPatch.RefreshLocalPlayerNextFrame(); } } } } } namespace NicheTweaks.Tweaks.PlayerBloodSpill { internal static class PlayerBloodSpill { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnSpawn; } private const string Request = "PlayerBloodRequest"; private const string Spawn = "PlayerBloodSpawn"; private static bool wired; internal static void Wired() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown if (!wired) { NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("PlayerBloodRequest", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnSpawn; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSpawn; <>O.<1>__OnSpawn = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("PlayerBloodSpawn", (HandleNamedMessageDelegate)obj2); wired = true; } } private static void OnRequest(ulong sender, FastBufferReader reader) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); Quaternion rot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rot); float size = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives)); Broadcast(pos, rot, size); SpawnLocal(pos, rot, size); } } private static void OnSpawn(ulong sender, FastBufferReader reader) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); Quaternion rot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rot); float size = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer && sender == NetworkManager.Singleton.LocalClientId) { SpawnLocal(pos, rot, size); } else { SpawnLocal(pos, rot, size); } } private static void Broadcast(Vector3 pos, Quaternion rot, float size) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref rot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref size, default(ForPrimitives)); customMessagingManager.SendNamedMessageToAll("PlayerBloodSpawn", val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } internal static void SendRequest(Vector3 pos, Quaternion rot, float size) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref rot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref size, default(ForPrimitives)); customMessagingManager.SendNamedMessage("PlayerBloodRequest", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void SpawnLocal(Vector3 pos, Quaternion rot, float size) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return; } GameObject playerBloodPrefab = instance.playerBloodPrefab; Transform bloodObjectsContainer = instance.bloodObjectsContainer; Transform val = ((bloodObjectsContainer != null) ? ((Component)bloodObjectsContainer).transform : null); GameObject val2 = Object.Instantiate<GameObject>(playerBloodPrefab, pos, rot, val); DecalProjector componentInChildren = val2.GetComponentInChildren<DecalProjector>(); if (componentInChildren != null) { componentInChildren.size = new Vector3(size, size, size); } val2.SetActive(true); PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (!val3.playerBloodPooledObjects.Contains(val2)) { val3.playerBloodPooledObjects.Add(val2); } } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] internal static class DamagePlayerPatch { [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) PlayerBloodSpill.Wired(); if ((Object)(object)__instance == (Object)null) { return; } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } bool isOwner = ((NetworkBehaviour)__instance).IsOwner; bool isServer = singleton.IsServer; if ((!isOwner && !isServer) || damageNumber < ConfigManager.MinimumDamageForBlood.Value) { return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return; } int num = Mathf.Max(1, ConfigManager.BloodAmount.Value); Vector3 val = ((Component)__instance).transform.position + Vector3.up * 0.25f; Transform bloodObjectsContainer = instance.bloodObjectsContainer; Transform val2 = ((bloodObjectsContainer != null) ? ((Component)bloodObjectsContainer).transform : null); float value = ConfigManager.BloodDecalSize.Value; RaycastHit val4 = default(RaycastHit); for (int i = 0; i < num; i++) { Vector3 val3 = val + Vector3.right * Random.Range(-1.5f, 1.5f) + Vector3.forward * Random.Range(-1.5f, 1.5f) + Vector3.up * 0.75f; if (Physics.Raycast(val3, Vector3.down, ref val4, 6f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Vector3 val5 = ((RaycastHit)(ref val4)).point + new Vector3(Random.Range(-0.75f, 0.75f), 0f, Random.Range(-0.75f, 0.75f)) - ((RaycastHit)(ref val4)).normal * 0.01f; Quaternion val6 = Quaternion.LookRotation(Vector3.down, ((RaycastHit)(ref val4)).normal); Quaternion val7 = Quaternion.AngleAxis(Random.Range(0f, 360f), ((RaycastHit)(ref val4)).normal); Quaternion val8 = val7 * val6; GameObject val9 = Object.Instantiate<GameObject>(instance.playerBloodPrefab, val5, val8, val2); DecalProjector componentInChildren = val9.GetComponentInChildren<DecalProjector>(); if (componentInChildren != null) { componentInChildren.size = new Vector3(value, value, value); } val9.SetActive(true); if (!__instance.playerBloodPooledObjects.Contains(val9)) { __instance.playerBloodPooledObjects.Add(val9); } PlayerBloodSpill.SendRequest(val5, val8, value); } } } } } namespace NicheTweaks.Tweaks.LightningOverlay { internal static class LightningBorderAssets { private const string BundleFileName = "lightningborder"; private const string PrefabAssetPath = "Assets/LethalCompany/Mods/plugins/NicheTweaksTemp/LightningBorder.prefab"; private static bool attemptedLoad; private static GameObject lightningBorderPrefab; public static GameObject Prefab => lightningBorderPrefab; public static void LoadOnce() { if (attemptedLoad) { return; } attemptedLoad = true; string directoryName = Path.GetDirectoryName(typeof(LightningBorderAssets).Assembly.Location); string text = Path.Combine(directoryName, "lightningborder"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Plugin.mls.LogWarning((object)("LightningBorder: AssetBundle not found at " + text)); return; } lightningBorderPrefab = val.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/NicheTweaksTemp/LightningBorder.prefab"); val.Unload(false); if ((Object)(object)lightningBorderPrefab == (Object)null) { Plugin.mls.LogWarning((object)"LightningBorder: Prefab missing in bundle at Assets/LethalCompany/Mods/plugins/NicheTweaksTemp/LightningBorder.prefab"); } } } [HarmonyPatch(typeof(HUDManager), "Start")] internal static class LightningBorderHUDManagerStartPatch { private static bool Loaded; [HarmonyPostfix] private static void Postfix() { //IL_0037: 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) if (Loaded) { return; } LightningBorderAssets.LoadOnce(); if (LightningBorderAssets.Prefab != null) { RectTransform component = LightningBorderAssets.Prefab.GetComponent<RectTransform>(); if (component != null) { ((Transform)component).localScale = ((Transform)component).localScale * 1.2f; Loaded = true; Plugin.mls.LogDebug((object)"LightningBorder: Assets loaded."); } } } } internal static class LightningBorderMethods { public static readonly List<GameObject> Instances = new List<GameObject>(); private static Image[] ItemSlotIconFrames; internal static GrabbableObject StaticElectricityTarget; private static bool SuppressStaticElectricityWarning; private static int StaticElectricitySlot = -1; private static GameObject Prefab; private static string PrefabName; private static string PrefabCloneName; private static int LastLoggedItemSlotCount = -1; private static bool LoggedMissingPrefab; private static bool LoggedMissingFrames; public static int ItemSlotCount { get; private set; } public static bool IsInsideFactory { get; private set; } public static void RefreshItemSlotCount() { HUDManager instance = HUDManager.Instance; if (instance == null) { return; } ItemSlotIconFrames = instance.itemSlotIconFrames; if (ItemSlotIconFrames != null) { ItemSlotCount = ItemSlotIconFrames.Length; if (ItemSlotCount != LastLoggedItemSlotCount) { LastLoggedItemSlotCount = ItemSlotCount; Plugin.mls.LogDebug((object)$"LightningBorder: ItemSlotCount={ItemSlotCount}"); } } } public static void Refresh() { //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) if (ItemSlotIconFrames == null || ItemSlotCount == 0 || !CachePrefab() || HUDManager.Instance == null) { return; } int num = ItemSlotCount; if (num > ItemSlotIconFrames.Length) { num = ItemSlotIconFrames.Length; } int count = Instances.Count; while (Instances.Count > num) { int index = Instances.Count - 1; GameObject val = Instances[index]; Instances.RemoveAt(index); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } while (Instances.Count < num) { Instances.Add(CreateInstance()); } if (Instances.Count != count) { Plugin.mls.LogDebug((object)$"LightningBorder: Instances={Instances.Count} Desired={num}"); } for (int i = 0; i < num; i++) { Image val2 = ItemSlotIconFrames[i]; if (!((Object)(object)val2 == (Object)null)) { GameObject val3 = Instances[i]; if ((Object)(object)val3 == (Object)null) { val3 = CreateInstance(); Instances[i] = val3; } if ((Object)(object)val3.transform.parent != (Object)(object)((Component)val2).transform) { val3.transform.SetParent(((Component)val2).transform, false); } if (val3.activeSelf) { val3.SetActive(false); } RectTransform component = val3.GetComponent<RectTransform>(); if (component != null) { component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.anchoredPosition = Vector2.zero; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Transform)component).localRotation = Quaternion.identity; } } } ApplyStaticElectricityTarget(); } public static void RefreshItemSlotSize() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (ItemSlotIconFrames == null || ItemSlotCount == 0 || !CachePrefab()) { return; } RectTransform component = Prefab.GetComponent<RectTransform>(); if (component == null) { return; } Vector3 localScale = ((Transform)component).localScale; int num = Instances.Count; if (num > ItemSlotCount) { num = ItemSlotCount; } for (int i = 0; i < num; i++) { GameObject val = Instances[i]; if (val != null) { RectTransform component2 = val.GetComponent<RectTransform>(); if (component2 != null) { ((Transform)component2).localScale = localScale; } } } } public static void RefreshLocation() { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } bool isInsideFactory = localPlayerController.isInsideFactory; if (isInsideFactory != IsInsideFactory) { IsInsideFactory = isInsideFactory; Plugin.mls.LogDebug((object)string.Format("[{0}] LightningBorder isInsideFactory={1}", "NicheTweaks", IsInsideFactory)); if (IsInsideFactory) { SuppressStaticElectricityWarning = true; StaticElectricityTarget = null; StaticElectricitySlot = -1; ApplyStaticElectricityVisuals(); return; } SuppressStaticElectricityWarning = false; } ApplyStaticElectricityVisuals(); } public static void RefreshStaticElectricityWarning(NetworkObject WarningObject) { if (!SuppressStaticElectricityWarning || !IsInsideFactory) { if (SuppressStaticElectricityWarning && !IsInsideFactory) { SuppressStaticElectricityWarning = false; } StaticElectricityTarget = ((WarningObject != null) ? ((Component)WarningObject).GetComponent<GrabbableObject>() : null); RefreshStaticElectricitySlot(); } } public static void RefreshStaticElectricitySlot() { if (SuppressStaticElectricityWarning && IsInsideFactory) { ApplyStaticElectricityVisuals(); return; } int num = -1; if ((Object)(object)StaticElectricityTarget != (Object)null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { GrabbableObject[] itemSlots = localPlayerController.ItemSlots; for (int i = 0; i < itemSlots.Length; i++) { if ((Object)(object)itemSlots[i] == (Object)(object)StaticElectricityTarget) { num = i; break; } } } } if (num != StaticElectricitySlot) { StaticElectricitySlot = num; Plugin.mls.LogDebug((object)string.Format("[{0}] LightningBorder StaticElectricitySlot={1}", "NicheTweaks", StaticElectricitySlot)); } ApplyStaticElectricityVisuals(); } public static void ClearStaticElectricityWarning() { StaticElectricityTarget = null; StaticElectricitySlot = -1; if (!IsInsideFactory) { SuppressStaticElectricityWarning = false; } ApplyStaticElectricityVisuals(); } public static void DestroyDuplicateLightningBorders() { if (ItemSlotIconFrames == null || ItemSlotCount == 0 || !CachePrefab()) { return; } int num = ItemSlotCount; if (num > ItemSlotIconFrames.Length) { num = ItemSlotIconFrames.Length; } int num2 = 0; for (int i = 0; i < num; i++) { Image val = ItemSlotIconFrames[i]; if (val == null) { continue; } Transform transform = ((Component)val).transform; GameObject val2 = ((i < Instances.Count) ? Instances[i] : null); for (int num3 = transform.childCount - 1; num3 >= 0; num3--) { Transform child = transform.GetChild(num3); if (child != null) { GameObject gameObject = ((Component)child).gameObject; if (gameObject != null && (!(((Object)gameObject).name != PrefabName) || !(((Object)gameObject).name != PrefabCloneName)) && (val2 == null || !((Object)(object)gameObject == (Object)(object)val2))) { if (val2 == null) { val2 = gameObject; if (i < Instances.Count) { Instances[i] = val2; } else if (i == Instances.Count) { Instances.Add(val2); } } else { Object.Destroy((Object)(object)gameObject); num2++; } } } } } if (num2 > 0) { Plugin.mls.LogDebug((object)string.Format("[{0}] LightningBorder: DestroyedDuplicates={1}", "NicheTweaks", num2)); } } private static void ApplyStaticElectricityTarget() { ApplyStaticElectricityVisuals(); } private static void ApplyStaticElectricityVisuals() { if (ItemSlotIconFrames == null || ItemSlotCount == 0) { if (!LoggedMissingFrames) { LoggedMissingFrames = true; Plugin.mls.LogDebug((object)string.Format("[{0}] LightningBorder: Cannot apply visuals (no item slot frames). ItemSlotCount={1}", "NicheTweaks", ItemSlotCount)); } return; } LoggedMissingFrames = false; int num = Instances.Count; if (num > ItemSlotCount) { num = ItemSlotCount; } if (num > ItemSlotIconFrames.Length) { num = ItemSlotIconFrames.Length; } bool flag = !IsInsideFactory && StaticElectricityTarget != null && StaticElectricitySlot >= 0; int num2 = 0; int num3 = 0; for (int i = 0; i < num; i++) { bool flag2 = flag && i == StaticElectricitySlot; GameObject val = Instances[i]; if (val != null) { bool activeSelf = val.activeSelf; if (activeSelf != flag2) { val.SetActive(flag2); num2++; } } Image val2 = ItemSlotIconFrames[i]; if (val2 != null) { bool flag3 = !flag2; bool enabled = ((Behaviour)val2).enabled; if (enabled != flag3) { ((Behaviour)val2).enabled = flag3; num3++; } } } if (num2 > 0 || num3 > 0) { Plugin.mls.LogDebug((object)(string