From 72ce8d825e48cdc797240c50ff0b75bddca913ae Mon Sep 17 00:00:00 2001 From: "zypheruskhan711 (via Bot)" Date: Mon, 31 Aug 2026 15:52:17 +0000 Subject: [PATCH 1/3] Add EAC entry: Told you I --- Resources/Config/EACList.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Resources/Config/EACList.txt b/Resources/Config/EACList.txt index a4895e30c..b3f00ae01 100644 --- a/Resources/Config/EACList.txt +++ b/Resources/Config/EACList.txt @@ -256,6 +256,8 @@ budfore#5752 | b3672c491 | i hate iphone | Racist | n word in game massifpink#4006 | ba0e09419 | ciansom13 | Racist | n word in game brownnest#1548 | 954f82d96 | jimmy o1 | Racist | n word in game tiaragold#0846 | edf2bc4e8 | cyan | Racist | n word in game +weberright#3756 | 2779bfdfe | Told you I | Racist | Slurs in a streamer's game + From 85e5d8834e25e3bec30737d45b980538b854f09a Mon Sep 17 00:00:00 2001 From: VOID4487 <109478529+VOID4487@users.noreply.github.com> Date: Sat, 5 Sep 2026 12:30:29 +0530 Subject: [PATCH 2/3] RE: Fixing Bugs related with caret position and pasting into chat input. (#692) * RE: Added Supported Icons List. * RE: Update supported_chars.txt + Added attributions. + Expanded the list of special icons supported by Among Us and categorized them. * RE: Refactor AllowAllCharacters method in TextBoxPatch + Fixed a bug related with caret positioning that corrupted chat input. + Said bug was unintended behaviour ported from MalumMenu. * RE: Fixed Pasting into chat input. + Fixed pasted text not accounting for caret position. * RE: Cleaned up chat input validation and paste handling * RE: Corrected link in supported_chars.txt * RE: Fixing IME composition input --------- Co-authored-by: 1NFiNITY <109478529+1NFiNITyVOID@users.noreply.github.com> --- Patches/ControlPatch.cs | 18 +++++++--- Patches/TextBoxPatch.cs | 40 ++++++--------------- Resources/supported_chars.txt | 65 +++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 35 deletions(-) create mode 100644 Resources/supported_chars.txt diff --git a/Patches/ControlPatch.cs b/Patches/ControlPatch.cs index 05f806122..a899889e9 100644 --- a/Patches/ControlPatch.cs +++ b/Patches/ControlPatch.cs @@ -114,11 +114,19 @@ internal static class ControllerManagerUpdatePatch if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.C)) ClipboardHelper.PutClipboardString(chat.freeChatField.textArea.text); - - if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.V)) - { - TextBoxPatch.Pasting = true; - chat.freeChatField.textArea.SetText(chat.freeChatField.textArea.text + GUIUtility.systemCopyBuffer.Trim()); + + if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && + Input.GetKeyDown(KeyCode.V)) + { + var textArea = chat.freeChatField.textArea; + + string currentText = textArea.text ?? string.Empty; + string clipboard = GUIUtility.systemCopyBuffer ?? string.Empty; + + int caretPos = Mathf.Clamp(textArea.caretPos, 0, currentText.Length); + + textArea.SetText(currentText.Insert(caretPos, clipboard)); + textArea.caretPos = caretPos + clipboard.Length; } if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.X)) diff --git a/Patches/TextBoxPatch.cs b/Patches/TextBoxPatch.cs index a67eac067..bb678c115 100644 --- a/Patches/TextBoxPatch.cs +++ b/Patches/TextBoxPatch.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using AmongUs.Data; @@ -16,45 +16,25 @@ public static class TextBoxPatch private static TextMeshPro AdditionalInfoText; public static bool IsInvalidCommand; - - private static int CurrentCharPos; - public static bool Pasting; - // from https://github.com/scp222thj/MalumMenu/blob/main/src/Patches/TextBoxTMPPatches.cs - // Well I guess cheat menus sometimes have useful code too.... + [HarmonyPatch(typeof(TextBoxTMP), nameof(TextBoxTMP.IsCharAllowed))] [HarmonyPrefix] - public static bool AllowAllCharacters(TextBoxTMP __instance, ref bool __result) + // Use the character provided by IsCharAllowed directly. + // Tracking a separate character position desyncs when the caret is moved. + public static bool ValidateChatCharacter(char c, ref bool __result) { - string compositionString = Input.compositionString; - if (compositionString.Length > 0) + // Do not interfere with IME composition input. + if (!string.IsNullOrEmpty(Input.compositionString)) { __result = true; return false; } - var input = Pasting ? GUIUtility.systemCopyBuffer.Trim() : Input.inputString; - Pasting = false; - - if (input.Length == 0) - { - __result = true; - return false; - } - - string currentText = __instance.text ?? string.Empty; - int caretPos = Mathf.Clamp(__instance.caretPos, 0, currentText.Length); - string text = currentText.Insert(caretPos, input); - CurrentCharPos = Mathf.Clamp(CurrentCharPos, 0, text.Length - 1); - char currentChar = text[CurrentCharPos]; - - if (CurrentCharPos >= text.Length - 1) CurrentCharPos = 0; - else CurrentCharPos++; - - __result = currentChar is not ('\b' or '\r' or '['); + __result = c is not ('\b' or '\r' or '['); return false; } - + [HarmonyPatch(typeof(TextBoxTMP), nameof(TextBoxTMP.SetText))] [HarmonyPostfix] public static void ShowCommandHelp(TextBoxTMP __instance) @@ -358,4 +338,4 @@ public static class TextBoxPatch if (!__instance.gameObject.HasParentInHierarchy("ChatScreenRoot/ChatScreenContainer")) return; __instance.characterLimit = 1000; } -} \ No newline at end of file +} diff --git a/Resources/supported_chars.txt b/Resources/supported_chars.txt new file mode 100644 index 000000000..fa37148ef --- /dev/null +++ b/Resources/supported_chars.txt @@ -0,0 +1,65 @@ +This serves as a complete* list of all special icons supported by Among Us +Created by quine.fr (https://github.com/VOID4487/EndlessHostRoles/Resources/supported_chars.txt) + +Category: ASCII Symbols +$+<=>^`|~ + +Category: Latin Characters +¢£¤¥¦¨©¬®¯°±²³´¸¹¼½¾×÷ + +Category: Superscripts & Subscripts +⁴ + +Category: Currency Symbols +₩₫€ + +Category: Letter & Number Symbols +℀℃℅℉№℡™℧℮℻ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻ + +Category: Arrows +←↑→↓↔↕↖↗↘↙↸↹⇄⇅⇆⇋⇌⇐⇒⇔⇦⇧⇨⇩⇵➡⤴⤵⬅⬆⬇⮕⽮←↑→↓ + +Category: Math Symbols +∀∂∃∅∆∇∈∉∊∋∏∑−∓∕√∝∞∟∠∣∥∦∧∨∩∪∫∬∭∮∴∵∶∷∽≃≅≈≌≒≠≡≢≤≥≦≧≪≫≮≯≲≳≶≷⊂⊃⊄⊅⊆⊇⊊⊋⊕⊖⊗⊘⊙⊠⊥⊿⋚⋛⋯ + +Category: Technical Symbols +⌅⌆⌇⌒⌘⎰⎱⎾⎿⏀⏁⏂⏃⏄⏅⏆⏇⏈⏉⏊⏋⏌⏎⏚⏛␣ + +Category: Enclosed Characters +①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⓪⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾⓿ + +Category: Box Drawing +─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿ + +Category: Block Elements +▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟ + +Category: Geometric Shapes +■□▢▣▤▥▦▧▨▩▪▫▱▲△▶▷▼▽◀◁◆◇◈◉◊○◌◎●◐◑◒◓◢◣◤◥◦◯ + +Category: Miscellaneous Symbols +☀☁☂☃★☆☉☎☏☖☗☜☝☞☟☯♀♁♂♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♲♳♴♵♶♷♸♹♺♻♼♽⚠⚽⚾ + +Category: Dingbats +✂✓✚✽✿❀❖❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓ + +Category: Extended Symbols & Arrows +⦿⧺⧻⬚ + +Category: CJK Radicals +⺀⺁⺂⺃⺄⺅⺆⺇⺈⺉⺊⺋⺌⺍⺎⺏⺐⺑⺒⺓⺔⺕⺖⺗⺘⺙⺛⺜⺝⺞⺟⺠⺡⺢⺣⺤⺥⺦⺧⺨⺩⺪⺫⺬⺭⺮⺯⺰⺱⺲⺳⺴⺵⺶⺷⺸⺹⺺⺻⺼⺽⺾⺿⻀⻁⻂⻃⻄⻅⻆⻇⻈⻉⻊⻋⻌⻍⻎⻏⻐⻑⻒⻓⻔⻕⻖⻗⻘⻙⻚⻛⻜⻝⻞⻟⻠⻡⻢⻣⻤⻥⻦⻧⻨⻩⻪⻫⻬⻭⻮⻯⻰⻱⻲⻳ + +Category: CJK Symbols +〄〇〒〓〠〡〢〣〤〥〦〧〨〩〶〷〸〹〺〾〿 + +Category: Hiragana +゛゜ + +Category: CJK Compatibility Symbols +㈀㈁㈂㈃㈄㈅㈆㈇㈈㈉㈊㈋㈌㈍㈎㈏㈐㈑㈒㈓㈔㈕㈖㈗㈘㈙㈚㈛㈜㈝㈞㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀㉁㉂㉃㉄㉅㉆㉇㉈㉉㉊㉋㉌㉍㉎㉏㉐㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㉠㉡㉢㉣㉤㉥㉦㉧㉨㉩㉪㉫㉬㉭㉮㉯㉰㉱㉲㉳㉴㉵㉶㉷㉸㉹㉺㉻㉼㉽㉾㉿㊀㊁㊂㊃㊄㊅㊆㊇㊈㊉㊊㊋㊌㊍㊎㊏㊐㊑㊒㊓㊔㊕㊖㊗㊘㊙㊚㊛㊜㊝㊞㊟㊠㊡㊢㊣㊤㊥㊦㊧㊨㊩㊪㊫㊬㊭㊮㊯㊰㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿㋀㋁㋂㋃㋄㋅㋆㋇㋈㋉㋊㋋㋌㋍㋎㋏㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋽㋾㋿㌀㌁㌂㌃㌄㌅㌆㌇㌈㌉㌊㌋㌌㌍㌎㌏㌐㌑㌒㌓㌔㌕㌖㌗㌘㌙㌚㌛㌜㌝㌞㌟㌠㌡㌢㌣㌤㌥㌦㌧㌨㌩㌪㌫㌭㌮㌯㌰㌱㌲㌳㌴㌵㌶㌷㌸㌹㌺㌻㌼㌽㌾㌿㍀㍁㍂㍃㍄㍅㍆㍇㍈㍉㍊㍋㍌㍍㍎㍏㍐㍑㍒㍓㍔㍕㍖㍗㍘㍙㍚㍛㍜㍝㍞㍟㍠㍡㍢㍣㍤㍥㍦㍧㍨㍩㍪㍫㍬㍭㍮㍯㍰㍱㍲㍳㍴㍵㍶㍷㍸㍹㍺㍻㍼㍽㍾㍿㎀㎁㎂㎃㎄㎅㎆㎇㎈㎉㎊㎋㎌㎍㎎㎏㎐㎑㎒㎓㎔㎕㎖㎗㎘㎙㎚㎛㎜㎝㎞㎟㎠㎡㎢㎣㎤㎥㎦㎧㎨㎩㎪㎫㎬㎭㎮㎯㎰㎱㎲㎳㎴㎵㎶㎷㎸㎹㎺㎻㎼㎽㎾㎿㏀㏁㏂㏃㏄㏅㏆㏇㏈㏉㏊㏋㏌㏍㏎㏏㏐㏑㏒㏓㏔㏕㏖㏗㏘㏙㏚㏛㏜㏝㏞㏟㏠㏡㏢㏣㏤㏥㏦㏧㏨㏩㏪㏫㏬㏭㏮㏯㏰㏱㏲㏳㏴㏵㏶㏷㏸㏹㏺㏻㏼㏽㏾㏿ + +Category: Emoji & Pictographs +🄀🄁🄂🄃🄄🄅🄆🄇🄈🄉🄊🄋🄌🄐🄑🄒🄓🄔🄕🄖🄗🄘🄙🄚🄛🄜🄝🄞🄟🄠🄡🄢🄣🄤🄥🄦🄧🄨🄩🄪🄫🄬🄭🄮🄯🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉🅊🅋🅌🅍🅎🅏🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅧🅨🅩🅪🅫🅬🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉🆊🆋🆌🆍🆎🆏🆐🆑🆒🆓🆔🆕🆖🆗🆘🆙🆚🆛🆜🆝🆞🆟🆠🆡🆢🆣🆤🆥🆦🆧🆨🆩🆪🆫🆬🈀🈁🈂🈐🈑🈒🈓🈔🈕🈖🈗🈘🈙🈚🈛🈜🈝🈞🈟🈠🈡🈢🈣🈤🈥🈦🈧🈨🈩🈪🈫🈬🈭🈮🈯🈰🈱🈲🈳🈴🈵🈶🈷🈸🈹🈺🈻🉀🉁🉂🉃🉄🉅🉆🉇🉈🉐🉑 + +Category: Other Symbols +˙˪˫⼀⼁⼂⼃⼄⼅⼆⼇⼈⼉⼊⼋⼌⼍⼎⼏⼐⼑⼒⼓⼔⼕⼖⼗⼘⼙⼚⼛⼜⼝⼞⼟⼠⼡⼢⼣⼤⼥⼦⼧⼨⼩⼪⼫⼬⼭⼮⼯⼰⼱⼲⼳⼴⼵⼶⼷⼸⼹⼺⼻⼼⼽⼾⼿⽀⽁⽂⽃⽄⽅⽆⽇⽈⽉⽊⽋⽌⽍⽎⽏⽐⽑⽒⽓⽔⽕⽖⽗⽘⽙⽚⽛⽜⽝⽞⽟⽠⽡⽢⽣⽤⽥⽦⽧⽨⽩⽪⽫⽬⽭⽯⽰⽱⽲⽳⽴⽵⽶⽷⽸⽹⽺⽻⽼⽽⽾⽿⾀⾁⾂⾃⾄⾅⾆⾇⾈⾉⾊⾋⾌⾍⾎⾏⾐⾑⾒⾓⾔⾕⾖⾗⾘⾙⾚⾛⾜⾝⾞⾟⾠⾡⾢⾣⾤⾥⾦⾧⾨⾩⾪⾫⾬⾭⾮⾯⾰⾱⾲⾳⾴⾵⾶⾷⾸⾹⾺⾻⾼⾽⾾⾿⿀⿁⿂⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌⿍⿎⿏⿐⿑⿒⿓⿔⿕⿰⿱⿲⿳⿴⿵⿶⿷⿸⿹⿺⿻㆐㆑㆒㆓㆔㆕㆖㆗㆘㆙㆚㆛㆜㆝㆞㆟㇀㇁㇂㇃㇄㇅㇆㇇㇈㇉㇊㇋㇌㇍㇎㇏㇐㇑㇒㇓㇔㇕㇖㇗㇘㇙㇚㇛㇜㇝㇞㇟㇠㇡㇢㇣﹢﹤﹥﹦﹩$+<=>^`|~¢£¬ ̄¦¥₩│■○ From 5e88030c9583ce7626759c960a508cbb4a57ef58 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Mon, 7 Sep 2026 12:51:03 +0200 Subject: [PATCH 3/3] untested support for quiz & ctf on li --- Gamemodes/CaptureTheFlag.cs | 92 +++++++++++++++++++++++++++---------- Gamemodes/Quiz.cs | 17 ++++++- 2 files changed, 84 insertions(+), 25 deletions(-) diff --git a/Gamemodes/CaptureTheFlag.cs b/Gamemodes/CaptureTheFlag.cs index 369547b26..18d9d0f73 100644 --- a/Gamemodes/CaptureTheFlag.cs +++ b/Gamemodes/CaptureTheFlag.cs @@ -72,28 +72,62 @@ public static class CaptureTheFlag return TeamData[team.GetOppositeTeam()].FlagCarrier == id; } - private static (Vector2 Position, string RoomName) BlueFlagBase => Main.CurrentMap switch + /*private static (Vector2 Position, string RoomName) BlueFlagBase => Main.CurrentMap switch { - MapNames.Skeld => (new(16.5f, -4.8f), Translator.GetString(SystemTypes.Nav)), - MapNames.MiraHQ => (new(-4.5f, 2.0f), Translator.GetString(SystemTypes.Launchpad)), + MapNames.Skeld => (, Translator.GetString(SystemTypes.Nav)), + MapNames.MiraHQ => (, Translator.GetString(SystemTypes.Launchpad)), MapNames.Dleks => (new(-16.5f, -4.8f), Translator.GetString(SystemTypes.Nav)), - MapNames.Polus => (new(9.5f, -12.5f), Translator.GetString(SystemTypes.Electrical)), - MapNames.Airship => (new(-23.5f, -1.6f), Translator.GetString(SystemTypes.Cockpit)), - MapNames.Fungle => (new(-15.5f, -7.5f), Translator.GetString(SystemTypes.Kitchen)), - (MapNames)6 => (new(-13.31f, -34.56f), Translator.GetString(SystemTypes.Engine)), + MapNames.Polus => (, Translator.GetString(SystemTypes.Electrical)), + MapNames.Airship => (, Translator.GetString(SystemTypes.Cockpit)), + MapNames.Fungle => (, Translator.GetString(SystemTypes.Kitchen)), + (MapNames)6 => (, Translator.GetString(SystemTypes.Engine)), _ => (Vector2.zero, string.Empty) }; private static (Vector2 Position, string RoomName) YellowFlagBase => Main.CurrentMap switch { - MapNames.Skeld => (new(-20.5f, -5.5f), Translator.GetString(SystemTypes.Reactor)), - MapNames.MiraHQ => (new(17.8f, 23.0f), Translator.GetString(SystemTypes.Greenhouse)), + MapNames.Skeld => (, Translator.GetString(SystemTypes.Reactor)), + MapNames.MiraHQ => (, Translator.GetString(SystemTypes.Greenhouse)), MapNames.Dleks => (new(20.5f, -5.5f), Translator.GetString(SystemTypes.Reactor)), - MapNames.Polus => (new(36.5f, -7.5f), Translator.GetString(SystemTypes.Laboratory)), - MapNames.Airship => (new(33.5f, -1.5f), Translator.GetString(SystemTypes.CargoBay)), - MapNames.Fungle => (new(22.2f, 13.7f), Translator.GetString(SystemTypes.Comms)), - (MapNames)6 => (new(12.98f, -25.68f), Translator.GetString(SystemTypes.Comms)), + MapNames.Polus => (, Translator.GetString(SystemTypes.Laboratory)), + MapNames.Airship => (, Translator.GetString(SystemTypes.CargoBay)), + MapNames.Fungle => (, Translator.GetString(SystemTypes.Comms)), + (MapNames)6 => (, Translator.GetString(SystemTypes.Comms)), _ => (Vector2.zero, string.Empty) + };*/ + + private static readonly Dictionary> FlagBases = new() + { + [MapNames.Skeld] = new() + { + [CTFTeam.Blue] = (new(16.5f, -4.8f), SystemTypes.Nav), + [CTFTeam.Yellow] = (new(-20.5f, -5.5f), SystemTypes.Reactor) + }, + [MapNames.MiraHQ] = new() + { + [CTFTeam.Blue] = (new(-4.5f, 2.0f), SystemTypes.Launchpad), + [CTFTeam.Yellow] = (new(17.8f, 23.0f), SystemTypes.Greenhouse) + }, + [MapNames.Polus] = new() + { + [CTFTeam.Blue] = (new(9.5f, -12.5f), SystemTypes.Electrical), + [CTFTeam.Yellow] = (new(36.5f, -7.5f), SystemTypes.Laboratory) + }, + [MapNames.Airship] = new() + { + [CTFTeam.Blue] = (new(-23.5f, -1.6f), SystemTypes.Cockpit), + [CTFTeam.Yellow] = (new(33.5f, -1.5f), SystemTypes.CargoBay) + }, + [MapNames.Fungle] = new() + { + [CTFTeam.Blue] = (new(-15.5f, -7.5f), SystemTypes.Kitchen), + [CTFTeam.Yellow] = (new(22.2f, 13.7f), SystemTypes.Comms) + }, + [(MapNames)6] = new() + { + [CTFTeam.Blue] = (new(-13.31f, -34.56f), SystemTypes.Engine), + [CTFTeam.Yellow] = (new(12.98f, -25.68f), SystemTypes.Comms) + }, }; public static void SetupCustomOption() @@ -352,6 +386,21 @@ public static class CaptureTheFlag Main.AllPlayerKillCooldown.SetAllValues(TagCooldown.GetFloat()); yield return new WaitForSecondsRealtime(3f); + + if (Main.LIMap) + { + PlainShipRoom[] rooms = ShipStatus.Instance.AllRooms.Where(x => x).DistinctBy(x => x.RoomId).ToArray(); + PlainShipRoom[] chosen = rooms.Select(plainShipRoom => + { + KeyValuePair furthestRoom = rooms.Select(x => new KeyValuePair(x, Vector2.Distance(x.transform.position, plainShipRoom.transform.position))).MaxBy(x => x.Value); + return new KeyValuePair([furthestRoom.Key, plainShipRoom], furthestRoom.Value); + }).MaxBy(x => x.Value).Key; + FlagBases[(MapNames)7] = new() + { + [CTFTeam.Blue] = (chosen[0].transform.position, chosen[0].RoomId), + [CTFTeam.Yellow] = (chosen[1].transform.position, chosen[1].RoomId) + }; + } Stopwatch stopwatch = Stopwatch.StartNew(); @@ -383,8 +432,8 @@ public static class CaptureTheFlag } // Create flags - (Vector2 Position, string RoomName) blueFlagBase = BlueFlagBase; - (Vector2 Position, string RoomName) yellowFlagBase = YellowFlagBase; + (Vector2 Position, SystemTypes Room) blueFlagBase = CTFTeam.Blue.GetFlagBase(); + (Vector2 Position, SystemTypes Room) yellowFlagBase = CTFTeam.Yellow.GetFlagBase(); CustomNetObject blueFlag = new BlueFlag(blueFlagBase.Position); CustomNetObject yellowFlag = new YellowFlag(yellowFlagBase.Position); @@ -402,11 +451,11 @@ public static class CaptureTheFlag { case CTFTeam.Blue: pc.TP(blueFlagBase.Position); - pc.Notify(string.Format(Translator.GetString("CTF_Notify_EnemyTeamRoom"), yellowFlagBase.RoomName)); + pc.Notify(string.Format(Translator.GetString("CTF_Notify_EnemyTeamRoom"), Translator.GetString(yellowFlagBase.Room))); break; case CTFTeam.Yellow: pc.TP(yellowFlagBase.Position); - pc.Notify(string.Format(Translator.GetString("CTF_Notify_EnemyTeamRoom"), blueFlagBase.RoomName)); + pc.Notify(string.Format(Translator.GetString("CTF_Notify_EnemyTeamRoom"), Translator.GetString(blueFlagBase.Room))); break; } } @@ -622,14 +671,9 @@ public static class CaptureTheFlag }; } - private (Vector2 Position, string RoomName) GetFlagBase() + private (Vector2 Position, SystemTypes Room) GetFlagBase() { - return team switch - { - CTFTeam.Blue => BlueFlagBase, - CTFTeam.Yellow => YellowFlagBase, - _ => (Vector2.zero, string.Empty) - }; + return FlagBases[Main.CurrentMap][team]; } } diff --git a/Gamemodes/Quiz.cs b/Gamemodes/Quiz.cs index a7f744bcd..e18845ead 100644 --- a/Gamemodes/Quiz.cs +++ b/Gamemodes/Quiz.cs @@ -274,7 +274,22 @@ public static class Quiz NoSuffix = true; var aapc = Main.AllAlivePlayerControlsToList; - bool showTutorial = !SubmergedCompatibility.IsSubmerged() && aapc.ExceptBy(HasPlayedFriendCodes, x => x.FriendCode).Count() > aapc.Count / 2; + bool showTutorial = !SubmergedCompatibility.IsSubmerged() && !Main.LIMap && aapc.ExceptBy(HasPlayedFriendCodes, x => x.FriendCode).Count() > aapc.Count / 2; + + if (Main.LIMap) + { + PlainShipRoom[] rooms = ShipStatus.Instance.AllRooms.Where(x => x).DistinctBy(x => x.RoomId).ToArray(); + List chosen = rooms.Select(plainShipRoom => + { + Dictionary closestRooms = rooms.Select(x => new KeyValuePair(x.RoomId, Vector2.Distance(plainShipRoom.transform.position, x.transform.position))).OrderBy(x => x.Value).Take(4).ToDictionary(x => x.Key, x => x.Value); + float sum = closestRooms.Values.Sum(); + return new KeyValuePair([.. closestRooms.Keys, plainShipRoom.RoomId], sum); + }).MinBy(x => x.Value).Key.ToList(); + Dictionary dict = []; + for (char c = 'A'; c <= 'E'; c++) + dict[c] = chosen[c - 'A']; + UsedRooms[(MapNames)7] = dict; + } var usedRooms = UsedRooms[Main.CurrentMap].Join('\n', x => $"{x.Key}: {GetString(x.Value.ToString())}"); aapc.NotifyPlayers(string.Format(GetString("Quiz.Tutorial.Basics"), usedRooms), 11f);