From 2a3add98f7fe5a896cf3610bca0238515a705541 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Sun, 5 Oct 2025 13:39:10 +0200 Subject: [PATCH] fix string & add animation --- GameMode/Deathrace.cs | 4 +++- Modules/Translator.cs | 3 +++ Patches/HudPatch.cs | 23 ++++++++++++++++++----- Resources/Lang/en_US.json | 4 ++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/GameMode/Deathrace.cs b/GameMode/Deathrace.cs index 2d111cda3..4bffe794a 100644 --- a/GameMode/Deathrace.cs +++ b/GameMode/Deathrace.cs @@ -160,7 +160,7 @@ public static class Deathrace .SetGameMode(gameMode) .SetValueFormat(OptionFormat.Multiplier); - EnergyDrinkSpeedIncreasementOption = new FloatOptionItem(id++, "Deathrace.EnergyDrinkSpeedIncreasementOption", new(0.05f, 1f, 0.05f), 0.25f, tab) + EnergyDrinkSpeedIncreasementOption = new FloatOptionItem(id++, "Deathrace.EnergyDrinkSpeedIncreasementOption", new(0.05f, 3f, 0.05f), 0.5f, tab) .SetParent(SpawnPowerUpsOption) .SetColor(color) .SetGameMode(gameMode) @@ -470,6 +470,8 @@ public static class Deathrace removeId = id; continue; } + + if (data.Player.inMovingPlat) continue; if (SpawnedPowerUps.FindFirst(x => Vector2.Distance(data.Player.Pos(), x.Position) <= PowerUpPickupRange, out var powerUp)) { diff --git a/Modules/Translator.cs b/Modules/Translator.cs index c3942013a..d8079cbe3 100644 --- a/Modules/Translator.cs +++ b/Modules/Translator.cs @@ -125,6 +125,9 @@ public static class Translator if (SubmergedCompatibility.IsSubmerged() && int.TryParse(s, out int roomNumber) && roomNumber is >= 128 and <= 135) s = $"SubmergedRoomName.{roomNumber}"; + if (GameStates.InGame && Options.CurrentGameMode == CustomGameMode.Deathrace && int.TryParse(s, out roomNumber) && Deathrace.CoordinateChecks.ContainsKey(roomNumber)) + s = "Deathrace.CoordinateCheck"; + SupportedLangs langId = TranslationController.InstanceExists ? TranslationController.Instance.currentLanguage.languageID : SupportedLangs.English; if (console) langId = SupportedLangs.English; diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index 865a4e809..a00b19a74 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -955,6 +955,8 @@ internal static class TaskPanelBehaviourPatch return newPanel; } + private const float PosSmoothSpeed = 8f; // bigger = faster + internal static void UpdateRoleTab(TaskPanelBehaviour panel, CustomRoles role) { var tabText = panel.tab.gameObject.GetComponentInChildren(); @@ -963,19 +965,24 @@ internal static class TaskPanelBehaviourPatch if (tabText.text != panelName) tabText.text = panelName; float y = ogPanel.taskText.textBounds.size.y + 1; - panel.closedPosition = new Vector3(ogPanel.closedPosition.x, ogPanel.open ? y : 2f, ogPanel.closedPosition.z); - panel.openPosition = new Vector3(ogPanel.openPosition.x, ogPanel.open ? y : 2f, ogPanel.openPosition.z); + Vector3 targetClosed = new Vector3(ogPanel.closedPosition.x, ogPanel.open ? y + 0.2f : 2f, ogPanel.closedPosition.z); + Vector3 targetOpen = new Vector3(ogPanel.openPosition.x, ogPanel.open ? y : 2f, ogPanel.openPosition.z); + + float t = 1f - Mathf.Exp(-PosSmoothSpeed * Time.deltaTime); + + panel.closedPosition = Vector3.Lerp(panel.closedPosition, targetClosed, t); + panel.openPosition = Vector3.Lerp(panel.openPosition, targetOpen, t); PlayerControl player = PlayerControl.LocalPlayer; string roleInfo = player.GetRoleInfo(); - var roleWithInfo = $"{role.ToColoredString()}:\r\n{roleInfo}"; + var roleWithInfo = $"{role.ToColoredString()}:\r\n{roleInfo}"; if (Options.CurrentGameMode != CustomGameMode.Standard) { string[] splitted = roleInfo.Split(' '); - roleWithInfo = $"{GetString($"{Options.CurrentGameMode}")}\r\n" + (splitted.Length <= 3 + roleWithInfo = $"{GetString($"{Options.CurrentGameMode}")}:\r\n" + (splitted.Length <= 3 ? $"{roleInfo}\r\n" : $"{string.Join(' ', splitted[..3])}\r\n{string.Join(' ', splitted[3..])}\r\n"); } @@ -983,7 +990,7 @@ internal static class TaskPanelBehaviourPatch { string[] split = roleInfo.Split(' '); int half = split.Length / 2; - roleWithInfo = $"{role.ToColoredString()}:\r\n{string.Join(' ', split[..half])}\r\n{string.Join(' ', split[half..])}"; + roleWithInfo = $"{role.ToColoredString()}:\r\n{string.Join(' ', split[..half])}\r\n{string.Join(' ', split[half..])}"; } string finalText = Utils.ColorString(player.GetRoleColor(), roleWithInfo); @@ -1147,6 +1154,12 @@ internal static class TaskPanelBehaviourPatch var tabText = __instance.tab.transform.FindChild("TabText_TMP").GetComponent(); tabText.SetText($"{TranslationController.Instance.GetString(StringNames.Tasks)}{Utils.GetTaskCount(PlayerControl.LocalPlayer.PlayerId, Utils.IsActive(SystemTypes.Comms))}"); } + else + { + __instance.transform.localPosition = new Vector3(10000f, 10000f, 0f); + return false; + } + return true; } diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 15554036a..38a8e250d 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -5341,10 +5341,10 @@ "Deathrace.PowerUpInfo.Taser": "<#ffffff>[<#00ffa5>KILL] {0} Taser: Stuns the selected player", "Deathrace.PowerUpInfo.EnergyDrink": "<#ffffff>[<#00ffff>VANISH] {0} Energy Drink: Speeds you up", "Deathrace.PowerUpInfo.Grenade": "<#ffffff>[<#00ffff>VANISH] {0} Grenade: Blinds everyone nearby (except you)", - "Deathrace.PowerUpInfo.Ice": "<#ffffff>[<#00ffff>VANISH] {0} Ice: Freezes everyone nearby (except you)", + "Deathrace.PowerUpInfo.Ice": "<#ffffff>[<#00ffff>VANISH] {0} Ice: Inverts controls for everyone nearby (except you)", "Deathrace.PowerUpInfo.More": "+{0} More Power-Ups Stored", "Deathrace.CoordinateCheck": "[Position Check]", - "Deathrace.CoordinateCheckInfo.100": "Exit on the left side of Cafeteria\\nTowards Splash Zone", + "Deathrace.CoordinateCheckInfo.100": "Exit this room on the left side", "Racer": "DEATHRACE", "RacerInfo": "COMPLETE ALL LAPS FIRST TO WIN", "RacerInfoLong": "COMPLETE ALL LAPS FIRST TO WIN",