using System; 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BiggerShip.Compatibility; using BiggerShip.Definitions; using BiggerShip.Enums; using BiggerShip.Patches.TooManySuit; using HarmonyLib; using Microsoft.CodeAnalysis; using MrovLib; using MrovLib.Compatibility; using MrovLib.Events; using ScienceBirdTweaks.Patches; using TooManySuits; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UniversalRadar.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("com.github.darmuh.suitsTerminal")] [assembly: IgnoresAccessChecksTo("MrovLib")] [assembly: IgnoresAccessChecksTo("ScienceBird.ScienceBirdTweaks")] [assembly: IgnoresAccessChecksTo("ScienceBird.UniversalRadar")] [assembly: IgnoresAccessChecksTo("TooManySuits")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BiggerShip")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.13.0")] [assembly: AssemblyInformationalVersion("1.0.13+3a97fc501da403f63c0773f26403766ab50b11e8")] [assembly: AssemblyProduct("BiggerShip")] [assembly: AssemblyTitle("BiggerShip")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/AndreyMrovol/LethalTemplate/")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BiggerShip { internal class BuildNavmesh { private static Dictionary OriginalOffMeshLinkPositions = new Dictionary(); private static GameObject NavmeshBlockers; private static GameObject NavmeshShip; private static Logger Logger = new Logger("NVMSH", (LoggingType)2); public static void ReplaceNavmeshes() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); ((Logger)Logger).LogDebug("Starting navmesh replacement process..."); GameObject val = GameObject.FindGameObjectWithTag("OutsideLevelNavMesh"); if ((Object)(object)val == (Object)null) { ((Logger)Plugin.debugLogger).LogWarning("No GameObject with tag 'OutsideLevelNavMesh' found"); return; } RemoveVanillaNavmesh(val); SpawnNavmeshBlockers(val); ChangeOffMeshLinks(val); RebuildNavmesh(val); stopwatch.Stop(); ((Logger)Plugin.debugLogger).LogDebug($"Navmesh rebuilt in {stopwatch.ElapsedMilliseconds} ms"); } public static void RemoveVanillaNavmesh(GameObject Environment) { ((Logger)Logger).LogDebug("Removing vanilla ship navmesh and offmesh links..."); Transform obj = Environment.transform.Find("NavMeshColliders"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); ((Logger)Logger).LogDebug($"NavmeshCollider is null? {(Object)(object)val == (Object)null}"); if ((Object)(object)val == (Object)null) { ((Logger)Logger).LogCustom("There is no NavMeshColliders object under Environment!", (LogLevel)4, (LoggingType)0); ((Logger)Logger).LogCustom("THIS MIGHT CAUSE MAJOR ISSUES!!!", (LogLevel)4, (LoggingType)0); return; } Transform val2 = val.transform.Find("OffMeshLinks"); if ((Object)(object)val2 == (Object)null) { ((Logger)Plugin.debugLogger).LogWarning("No OffMeshLinks found under NavMeshColliders"); return; } Transform obj2 = val2.Find("ShipLadder"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } Transform obj3 = val2.Find("ShipLadder2"); if (obj3 != null) { ((Component)obj3).gameObject.SetActive(false); } Transform val3 = val.transform.Find("PlayerShipNavmesh"); if (val3 != null) { ((Component)val3).gameObject.SetActive(false); } } public static void ChangeOffMeshLinks(GameObject Environment) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) ((Logger)Logger).LogDebug("Adjusting OffMeshLinks for Bigger Ship..."); Transform val = NavmeshShip.transform.Find("OffMeshLinks"); RaycastHit val3 = default(RaycastHit); foreach (Transform item in val) { Transform val2 = item; if (!(((Object)val2).name == "RoofLadder")) { GameObject gameObject = ((Component)val2.Find("Bottom")).gameObject; OffMeshLink component = ((Component)val2).GetComponent(); Vector3 localPosition = component.endTransform.localPosition; OriginalOffMeshLinkPositions[((Component)val2).gameObject] = localPosition; if (Physics.Raycast(gameObject.transform.position, Vector3.down, ref val3, 6f, LayerMask.GetMask(new string[2] { "Default", "Room" }))) { gameObject.transform.position = ((RaycastHit)(ref val3)).point; component.endTransform = gameObject.transform; ((Logger)Plugin.debugLogger).LogDebug($"Adjusted OffMeshLink {((Object)val2).name} from {localPosition} to {component.endTransform.localPosition}"); } if (component.costOverride != 0f) { component.costOverride = 0f; } component.UpdatePositions(); } } } public static void SpawnNavmeshBlockers(GameObject Environment) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) ((Logger)Logger).LogDebug("Adding navmesh blockers under the ship..."); GameObject val = null; GameObject val2 = null; if ((Object)(object)NavmeshBlockers == (Object)null) { val = (NavmeshBlockers = Variables.BiggerShipBundle.LoadAsset("assets/lethalcompany/biggership/navmeshblockerextended.prefab")); } if ((Object)(object)val2 == (Object)null) { val2 = (NavmeshShip = Variables.BiggerShipBundle.LoadAsset("assets/lethalcompany/biggership/shipnavmeshextended.prefab")); } if ((Object)(object)val != (Object)null) { NavmeshBlockers = Object.Instantiate(val); NavmeshBlockers.transform.SetParent(Environment.transform); NavmeshBlockers.transform.position = new Vector3(3.5811f, 0.8754f, -14.5813f); NavmeshBlockers.transform.rotation = Quaternion.Euler(-90f, 0f, 0f); NavmeshBlockers.transform.localScale = new Vector3(100f, 100f, 100f); ((Logger)Plugin.debugLogger).LogDebug($"Instantiated NavmeshBlockers at position {NavmeshBlockers.transform.position}"); } if ((Object)(object)val2 != (Object)null) { NavmeshShip = Object.Instantiate(val2); NavmeshShip.transform.SetParent(Environment.transform); NavmeshShip.transform.position = new Vector3(-17.5043f, 7.7481f, -16.5813f); ((Logger)Plugin.debugLogger).LogDebug($"Instantiated NavmeshShip at position {NavmeshShip.transform.position}"); } } public static void RebuildNavmesh(GameObject Environment) { ((Logger)Logger).LogDebug("Rebuilding navmesh..."); Environment.GetComponent().BuildNavMesh(); } public static void RestoreOffMeshLinks() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair originalOffMeshLinkPosition in OriginalOffMeshLinkPositions) { if ((Object)(object)originalOffMeshLinkPosition.Key != (Object)null) { OffMeshLink component = originalOffMeshLinkPosition.Key.GetComponent(); if ((Object)(object)component != (Object)null) { component.endTransform.localPosition = originalOffMeshLinkPosition.Value; component.UpdatePositions(); } } } } } internal class ConfigManager { public static ConfigFile configFile; internal static ConfigEntry Debug { get; private set; } internal static ConfigEntry ChargeStation { get; private set; } internal static ConfigEntry MagnetLever { get; private set; } internal static ConfigEntry DoorControlPanel { get; private set; } internal static ConfigEntry ShipPillars { get; private set; } internal static ConfigEntry SuitRack { get; private set; } public static ConfigManager Instance { get; private set; } private ConfigManager(ConfigFile config) { configFile = config; Debug = configFile.Bind("General", "Logging levels", (LoggingType)0, "Enable debug logging"); ChargeStation = configFile.Bind("Placement", "Charge Station", ChargeStationPlacement.Right, "Change the charge station's placement"); MagnetLever = configFile.Bind("Placement", "Magnet Lever", MagnetLeverPlacement.Front, "Change the magnet lever's placement"); DoorControlPanel = configFile.Bind("Placement", "Door Control Panel", DoorControlPanelPlacement.Vanilla, "Change the door control panel's placement"); ShipPillars = configFile.Bind("Placement", "Pillars", true, "Should the ship have pillars inside?"); SuitRack = configFile.Bind("Placement", "Suit Rack", true, "Should the ship have a suit rack? This is only visual, the suits will still spawn!"); } internal static void Init(ConfigFile config) { Instance = new ConfigManager(config); } } public class Logger : Logger { public Logger(string SourceName, LoggingType defaultLoggingType = (LoggingType)1) : base(SourceName, defaultLoggingType) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Logger)this).ModName = SourceName; ((Logger)this).LogSource = Logger.CreateLogSource("BiggerShip"); ((Logger)this)._name = SourceName; } public override bool ShouldLog(LoggingType type) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return LocalConfigManager.Debug.Value >= type; } } public static class PlacementManager { public static Dictionary MagnetLeverPositions = new Dictionary { { MagnetLeverPlacement.Back, new ObjectNewPosition { Name = "MagnetLever", Position = new Vector3(-7.4955f, 2.114f, -9.733f), Rotation = new Vector3(90f, 180f, 0f) } }, { MagnetLeverPlacement.Front, new ObjectNewPosition { Name = "MagnetLever", Position = new Vector3(10.499f, 1.614f, -10.033f), Rotation = new Vector3(90f, 57.878f, 0f) } }, { MagnetLeverPlacement.Inside, new ObjectNewPosition { Name = "MagnetLever", Position = new Vector3(9.85f, 2.7868f, -5.5257f), Rotation = new Vector3(90f, 180f, 0f), Scale = new Vector3(1.2141f, 1.3141f, 1.4141f) } } }; public static Dictionary ChargeStationPositions = new Dictionary { { ChargeStationPlacement.Left, new ObjectNewPosition { Name = "ShipModels2b/ChargeStation", Position = new Vector3(-5.9898f, 1.2561f, -4.902f), Rotation = new Vector3(270f, 180f, 0f) } } }; public static Dictionary> DoorControlPanelPositions = new Dictionary> { { DoorControlPanelPlacement.Vanilla, new List { new ObjectNewPosition { Name = "ShipModels2b/MonitorWall/SingleScreen", Position = new Vector3(-11.798f, -1.186f, -5.1814f) }, new ObjectNewPosition { Name = "AnimatedShipDoor/HangarDoorButtonPanel", Position = new Vector3(-5.4f, 2.2f, -10.1f) } } }, { DoorControlPanelPlacement.Compact, new List { new ObjectNewPosition { Name = "AnimatedShipDoor/HangarDoorButtonPanel", Position = new Vector3(-6f, 2.188f, -10.446f) }, new ObjectNewPosition { Name = "ShipModels2b/MonitorWall/SingleScreen", Position = new Vector3(-12.269f, -1.267f, -5.525f) } } } }; public unsafe static void SetNewPlacement(ObjectNewPosition position) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) Transform val = Variables.HangarShip.transform.Find(position.Name); if ((Object)(object)val == (Object)null) { Plugin.logger.LogWarning((object)("Object " + position.Name + " not found on ship, skipping.")); return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(position.Name + ": "); if (position.ToRemove) { stringBuilder.Append("has been removed."); Object.Destroy((Object)(object)((Component)val).gameObject); return; } GameObject gameObject = ((Component)val).gameObject; if (position.Position != Vector3.zero) { val.localPosition = position.Position; if ((Object)(object)gameObject.GetComponent() != (Object)null) { gameObject.GetComponent().positionOffset = position.Position; } stringBuilder.Append("position: " + ((object)(*(Vector3*)(&position.Position))/*cast due to .constrained prefix*/).ToString() + "; "); } if (position.Rotation != Vector3.zero) { val.localEulerAngles = position.Rotation; stringBuilder.Append("rotation: " + ((object)(*(Vector3*)(&position.Rotation))/*cast due to .constrained prefix*/).ToString() + "; "); } if (position.Scale != Vector3.zero) { val.localScale = position.Scale; stringBuilder.Append("scale: " + ((object)(*(Vector3*)(&position.Scale))/*cast due to .constrained prefix*/).ToString() + "; "); } ((Logger)Plugin.debugLogger).LogDebug(stringBuilder.ToString()); } } [BepInPlugin("BiggerShip", "BiggerShip", "1.0.13")] [BepInIncompatibility("mborsh.WiderShipMod")] [BepInIncompatibility("MelanieMelicious.2StoryShip")] [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 static ManualLogSource logger; internal static Logger debugLogger = new Logger("Debug", (LoggingType)2); internal static Harmony harmony = new Harmony("BiggerShip"); internal static TooManySuitsCompat TooManySuitsCompat; internal static ScienceBirdTweaksCompat ScienceBirdTweaksCompat; internal static UniversalRadarCompat UniversalRadarCompat; private void Awake() { logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); ConfigManager.Init(((BaseUnityPlugin)this).Config); EventManager.SceneLoaded.AddListener((ParameterEvent)delegate(string scene) { if (scene == "SampleSceneRelay") { ReplaceVanillaShip.Init(); } }); TooManySuitsCompat = new TooManySuitsCompat("TooManySuits"); TooManySuitsCompat.Init(); ScienceBirdTweaksCompat = new ScienceBirdTweaksCompat("ScienceBird.ScienceBirdTweaks"); ScienceBirdTweaksCompat.Init(); UniversalRadarCompat = new UniversalRadarCompat("ScienceBird.UniversalRadar"); UniversalRadarCompat.Init(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BiggerShip is loaded!"); } } public static class ReplaceVanillaShip { internal static Dictionary vanillaObjects = new Dictionary(); internal static Dictionary replacementObjects = new Dictionary(); internal static GameObject HangarShip { get { return Variables.HangarShip; } set { Variables.HangarShip = value; } } public static void Init() { HangarShip = GameObject.Find("HangarShip"); vanillaObjects[ShipPart.Plane_001] = ((Component)HangarShip.transform.Find("Plane.001")).gameObject; vanillaObjects[ShipPart.ShipElectricLights] = ((Component)HangarShip.transform.Find("ShipElectricLights")).gameObject; if ((Object)(object)Variables.BiggerShipBundle == (Object)null) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "biggership.assetbundle"); Variables.BiggerShipBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)Variables.BiggerShipBundle == (Object)null) { Plugin.logger.LogError((object)"Failed to load AssetBundle!!!"); return; } } List list = Variables.BiggerShipBundle.GetAllAssetNames().ToList(); foreach (string item in list) { ((Logger)Plugin.debugLogger).LogWarning("assetname: " + item); } ReplaceVanillaObjects(); AlignShipPartsToBiggerShip(); } public static void ReplaceVanillaObjects() { string text = "assets/lethalcompany/biggership/"; foreach (ShipPart value2 in Enum.GetValues(typeof(ShipPart))) { GameObject value; GameObject val = (vanillaObjects.TryGetValue(value2, out value) ? value : null); string text2 = text + value2.ToString().ToLowerInvariant() + "extended.prefab"; GameObject val2 = Variables.BiggerShipBundle.LoadAsset(text2); if ((Object)(object)val2 != (Object)null) { GameObject val3 = Object.Instantiate(val2, HangarShip.transform); val3.AddComponent(); val3.GetComponent().convex = false; replacementObjects[value2] = val3; if ((Object)(object)val == (Object)null) { ((Logger)Plugin.debugLogger).LogCustom($"Vanilla object for {value2} is null, skipping replacement.", (LogLevel)4, (LoggingType)1); continue; } val.SetActive(false); ((Object)val3).name = ((Object)val).name; Object.Destroy((Object)(object)val); } else { Plugin.logger.LogError((object)("Failed to load asset for " + text2)); } } Variables.RightmostSuitPosition = replacementObjects[ShipPart.SuitRack].transform.Find("RightmostSuitPlacement"); Variables.ShipLights = ((Component)replacementObjects[ShipPart.ShipElectricLights].transform.Find("ShipElectricLights")).GetComponentInChildren(); if (!ConfigManager.ShipPillars.Value) { ((Component)replacementObjects[ShipPart.Ship].transform.Find("ShipExtended/ShipWalls/ShipRibs")).gameObject.SetActive(false); } if (!ConfigManager.SuitRack.Value) { ((Component)replacementObjects[ShipPart.SuitRack].transform).gameObject.SetActive(false); } Plugin.logger.LogInfo((object)"Replaced vanilla ship parts with bigger versions."); } public static void AlignShipPartsToBiggerShip() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) List list = new List(44) { new ObjectNewPosition { Name = "AnimatedShipDoor/HangarDoorButtonPanel", Position = new Vector3(-6f, 2.188f, -10.446f) }, new ObjectNewPosition { Name = "BezierCurve" }, new ObjectNewPosition { Name = "CatwalkRailLining" }, new ObjectNewPosition { Name = "CatwalkRailLiningB" }, new ObjectNewPosition { Name = "CatwalkShip" }, new ObjectNewPosition { Name = "CatwalkUnderneathSupports" }, new ObjectNewPosition { Name = "Cube.005" }, new ObjectNewPosition { Name = "Cube.006" }, new ObjectNewPosition { Name = "Cube.007" }, new ObjectNewPosition { Name = "Cube.008" }, new ObjectNewPosition { Name = "GiantCylinderMagnet", Position = new Vector3(2.5f, 2.44f, -11.1f) }, new ObjectNewPosition { Name = "LadderShort", Position = new Vector3(6.63f, -2.48f, -0.38f) }, new ObjectNewPosition { Name = "LadderShort (1)", Position = new Vector3(-7f, -2.4955f, -12.2756f) }, new ObjectNewPosition { Name = "LightSwitchContainer" }, new ObjectNewPosition { Name = "MeterBoxDevice.001" }, new ObjectNewPosition { Name = "NurbsPath.002" }, new ObjectNewPosition { Name = "NurbsPath.004" }, new ObjectNewPosition { Name = "OutsideShipRoom/Ladder", Position = new Vector3(-0.1785f, -0.1324f, -2.65f), Scale = new Vector3(0.5805f, 0.541f, 0.5805f) }, new ObjectNewPosition { Name = "Pipework2.002" }, new ObjectNewPosition { Name = "Railing" }, new ObjectNewPosition { Name = "RightmostSuitPlacement" }, new ObjectNewPosition { Name = "ScavengerModelSuitParts/Circle.004", Position = new Vector3(-7.26f, -3.37f, -3.98f) }, new ObjectNewPosition { Name = "ShipElectricLights/LightSwitchContainer", Position = new Vector3(0.9935f, 1.4172f, -3.036f) }, new ObjectNewPosition { Name = "ShipInnerRoomBoundsTrigger", Position = new Vector3(1.4367f, 1.781f, -6.7f), Scale = new Vector3(17.523226f, 5.341722f, 7.51f) }, new ObjectNewPosition { Name = "ShipInside" }, new ObjectNewPosition { Name = "ShipInside.001" }, new ObjectNewPosition { Name = "ShipModels2b/ChargeStation", Position = new Vector3(0.957f, 1.2561f, -4.802f) }, new ObjectNewPosition { Name = "ShipModels2b/Cube.005 (1)", Position = new Vector3(-6.192f, 2.637f, -5.18f) }, new ObjectNewPosition { Name = "ShipModels2b/Cube.005 (2)", Position = new Vector3(-6.29f, 2.64f, -5.18f) }, new ObjectNewPosition { Name = "ShipModels2b/Light", Position = new Vector3(-6.1517f, 3.23f, -4.5148f), Rotation = new Vector3(270f, 180f, 0f) }, new ObjectNewPosition { Name = "ShipModels2b/Light (1)", Position = new Vector3(1.0879f, 3.0727f, -11.8577f) }, new ObjectNewPosition { Name = "ShipModels2b/Light (2)", Position = new Vector3(-6.1443f, 3.25f, -10.9433f) }, new ObjectNewPosition { Name = "ShipModels2b/Light (3)", Position = new Vector3(1.0957f, 3.13f, -4.399f), Rotation = new Vector3(270f, 0f, 0f) }, new ObjectNewPosition { Name = "ShipModels2b/MonitorWall/SingleScreen", Position = new Vector3(-12.269f, -1.267f, -5.525f) }, new ObjectNewPosition { Name = "ShipRailPosts" }, new ObjectNewPosition { Name = "ShipRails" }, new ObjectNewPosition { Name = "SideMachineryLeft" }, new ObjectNewPosition { Name = "SideMachineryRight" }, new ObjectNewPosition { Name = "Square" }, new ObjectNewPosition { Name = "StorageCloset", Position = new Vector3(-3.2237f, -0.1303f, -3.3999f) }, new ObjectNewPosition { Name = "Terminal", Position = new Vector3(6.2022f, 0.9266f, -9.3018f) }, new ObjectNewPosition { Name = "VentEntrance", Position = new Vector3(1.499f, 0.693f, -10.473f) }, new ObjectNewPosition { Name = "WallInsulator" }, new ObjectNewPosition { Name = "WallInsulator2" } }; foreach (ObjectNewPosition item in list) { PlacementManager.SetNewPlacement(item); } MagnetLeverPlacement value = ConfigManager.MagnetLever.Value; if (PlacementManager.MagnetLeverPositions.TryGetValue(value, out var value2)) { PlacementManager.SetNewPlacement(value2); } ChargeStationPlacement value3 = ConfigManager.ChargeStation.Value; if (PlacementManager.ChargeStationPositions.TryGetValue(value3, out var value4)) { PlacementManager.SetNewPlacement(value4); } DoorControlPanelPlacement value5 = ConfigManager.DoorControlPanel.Value; if (!PlacementManager.DoorControlPanelPositions.TryGetValue(value5, out var value6)) { return; } foreach (ObjectNewPosition item2 in value6) { PlacementManager.SetNewPlacement(item2); } } } public static class Variables { public static AssetBundle BiggerShipBundle { get; internal set; } public static GameObject HangarShip { get; set; } public static Transform RightmostSuitPosition { get; internal set; } public static ShipLights ShipLights { get; internal set; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "BiggerShip"; public const string PLUGIN_NAME = "BiggerShip"; public const string PLUGIN_VERSION = "1.0.13"; } } namespace BiggerShip.Patches { [HarmonyPatch(typeof(HangarShipDoor))] public static class HangarShipDoorStartPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void PatchMethod(HangarShipDoor __instance) { ((Logger)Plugin.debugLogger).LogDebug("Applying HangarShipDoor Start Patch"); if ((Object)(object)Variables.BiggerShipBundle == (Object)null) { Plugin.logger.LogError((object)"BiggerShipBundle is null in HangarShipDoor Start Patch!"); return; } RuntimeAnimatorController val = Variables.BiggerShipBundle.LoadAsset("assets/lethalcompany/biggership/assets/animatedshipdoor.controller"); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to load AnimatedShipDoor Animator Controller from AssetBundle!"); return; } ((Component)__instance).gameObject.GetComponent().runtimeAnimatorController = val; if (((CompatibilityBase)Plugin.TooManySuitsCompat).IsModPresent) { ((Logger)Plugin.debugLogger).LogDebug("Reloading TooManySuits!"); Plugin.TooManySuitsCompat.ReloadSuitRack(); } } } [HarmonyPatch(typeof(RoundManager))] public static class SpawnOutsideHazardsPatch { [HarmonyPostfix] [HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")] public static void RebakeNavmeshOnLanding(RoundManager __instance) { ((Logger)Plugin.debugLogger).LogDebug("Patching RoundManager.SpawnOutsideHazards"); BuildNavmesh.ReplaceNavmeshes(); } } [HarmonyPatch(typeof(StartOfRound))] internal class SetPlanetsWeatherPatch { [HarmonyPatch("SetPlanetsWeather")] [HarmonyPostfix] public static void RestoreOffLinks() { BuildNavmesh.RestoreOffMeshLinks(); } } [HarmonyPatch(typeof(StartOfRound))] internal class SuitPositionPatch { [HarmonyPatch("PositionSuitsOnRack")] [HarmonyPostfix] public static void AdjustSuitPosition(StartOfRound __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Variables.BiggerShipBundle == (Object)null) { Plugin.logger.LogError((object)"BiggerShipBundle is null, skipping!"); return; } UnlockableSuit[] source = Object.FindObjectsOfType(); UnlockableSuit[] array = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToArray(); for (int num = 0; num < array.Length; num++) { UnlockableItem component = ((Component)array[num]).GetComponent(); AutoParentToShip component2 = ((Component)array[num]).gameObject.GetComponent(); Vector3 positionOffset = __instance.rightmostSuitPosition.localPosition + __instance.rightmostSuitPosition.forward * 0.18f * (float)num; component2.positionOffset = positionOffset; } } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRoundStartPatch { [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyBefore(new string[] { "TooManySuits", "mrov.TooManySuits" })] public static void ChangeRightMostPosition(StartOfRound __instance) { ((Logger)Plugin.debugLogger).LogDebug("Patching StartOfRound.Start"); __instance.rightmostSuitPosition = ReplaceVanillaShip.replacementObjects[ShipPart.SuitRack].transform.Find("RightmostSuitPlacement"); __instance.shipRoomLights = Variables.ShipLights; } } } namespace BiggerShip.Patches.TooManySuit { internal class TooManySuitsPatches { internal static bool DisplaySuitsPrefix(PaginationController __instance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) int num = __instance.CurrentPage * __instance.SuitsPerPage; int num2 = Mathf.Min(num + __instance.SuitsPerPage, __instance._allSuits.Length); Transform val = StartOfRound.Instance.rightmostSuitPosition.parent.Find("NurbsPath.002"); Bounds bounds = ((Renderer)((Component)val).GetComponent()).bounds; float num3 = ((Bounds)(ref bounds)).size.x - 0.3f; float num4 = num3 / (float)__instance.SuitsPerPage; int num5 = 0; for (int i = 0; i < __instance._allSuits.Length; i++) { UnlockableSuit val2 = __instance._allSuits[i]; if ((Object)(object)((Component)val2).gameObject == (Object)null) { Plugin.logger.LogWarning((object)"Suit gameobject is null, skipping..."); continue; } AutoParentToShip component = ((Component)val2).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { bool flag = i >= num && i < num2; Renderer[] componentsInChildren = ((Component)val2).gameObject.GetComponentsInChildren(); foreach (Renderer val3 in componentsInChildren) { val3.enabled = flag; } Collider[] componentsInChildren2 = ((Component)val2).gameObject.GetComponentsInChildren(); foreach (Collider val4 in componentsInChildren2) { val4.enabled = flag; } InteractTrigger component2 = ((Component)val2).gameObject.GetComponent(); ((Behaviour)component2).enabled = flag; component2.interactable = flag; if (flag) { component.overrideOffset = true; component.positionOffset = StartOfRound.Instance.rightmostSuitPosition.localPosition + StartOfRound.Instance.rightmostSuitPosition.forward * (num4 * (float)num5); component.rotationOffset = new Vector3(0f, 90f, 0f); num5++; } } } ((MonoBehaviour)__instance).StartCoroutine(__instance.UpdateLabel()); return false; } internal static bool PatchesPrefix(Patches __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TooManySuitsPageLabel"); val.SetActive(false); RectTransform val2 = val.AddComponent(); ((Transform)val2).SetParent(StartOfRound.Instance.rightmostSuitPosition, false); ((Transform)val2).localPosition = Vector3.zero; ((Transform)val2).localEulerAngles = Vector3.zero; ((Transform)val2).localScale = Vector3.one * TooManySuits.Config.LabelScale * 0.05f; PaginationController val3 = val.AddComponent(); val3.SuitsPerPage = (int)((double)TooManySuits.Config.SuitsPerPage * 1.75); AutoParentToShip val4 = val.AddComponent(); val4.overrideOffset = true; val4.positionOffset = new Vector3(-2.125f, 2.958f, -9.902f); val4.rotationOffset = new Vector3(0f, 180f, 0f); val.SetActive(true); TooManySuits.SuitManager.UpdateSuits(); return false; } } } namespace BiggerShip.Enums { public enum ChargeStationPlacement { Right, Left } public enum DoorControlPanelPlacement { Vanilla, Compact } public enum MagnetLeverPlacement { Back, Front, Inside } public enum ShipPart { Ship, ShipElectricLights, SideMachineries, SuitRack, Pipes, Plane_001 } } namespace BiggerShip.Definitions { public struct ObjectNewPosition { public Vector3 Position; public Vector3 Rotation; public Vector3 Scale; public string Name { get; set; } public bool ToRemove { get { //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) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Position == Vector3.zero && Rotation == Vector3.zero) { return Scale == Vector3.zero; } return false; } } } } namespace BiggerShip.Compatibility { internal class ScienceBirdTweaksCompat : CompatibilityBase { public ScienceBirdTweaksCompat(string guid, string version = null) : base(guid, version) { } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void Init() { if (((CompatibilityBase)this).IsModPresent) { ((Logger)Plugin.debugLogger).LogDebug("ScienceBirdTweaks detected, applying patches."); PatchThings(); } } public void PatchThings() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(OccupancyPatch), "UpdatePoster", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ScienceBirdTweaksCompat), "OccupancyTranspiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static IEnumerable OccupancyTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); try { val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Stsfld, (object)AccessTools.Field(typeof(OccupancyPatch), "playerCount"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"HangarShip/Plane.001", (string)null) }); if (val.IsInvalid) { ((Logger)Plugin.debugLogger).LogWarning("OccupancyTranspiler: Could not find target pattern, returning original instructions"); return instructions; } val.Advance(1); if (val.Opcode != OpCodes.Ldstr || (string)val.Operand != "HangarShip/Plane.001") { ((Logger)Plugin.debugLogger).LogWarning("OccupancyTranspiler: Unexpected instruction found, returning original instructions"); return instructions; } val.SetOperandAndAdvance((object)"HangarShip/Plane.001/Posters/Poster6"); ((Logger)Plugin.debugLogger).LogInfo("OccupancyTranspiler: Successfully replaced GameObject path"); } catch (Exception ex) { ((Logger)Plugin.debugLogger).LogError("OccupancyTranspiler: Exception occurred - " + ex.Message); return instructions; } return val.InstructionEnumeration(); } } internal class TooManySuitsCompat : CompatibilityBase { public TooManySuitsCompat(string guid, string version = null) : base(guid, version) { } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void Init() { if (((CompatibilityBase)this).IsModPresent) { PatchThings(); } } public void PatchThings() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(PaginationController), "DisplayCurrentPage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(TooManySuitsPatches), "DisplaySuitsPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(Patches), "StartPatch", (Type[])null, (Type[])null), new HarmonyMethod(typeof(TooManySuitsPatches), "PatchesPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void ReloadSuitRack() { if (((CompatibilityBase)this).IsModPresent) { PaginationController componentInChildren = ((Component)StartOfRound.Instance.rightmostSuitPosition).gameObject.GetComponentInChildren(); if (componentInChildren != null) { componentInChildren.UpdateSuits(); } } } } internal class UniversalRadarCompat : CompatibilityBase { public UniversalRadarCompat(string guid, string version = null) : base(guid, version) { } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void Init() { if (((CompatibilityBase)this).IsModPresent) { ((Logger)Plugin.debugLogger).LogDebug("UniversalRadar detected, applying patches."); PatchThings(); } } public void PatchThings() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(RadarExtraPatches), "SetCamParameters", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(UniversalRadarCompat), "ShipContourTranspiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(RadarExtraPatches), "SetShipSpriteColour", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(UniversalRadarCompat), "ShipContourTranspiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static IEnumerable ShipContourTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); try { val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Environment/HangarShip/Square", (string)null) }); val.Repeat((Action)delegate(CodeMatcher match) { match.SetOperandAndAdvance((object)"Environment/HangarShip/ShipExtended(Clone)/ShipExtended/ShipContour"); ((Logger)Plugin.debugLogger).LogInfo("ShipContourTranspiler: Replaced GameObject path"); }, (Action)null); } catch (Exception ex) { ((Logger)Plugin.debugLogger).LogError("ShipContourTranspiler: Exception occurred - " + ex.Message); return instructions; } return val.InstructionEnumeration(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }