From 6850763ff2e56c3912b3ce74ef08fbcfab8631f7 Mon Sep 17 00:00:00 2001 From: Allul Date: Fri, 10 Jun 2022 09:08:23 +0200 Subject: [PATCH] Add files via upload 2.0.2 --- LasMonjas/Buttons.cs | 206 ++++++++++++++++++++++++++------ LasMonjas/CustomOptionHolder.cs | 6 +- LasMonjas/Helpers.cs | 57 +++++++-- LasMonjas/LasMonjas.cs | 3 + LasMonjas/LasMonjas.csproj | 2 +- LasMonjas/Main.cs | 7 +- LasMonjas/MapOptions.cs | 2 + LasMonjas/RPC.cs | 42 ++++++- 8 files changed, 271 insertions(+), 54 deletions(-) diff --git a/LasMonjas/Buttons.cs b/LasMonjas/Buttons.cs index 6cd8d09..ba39645 100644 --- a/LasMonjas/Buttons.cs +++ b/LasMonjas/Buttons.cs @@ -93,6 +93,9 @@ static class HudManagerStartPatch private static CustomButton engineerTrapButton; private static CustomButton shyButton; + public static CustomButton zoomOutButton; + public static bool zoomOutStatus = false; + // Capture the flag buttons private static CustomButton redplayer01KillButton; private static CustomButton redplayer01TakeFlagButton; @@ -373,6 +376,8 @@ public static void setCustomButtonCooldowns() { shyButton.MaxTimer = Shy.cooldown; shyButton.EffectDuration = Shy.duration; + zoomOutButton.MaxTimer = 0f; + // Remaining uses text Mechanic.mechanicRepairButtonText.text = $"{Mechanic.numberOfRepairs - Mechanic.timesUsedRepairs} / {Mechanic.numberOfRepairs}"; FortuneTeller.fortuneTellerRevealButtonText.text = $"{FortuneTeller.numberOfFortunes - FortuneTeller.timesUsedFortune} / {FortuneTeller.numberOfFortunes}"; @@ -2738,7 +2743,7 @@ public static void Postfix(HudManager __instance) { } } - if (MeetingHud.Instance == null && Poisoner.poisonedTarget != null && !Poisoner.poisonedTarget.Data.IsDead && Vector2.Distance(Poisoner.poisonedTarget.transform.position, player.transform.position) < (1f * Poisoner.infectRange)) { + if (MeetingHud.Instance == null && Poisoner.poisonedTarget != null && !Poisoner.poisonedTarget.Data.IsDead && Vector2.Distance(Poisoner.poisonedTarget.transform.position, player.transform.position) < (1f * Poisoner.infectRange) && !Challenger.isDueling) { infectProceedFlag = true; } @@ -4179,33 +4184,38 @@ public static void Postfix(HudManager __instance) { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); if (PlayerControl.GameOptions.MapId != 5) { - if (!Necromancer.madeList) { - foreach (SystemTypes type in ShipStatus.Instance.FastRooms.Keys) { - Necromancer.Rooms.Add(type); - } - Necromancer.madeList = true; + if (activatedSensei) { + Necromancer.targetRoom = SystemTypes.MedBay; } - - List candidate = new List(); - float dis = Necromancer.roomDistance, nearestDis = 100f; - SystemTypes? nearest = null; - foreach (var room in Necromancer.Rooms) { - float d = ShipStatus.Instance.FastRooms[room].roomArea.Distance(collider2D).distance; - if (d > 0.2f) { - if (dis > d) { - candidate.Add(room); + else { + if (!Necromancer.madeList) { + foreach (SystemTypes type in ShipStatus.Instance.FastRooms.Keys) { + Necromancer.Rooms.Add(type); } - if (nearest == null || nearestDis > d) { - nearestDis = d; - nearest = room; + Necromancer.madeList = true; + } + + List candidate = new List(); + float dis = Necromancer.roomDistance, nearestDis = 100f; + SystemTypes? nearest = null; + foreach (var room in Necromancer.Rooms) { + float d = ShipStatus.Instance.FastRooms[room].roomArea.Distance(collider2D).distance; + if (d > 0.2f) { + if (dis > d) { + candidate.Add(room); + } + if (nearest == null || nearestDis > d) { + nearestDis = d; + nearest = room; + } } } - } - if (candidate.Count > 0) { - Necromancer.targetRoom = candidate[LasMonjas.rnd.Next(candidate.Count)]; - } - else { - Necromancer.targetRoom = nearest.Value; + if (candidate.Count > 0) { + Necromancer.targetRoom = candidate[LasMonjas.rnd.Next(candidate.Count)]; + } + else { + Necromancer.targetRoom = nearest.Value; + } } } else { List candidate = new List(); @@ -4240,7 +4250,12 @@ public static void Postfix(HudManager __instance) { Necromancer.reviveArrow.arrow.SetActive(true); } else { - Necromancer.reviveArrow.Update(ShipStatus.Instance.FastRooms[Necromancer.targetRoom].roomArea.transform.position); + if (activatedSensei) { + Necromancer.reviveArrow.Update(new Vector3 (-6.5f, -2, 0)); + } + else { + Necromancer.reviveArrow.Update(ShipStatus.Instance.FastRooms[Necromancer.targetRoom].roomArea.transform.position); + } } } else { @@ -4466,6 +4481,22 @@ public static void Postfix(HudManager __instance) { } ); + zoomOutButton = new CustomButton( + () => { Helpers.toggleZoom(); + }, + () => { if (PlayerControl.LocalPlayer == null || !PlayerControl.LocalPlayer.Data.IsDead || PlayerControl.LocalPlayer.Data.Role.IsImpostor || TimeTraveler.isRewinding || howmanygamemodesareon == 1) return false; + var (playerCompleted, playerTotal) = TasksHandler.taskInfo(PlayerControl.LocalPlayer.Data); + int numberOfLeftTasks = playerTotal - playerCompleted; + return numberOfLeftTasks <= 0; + }, + () => { return true; }, + () => { return; }, + Helpers.loadSpriteFromResources("LasMonjas.Images.MinusButton.png", 150f), // Invisible button! + new Vector3(0.4f, 2.8f, 0), + __instance, + KeyCode.KeypadPlus + ); + zoomOutButton.Timer = 0f; // Capture the flag buttons // Redplayer01 Kill @@ -7617,6 +7648,12 @@ public static void Postfix(HudManager __instance) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer01currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer01IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7644,7 +7681,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer02currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer02IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7672,7 +7716,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer03currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer03IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7700,7 +7751,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer04currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer04IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7728,7 +7786,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer05currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer05IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7756,7 +7821,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.greenplayer06currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.greenplayer06IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7806,7 +7878,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer01currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer01IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7835,7 +7914,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer02currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer02IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7863,7 +7949,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer03currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer03IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7891,7 +7984,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer04currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer04IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7919,7 +8019,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer05currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer05IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7947,7 +8054,14 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[3].arrow.SetActive(true); + KingOfTheHill.localArrows[3].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + } } return KingOfTheHill.yellowplayer06currentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.yellowplayer06IsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -7975,7 +8089,21 @@ public static void Postfix(HudManager __instance) { if (KingOfTheHill.localArrows.Count != 0) { KingOfTheHill.localArrows[0].Update(KingOfTheHill.zoneone.transform.position, KingOfTheHill.zoneonecolor); KingOfTheHill.localArrows[1].Update(KingOfTheHill.zonetwo.transform.position, KingOfTheHill.zonetwocolor); - KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + KingOfTheHill.localArrows[2].Update(KingOfTheHill.zonethree.transform.position, KingOfTheHill.zonethreecolor); + if (!KingOfTheHill.greenKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[4].arrow.SetActive(true); + KingOfTheHill.localArrows[4].Update(KingOfTheHill.greenKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[4].arrow.SetActive(false); + } + if (!KingOfTheHill.yellowKingplayer.Data.IsDead) { + KingOfTheHill.localArrows[5].arrow.SetActive(true); + KingOfTheHill.localArrows[5].Update(KingOfTheHill.yellowKingplayer.transform.position, Color.cyan); + } + else { + KingOfTheHill.localArrows[5].arrow.SetActive(false); + } } return KingOfTheHill.usurperPlayercurrentTarget && PlayerControl.LocalPlayer.CanMove && !KingOfTheHill.usurperPlayerIsReviving && !PlayerControl.LocalPlayer.Data.IsDead; }, @@ -8055,7 +8183,7 @@ public static void Postfix(HudManager __instance) { }, () => { greenKingplayerCaptureZoneButton.Timer = greenKingplayerCaptureZoneButton.MaxTimer; }, KingOfTheHill.getPlaceGreenFlagButtonSprite(), - new Vector3(-3f, -0.06f, 0), + new Vector3(-1.9f, -0.06f, 0), __instance, KeyCode.F, true, @@ -8120,7 +8248,7 @@ public static void Postfix(HudManager __instance) { }, () => { yellowKingplayerCaptureZoneButton.Timer = yellowKingplayerCaptureZoneButton.MaxTimer; }, KingOfTheHill.getPlaceYellowFlagButtonSprite(), - new Vector3(-3f, -0.06f, 0), + new Vector3(-1.9f, -0.06f, 0), __instance, KeyCode.F, true, diff --git a/LasMonjas/CustomOptionHolder.cs b/LasMonjas/CustomOptionHolder.cs index f90516f..e39e759 100644 --- a/LasMonjas/CustomOptionHolder.cs +++ b/LasMonjas/CustomOptionHolder.cs @@ -22,13 +22,14 @@ public class CustomOptionHolder { // Global Settings public static CustomOption globalSettings; public static CustomOption activateRoles; - public static CustomOption nightVisionLightSabotage; public static CustomOption activateSenseiMap; public static CustomOption removeSwipeCard; - public static CustomOption removeAirshipDoors; + public static CustomOption removeAirshipDoors; + public static CustomOption nightVisionLightSabotage; public static CustomOption screenShakeReactorSabotage; public static CustomOption anonymousCommsSabotage; public static CustomOption slowSpeedOxigenSabotage; + public static CustomOption hideVentAnimOnShadows; // Modifiers public static CustomOption activateModifiers; @@ -408,6 +409,7 @@ public static void Load() { screenShakeReactorSabotage = CustomOption.Create(9, cs(Detective.color, "Screen shake for reactor sabotage"), "setting", false, globalSettings); anonymousCommsSabotage = CustomOption.Create(10, cs(Detective.color, "Anonymous players for comms sabotage"), "setting", false, globalSettings); slowSpeedOxigenSabotage = CustomOption.Create(11, cs(Detective.color, "Decreaes speed for oxygen sabotage"), "setting", false, globalSettings); + hideVentAnimOnShadows = CustomOption.Create(12, cs(Detective.color, "Hide Vent Anim on Shadows"), "setting", false, globalSettings); // Modifiers activateModifiers = CustomOption.Create(15, cs(Modifiers.color, "Modifiers"), "setting", false, null, true); diff --git a/LasMonjas/Helpers.cs b/LasMonjas/Helpers.cs index 368781d..cebebd5 100644 --- a/LasMonjas/Helpers.cs +++ b/LasMonjas/Helpers.cs @@ -205,17 +205,25 @@ public static KeyValuePair MaxPair(this Dictionary self, o } return result; } - public static bool hidePlayerName(PlayerControl source, PlayerControl target) { - if (Painter.painterTimer > 0f) return true; // No names are visible - else if (!MapOptions.hidePlayerNames) return false; // All names are visible - else if (source == null || target == null) return true; - else if (source == target) return false; // Player sees his own name - else if (source.Data.Role.IsImpostor && target.Data.Role.IsImpostor) return false; // Members of team Impostors see the names of Impostors - else if ((source == Modifiers.lover1 || source == Modifiers.lover2) && (target == Modifiers.lover1 || target == Modifiers.lover2)) return false; // Members of team Lovers see the names of each other - else if ((source == Renegade.renegade || source == Minion.minion) && (target == Renegade.renegade || target == Minion.minion || target == Renegade.fakeMinion)) return false; // Members of team Renegade see the names of each other + if (source == target) return false; + if (source == null || target == null) return true; + if (source.Data.IsDead) return false; + if (target.Data.IsDead) return true; + if (Painter.painterTimer > 0f) return true; // No names are visible + if (AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started && ShipStatus.Instance != null && source.transform != null && target.transform != null) { + float distMod = 1.025f; + float distance = Vector3.Distance(source.transform.position, target.transform.position); + bool anythingBetween = PhysicsHelpers.AnythingBetween(source.transform.position, target.transform.position, Constants.ShadowMask, false); + + if (distance > ShipStatus.Instance.CalculateLightRadius(source.Data) * distMod || anythingBetween) return true; + } + if (!MapOptions.hidePlayerNames) return false; // All names are visible + if (source.Data.Role.IsImpostor && target.Data.Role.IsImpostor) return false; // Members of team Impostors see the names of Impostors + if (source.getPartner() == target) return false; // Members of team Lovers see the names of each other + if ((source == Renegade.renegade || source == Minion.minion) && (target == Renegade.renegade || target == Minion.minion || target == Renegade.fakeMinion)) return false; // Members of team Renegade see the names of each other return true; - } + } public static void setDefaultLook(this PlayerControl target) { target.setLook(target.Data.PlayerName, target.Data.DefaultOutfit.ColorId, target.Data.DefaultOutfit.HatId, target.Data.DefaultOutfit.VisorId, target.Data.DefaultOutfit.SkinId, target.Data.DefaultOutfit.PetId); @@ -476,5 +484,36 @@ public static bool AnySabotageActive(bool disableSubmergedMaskCheck = false) { SubmergedCompatibility.DisableO2MaskCheckForEmergency = false; return false; } + + public static void enableCursor(string mode) { + if (mode == "start") { + Sprite sprite = Helpers.loadSpriteFromResources("LasMonjas.Images.Cursor.png", 115f); + Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto); + return; + } + if (LasMonjasPlugin.MonjaCursor.Value) { + Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); + } + else { + Sprite sprite = Helpers.loadSpriteFromResources("LasMonjas.Images.Cursor.png", 115f); + Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto); + } + } + public static void toggleZoom(bool reset = false) { + float zoomFactor = 4f; + if (HudManagerStartPatch.zoomOutStatus) + zoomFactor = 1 / zoomFactor; + else if (reset) return; // Dont zoom out if meant to reset. + HudManagerStartPatch.zoomOutStatus = !HudManagerStartPatch.zoomOutStatus; + Camera.main.orthographicSize *= zoomFactor; + foreach (var cam in Camera.allCameras) { + if (cam != null && cam.gameObject.name == "UI Camera") cam.orthographicSize *= zoomFactor; // The UI is scaled too, else we cant click the buttons. Downside: map is super small. + } + + HudManagerStartPatch.zoomOutButton.Sprite = HudManagerStartPatch.zoomOutStatus ? Helpers.loadSpriteFromResources("LasMonjas.Images.PlusButton.png", 150f / zoomFactor * 2) : Helpers.loadSpriteFromResources("LasMonjas.Images.MinusButton.png", 150f); + HudManagerStartPatch.zoomOutButton.PositionOffset = HudManagerStartPatch.zoomOutStatus ? new Vector3(0f, 3f, 0) : new Vector3(0.4f, 2.8f, 0); + ResolutionManager.ResolutionChanged.Invoke((float)Screen.width / Screen.height); // This will move button positions to the correct position. + } + } } \ No newline at end of file diff --git a/LasMonjas/LasMonjas.cs b/LasMonjas/LasMonjas.cs index 4dcc906..0da73aa 100644 --- a/LasMonjas/LasMonjas.cs +++ b/LasMonjas/LasMonjas.cs @@ -63,6 +63,8 @@ public static class LasMonjas public static bool slowSpeedOxigen = CustomOptionHolder.slowSpeedOxigenSabotage.getBool(); + public static bool hideVentAnim = CustomOptionHolder.hideVentAnimOnShadows.getBool(); + public static void clearAndReloadRoles() { Mimic.clearAndReload(); Painter.clearAndReload(); @@ -156,6 +158,7 @@ public static void clearAndReloadRoles() { anonymousComms = CustomOptionHolder.anonymousCommsSabotage.getBool(); isHappeningAnonymousComms = false; slowSpeedOxigen = CustomOptionHolder.slowSpeedOxigenSabotage.getBool(); + hideVentAnim = CustomOptionHolder.hideVentAnimOnShadows.getBool(); } } diff --git a/LasMonjas/LasMonjas.csproj b/LasMonjas/LasMonjas.csproj index d0e6244..7921a78 100644 --- a/LasMonjas/LasMonjas.csproj +++ b/LasMonjas/LasMonjas.csproj @@ -1,7 +1,7 @@  netstandard2.1 - 2.0.1 + 2.0.2 Las Monjas Allul diff --git a/LasMonjas/Main.cs b/LasMonjas/Main.cs index 552109f..d381447 100644 --- a/LasMonjas/Main.cs +++ b/LasMonjas/Main.cs @@ -25,7 +25,7 @@ public class LasMonjasPlugin : BasePlugin { public const string Id = "me.allul.lasmonjas"; - public const string VersionString = "2.0.1"; + public const string VersionString = "2.0.2"; public static System.Version Version = System.Version.Parse(VersionString); internal static BepInEx.Logging.ManualLogSource Logger; @@ -42,6 +42,7 @@ public class LasMonjasPlugin : BasePlugin public static ConfigEntry ActivateMusic { get; set; } public static ConfigEntry GhostsSeeRoles { get; set; } public static ConfigEntry HorseMode { get; set; } + public static ConfigEntry MonjaCursor { get; set; } public static ConfigEntry IpCustom { get; set; } public static ConfigEntry PortCustom { get; set; } @@ -68,6 +69,7 @@ public override void Load() { ActivateMusic = Config.Bind("Custom", "Activate Music", true); GhostsSeeRoles = Config.Bind("Custom", "Ghosts See Roles", true); HorseMode = Config.Bind("Custom", "Horse Mode", false); + MonjaCursor = Config.Bind("Custom", "Monja Cursor", true); IpCustom = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); PortCustom = Config.Bind("Custom", "Custom Server Port", (ushort)22023); @@ -86,6 +88,9 @@ public override void Load() { Harmony.PatchAll(); SubmergedCompatibility.Initialize(); AddComponent(); + if (MonjaCursor.Value) { + Helpers.enableCursor("start"); + } } } diff --git a/LasMonjas/MapOptions.cs b/LasMonjas/MapOptions.cs index 003863b..696aa7c 100644 --- a/LasMonjas/MapOptions.cs +++ b/LasMonjas/MapOptions.cs @@ -13,6 +13,7 @@ static class MapOptions { public static bool activateMusic = false; public static bool ghostsSeeRoles = true; public static bool horseMode = false; + public static bool monjaCursor = true; // Updating values public static List camerasToAdd = new List(); @@ -29,6 +30,7 @@ public static void clearAndReloadMapOptions() { activateMusic = LasMonjasPlugin.ActivateMusic.Value; ghostsSeeRoles = LasMonjasPlugin.GhostsSeeRoles.Value; horseMode = LasMonjasPlugin.HorseMode.Value; + monjaCursor = LasMonjasPlugin.MonjaCursor.Value; } public static void checkMusic() { diff --git a/LasMonjas/RPC.cs b/LasMonjas/RPC.cs index f280a40..2bc3ada 100644 --- a/LasMonjas/RPC.cs +++ b/LasMonjas/RPC.cs @@ -1764,6 +1764,7 @@ public static void challengerPerformDuel() { // music stop and play duel music changeMusic(8); SoundManager.Instance.PlaySound(CustomMain.customAssets.challengerDuelMusic, false, 5f); + SoundManager.Instance.StopSound(CustomMain.customAssets.performerMusic); foreach (PlayerControl player in PlayerControl.AllPlayerControls) { if (player == PlayerControl.LocalPlayer) { @@ -2150,7 +2151,9 @@ public static void timeTravelerRevive(byte playerId) { } if (Necromancer.necromancer != null && Necromancer.dragginBody) { necromancerResetValues(); - } + } + // Reset zoomed out ghosts + Helpers.toggleZoom(reset: true); } } @@ -2438,6 +2441,9 @@ public static void spiritualistRevive(byte playerId, byte reviverId) { } } + // Reset zoomed out ghosts + Helpers.toggleZoom(reset: true); + if (Spiritualist.spiritualist != null && Spiritualist.spiritualist.PlayerId == reviverId) { Spiritualist.preventReport = true; murderSpiritualistIfReportWhileReviving(); @@ -2922,6 +2928,14 @@ public static void captureTheFlagWhoTookTheFlag(byte playerWhoStoleTheFlag, int CaptureTheFlag.redPlayerWhoHasBlueFlag = player; CaptureTheFlag.blueflag.transform.parent = player.transform; CaptureTheFlag.blueflag.transform.localPosition = new Vector3(0f, 0f, -0.1f); + foreach (PlayerControl redplayer in CaptureTheFlag.redteamFlag) { + if (redplayer == PlayerControl.LocalPlayer && redplayer != null) { + new CustomMessage("Blue Flag stolen by "+ CaptureTheFlag.redPlayerWhoHasBlueFlag.name + "!", 5, -1, 1.6f, 4); + } + } + if (CaptureTheFlag.stealerPlayer != null && CaptureTheFlag.stealerPlayer == PlayerControl.LocalPlayer) { + new CustomMessage("Blue Flag stolen by " + CaptureTheFlag.redPlayerWhoHasBlueFlag.name + "!", 5, -1, 1.6f, 4); + } } // Alert red team players @@ -2941,6 +2955,14 @@ public static void captureTheFlagWhoTookTheFlag(byte playerWhoStoleTheFlag, int CaptureTheFlag.bluePlayerWhoHasRedFlag = player; CaptureTheFlag.redflag.transform.parent = player.transform; CaptureTheFlag.redflag.transform.localPosition = new Vector3(0f, 0f, -0.1f); + foreach (PlayerControl blueplayer in CaptureTheFlag.blueteamFlag) { + if (blueplayer == PlayerControl.LocalPlayer && blueplayer != null) { + new CustomMessage("Red Flag stolen by " + CaptureTheFlag.bluePlayerWhoHasRedFlag.name + "!", 5, -1, 1.6f, 4); + } + } + if (CaptureTheFlag.stealerPlayer != null && CaptureTheFlag.stealerPlayer == PlayerControl.LocalPlayer) { + new CustomMessage("Red Flag stolen by " + CaptureTheFlag.bluePlayerWhoHasRedFlag.name + "!", 5, -1, 1.3f, 4); + } } // Alert blue team players @@ -3400,7 +3422,7 @@ public static void policeandThiefTakeJewel(byte thiefWhoTookATreasure, byte jewe } public static void policeandThiefDeliverJewel(byte thiefWhoTookATreasure, byte jewelId) { - // Red team + // Thief team foreach (PlayerControl player in PoliceAndThief.thiefTeam) { // Thief player steal a jewel if (player.PlayerId == thiefWhoTookATreasure) { @@ -4326,8 +4348,16 @@ public static void kingOfTheHillKills(byte targetId, int whichplayer) { KingOfTheHill.greenkingaura.transform.parent = KingOfTheHill.greenKingplayer.transform; if (PlayerControl.LocalPlayer == KingOfTheHill.greenKingplayer) { new CustomMessage("You're the new Green King!", 5, -1, 1.6f, 11); + KingOfTheHill.localArrows[3].arrow.SetActive(false); + KingOfTheHill.localArrows[4].arrow.SetActive(false); + KingOfTheHill.localArrows[5].arrow.SetActive(false); } KingOfTheHill.greenKingplayer.MurderPlayer(KingOfTheHill.usurperPlayer); + if (PlayerControl.LocalPlayer == KingOfTheHill.usurperPlayer) { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + KingOfTheHill.localArrows[4].arrow.SetActive(true); + KingOfTheHill.localArrows[5].arrow.SetActive(true); + } } else if (player.PlayerId == KingOfTheHill.yellowKingplayer.PlayerId) { KingOfTheHill.yellowTeam.Remove(KingOfTheHill.yellowKingplayer); @@ -4343,8 +4373,16 @@ public static void kingOfTheHillKills(byte targetId, int whichplayer) { KingOfTheHill.yellowkingaura.transform.parent = KingOfTheHill.yellowKingplayer.transform; if (PlayerControl.LocalPlayer == KingOfTheHill.yellowKingplayer) { new CustomMessage("You're the new Yellow King!", 5, -1, 1.6f, 11); + KingOfTheHill.localArrows[3].arrow.SetActive(false); + KingOfTheHill.localArrows[4].arrow.SetActive(false); + KingOfTheHill.localArrows[5].arrow.SetActive(false); } KingOfTheHill.yellowKingplayer.MurderPlayer(KingOfTheHill.usurperPlayer); + if (PlayerControl.LocalPlayer == KingOfTheHill.usurperPlayer) { + KingOfTheHill.localArrows[3].arrow.SetActive(false); + KingOfTheHill.localArrows[4].arrow.SetActive(true); + KingOfTheHill.localArrows[5].arrow.SetActive(true); + } } else { KingOfTheHill.usurperPlayer.MurderPlayer(player); }