public override void Load() { ModTranslation.Load(); Logger = Log; DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); StreamerMode = Config.Bind("Custom", "Enable Streamer Mode", false); GhostsSeeTasks = Config.Bind("Custom", "Ghosts See Remaining Tasks", true); GhostsSeeRoles = Config.Bind("Custom", "Ghosts See Roles", true); GhostsSeeVotes = Config.Bind("Custom", "Ghosts See Votes", true); ShowRoleSummary = Config.Bind("Custom", "Show Role Summary", true); HideNameplates = Config.Bind("Custom", "Hide Nameplates", false); ShowLighterDarker = Config.Bind("Custom", "Show Lighter / Darker", false); HideTaskArrows = Config.Bind("Custom", "Hide Task Arrows", false); ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0"); StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles GM"); StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF"); DebugRepo = Config.Bind("Custom", "Debug Hat Repo", ""); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023); defaultRegions = ServerManager.DefaultRegions; UpdateRegions(); GameOptionsData.RecommendedImpostors = Enumerable.Repeat(3, 16).ToArray(); GameOptionsData.MaxImpostors = Enumerable.Repeat(15, 16).ToArray(); // Max Imp = Recommended Imp = 3 GameOptionsData.MinPlayers = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4 DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); RoleInfo.Load(); CustomColors.Load(); RandomGenerator.Initialize(); Harmony.PatchAll(); Patches.SubmergedPatch.Patch(); SubmergedCompatibility.Initialize(); }
public static void Postfix(KeyboardJoystick __instance) { if (!PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer)) { return; } if (stealthed) { // 梯子を使う/ドアを開ける if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Space)) { PlainDoor[] doors; if (PlayerControl.GameOptions.MapId == 4) { doors = DestroyableSingleton <AirshipStatus> .Instance.GetComponentsInChildren <PlainDoor>(); } else if (PlayerControl.GameOptions.MapId == 2) { doors = DestroyableSingleton <PolusShipStatus> .Instance.GetComponentsInChildren <PlainDoor>(); } else if (PlayerControl.GameOptions.MapId == 1) { doors = DestroyableSingleton <MiraShipStatus> .Instance.GetComponentsInChildren <PlainDoor>(); } else if (SubmergedCompatibility.isSubmerged()) { // 遅いかも doors = UnityEngine.GameObject.FindObjectsOfType <PlainDoor>(); } else { doors = DestroyableSingleton <SkeldShipStatus> .Instance.GetComponentsInChildren <PlainDoor>(); } PlainDoor t = null; float minDistance = 9999; foreach (var door in doors) { float distance = Vector2.Distance(door.transform.position, dummy.transform.position); if (distance < 1.5f && distance < minDistance) { t = door; minDistance = distance; } } if (t != null) { var deconSystem = t.transform.parent.gameObject.GetComponent <DeconSystem>(); if (deconSystem != null) { bool flag = true; if (PlayerControl.GameOptions.MapId == 2) { flag = t.name.Contains("Inner"); } else if (SubmergedCompatibility.isSubmerged()) { flag = t.name.Contains("Upper"); } var consoles = t.GetComponentsInChildren <DeconControl>(); DeconControl inner = null; DeconControl outer = null; foreach (var console in consoles) { if (console.name == "InnerConsole") { inner = console; } if (console.name == "OuterConsole") { outer = console; } } float distOuter = Vector2.Distance(outer.transform.position, dummy.transform.position); float distInner = Vector2.Distance(inner.transform.position, dummy.transform.position); if (distInner < distOuter) { deconSystem.OpenFromInside(flag); } else { deconSystem.OpenDoor(flag); } } else { DestroyableSingleton <ShipStatus> .Instance.RpcRepairSystem(SystemTypes.Doors, t.Id | 64); t.SetDoorway(true); } } if (PlayerControl.GameOptions.MapId == 4) { Ladder[] ladders = DestroyableSingleton <AirshipStatus> .Instance.GetComponentsInChildren <Ladder>(); Ladder target = null; foreach (var ladder in ladders) { float distance = Vector2.Distance(ladder.transform.position, dummy.transform.position); if (distance < 0.5f) { target = ladder; break; } } if (target != null) { MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerClimbRadder, Hazel.SendOption.Reliable, -1); messageWriter.Write(dummy.PlayerId); messageWriter.Write(target.Id); AmongUsClient.Instance.FinishRpcImmediately(messageWriter); RPCProcedure.puppeteerClimbRadder(dummy.PlayerId, target.Id); } } // エレベーター(サブマージド) if (SubmergedCompatibility.isSubmerged()) { var elevators = Helpers.FindObjectsOfType(SubmarineElevatorType); object elevator = null; minDistance = 9999; foreach (var e in elevators) { var pos = (e as UnityEngine.MonoBehaviour).transform.position; FieldInfo lowerInnerDoorInfo = SubmarineElevatorType.GetField("LowerInnerDoor"); FieldInfo upperInnerDoorInfo = SubmarineElevatorType.GetField("UpperInnerDoor"); var lowerInnerDoor = lowerInnerDoorInfo.GetValue(e) as PlainDoor; var upperInnerDoor = upperInnerDoorInfo.GetValue(e) as PlainDoor; float lowerDistance = Vector2.Distance(dummy.transform.position, lowerInnerDoor.transform.position); float upperDistance = Vector2.Distance(dummy.transform.position, upperInnerDoor.transform.position); float distance = lowerDistance < upperDistance ? lowerDistance : upperDistance; if (distance < 1.5 && distance < minDistance) { minDistance = distance; elevator = e; } } if (elevator != null) { var use = SubmarineElevatorType.GetMethod("Use"); use.Invoke(elevator, new object[0]); } } } if (Input.GetKeyDown(KeyCode.D)) { right = true; } if (Input.GetKeyUp(KeyCode.D)) { right = false; } if (Input.GetKeyDown(KeyCode.A)) { left = true; } if (Input.GetKeyUp(KeyCode.A)) { left = false; } if (Input.GetKeyDown(KeyCode.W)) { up = true; } if (Input.GetKeyUp(KeyCode.W)) { up = false; } if (Input.GetKeyDown(KeyCode.S)) { down = true; } if (Input.GetKeyUp(KeyCode.S)) { down = false; } if (Puppeteer.dummy != null) { Vector2 pos = Puppeteer.dummy.transform.position; Vector2 offset = Vector2.zero; if (up) { offset += new Vector2(0f, 0.5f); } if (down) { offset += new Vector2(0f, -0.5f); } if (left) { offset += new Vector2(-0.5f, 0.0f); } if (right) { offset += new Vector2(0.5f, 0.0f); } MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.WalkDummy, Hazel.SendOption.Reliable, -1); writer.Write(offset.x); writer.Write(offset.y); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.walkDummy(offset); if (!(up || down || right || left)) { writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MoveDummy, Hazel.SendOption.Reliable, -1); writer.Write(Puppeteer.dummy.transform.position.x); writer.Write(Puppeteer.dummy.transform.position.y); writer.Write(Puppeteer.dummy.transform.position.z); writer.Write(false); AmongUsClient.Instance.FinishRpcImmediately(writer); // RPCProcedure.moveDummy(Puppeteer.dummy.transform.position); } } } }