small fixes

This commit is contained in:
Gurge44 committed 2026-02-14 11:29:06 +01:00
1 parent cff04365b4
commit e015c9e2cb
5 files changed
+92 -81

No files matched your search

+3
View File
@@ -1708,6 +1708,7 @@ internal static class CustomRolesHelper
CustomRoles.Escapist => RoleOptionType.Impostor_Concealing,
CustomRoles.Exclusionary => RoleOptionType.Impostor_Concealing,
CustomRoles.Fabricator => RoleOptionType.Impostor_Concealing,
CustomRoles.Fakeshifter => RoleOptionType.Impostor_Concealing,
CustomRoles.Forger => RoleOptionType.Impostor_Concealing,
CustomRoles.Hangman => RoleOptionType.Impostor_Concealing,
CustomRoles.Kidnapper => RoleOptionType.Impostor_Concealing,
@@ -1870,11 +1871,13 @@ internal static class CustomRolesHelper
CustomRoles.Monarch => RoleOptionType.Crewmate_Support,
CustomRoles.Negotiator => RoleOptionType.Crewmate_Support,
CustomRoles.Rhapsode => RoleOptionType.Crewmate_Support,
CustomRoles.Scanner => RoleOptionType.Crewmate_Support,
CustomRoles.SecurityGuard => RoleOptionType.Crewmate_Support,
CustomRoles.SpeedBooster => RoleOptionType.Crewmate_Support,
CustomRoles.TimeManager => RoleOptionType.Crewmate_Support,
CustomRoles.TimeMaster => RoleOptionType.Crewmate_Support,
CustomRoles.Transporter => RoleOptionType.Crewmate_Support,
CustomRoles.Unshifter => RoleOptionType.Crewmate_Support,
CustomRoles.Ventguard => RoleOptionType.Crewmate_Support,
CustomRoles.Wizard => RoleOptionType.Crewmate_Support,
CustomRoles.Drainer => RoleOptionType.Crewmate_Killing,
+2 -2
View File
@@ -1585,8 +1585,8 @@ internal static class ExtendedPlayerControl
public static void RpcMakeInvisible(this PlayerControl player, bool phantom = false)
{
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.Invisible.Add(player.PlayerId)) return;
if (phantom && Options.CurrentGameMode != CustomGameMode.Standard) return;
if (!Main.Invisible.Add(player.PlayerId)) return;
player.RpcSetPet("");
@@ -1634,8 +1634,8 @@ internal static class ExtendedPlayerControl
public static void RpcMakeVisible(this PlayerControl player, bool phantom = false)
{
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.Invisible.Remove(player.PlayerId)) return;
if (phantom && Options.CurrentGameMode != CustomGameMode.Standard) return;
if (!Main.Invisible.Remove(player.PlayerId)) return;
if (Options.UsePets.GetBool()) PetsHelper.SetPet(player, PetsHelper.GetPetId());
+7 -3
View File
@@ -232,11 +232,15 @@ public abstract class OptionItem
public bool IsCurrentlyHidden()
{
for (OptionItem current = this; current != null; current = current.Parent)
try
{
if (Hidden(current))
return true;
for (OptionItem current = this; current != null; current = current.Parent)
{
if (Hidden(current))
return true;
}
}
catch (Exception e) { Utils.ThrowException(e); }
return false;
+78 -74
View File
@@ -140,84 +140,88 @@ public static class GameOptionsMenuPatch
foreach (var option in OptionItem.AllOptions)
{
if (option.Tab != modTab) continue;
bool enabled = !option.IsCurrentlyHidden() && AllParentsEnabledAndVisible(option.Parent);
if (option is TextOptionItem toi)
{
CategoryHeaderMasked categoryHeaderMasked = Object.Instantiate(__instance.categoryHeaderOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer);
categoryHeaderMasked.SetHeader(StringNames.RolesCategory, 20);
categoryHeaderMasked.Title.text = option.GetName(disableColor: true).Trim('★', ' ');
categoryHeaderMasked.Background.color = categoryHeaderMasked.Divider.color = option.NameColor;
categoryHeaderMasked.transform.localScale = Vector3.one * 0.63f;
categoryHeaderMasked.transform.localPosition = new(-0.903f, num, posZ);
var chmText = categoryHeaderMasked.transform.FindChild("HeaderText").GetComponent<TextMeshPro>();
chmText.fontStyle = FontStyles.Bold | FontStyles.SmallCaps;
chmText.fontWeight = FontWeight.Black;
chmText.outlineWidth = 0.17f;
var chmCollider = categoryHeaderMasked.gameObject.AddComponent<BoxCollider2D>();
chmCollider.size = new Vector2(7, 0.7f);
chmCollider.offset = new Vector2(1.5f, -0.3f);
var chmButton = categoryHeaderMasked.gameObject.AddComponent<PassiveButton>();
chmButton.ClickSound = __instance.BackButton.GetComponent<PassiveButton>().ClickSound;
chmButton.OnMouseOver = new();
chmButton.OnMouseOut = new();
chmButton.OnClick.AddListener((UnityAction)(() =>
{
toi.CollapsesSection = !toi.CollapsesSection;
ReCreateSettings(__instance);
}));
chmButton.SetButtonEnableState(true);
categoryHeaderMasked.gameObject.SetActive(enabled);
ModGameOptionsMenu.CategoryHeaderList.TryAdd(option.Id, categoryHeaderMasked);
if (enabled) num -= 0.63f;
header = toi;
continue;
}
option.Header = header;
if (option.IsHeader && enabled)
num -= 0.18f;
BaseGameSetting baseGameSetting = GetSetting(option);
if (baseGameSetting == null) continue;
OptionBehaviour optionBehaviour;
try
{
optionBehaviour = baseGameSetting.Type switch
if (option.Tab != modTab) continue;
bool enabled = !option.IsCurrentlyHidden() && AllParentsEnabledAndVisible(option.Parent);
if (option is TextOptionItem toi)
{
OptionTypes.Checkbox => Object.Instantiate(__instance.checkboxOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
OptionTypes.String => Object.Instantiate(__instance.stringOptionOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
OptionTypes.Float or OptionTypes.Int => Object.Instantiate(__instance.numberOptionOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
_ => throw new Exception("Skipped option type")
};
CategoryHeaderMasked categoryHeaderMasked = Object.Instantiate(__instance.categoryHeaderOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer);
categoryHeaderMasked.SetHeader(StringNames.RolesCategory, 20);
categoryHeaderMasked.Title.text = option.GetName(disableColor: true).Trim('★', ' ');
categoryHeaderMasked.Background.color = categoryHeaderMasked.Divider.color = option.NameColor;
categoryHeaderMasked.transform.localScale = Vector3.one * 0.63f;
categoryHeaderMasked.transform.localPosition = new(-0.903f, num, posZ);
var chmText = categoryHeaderMasked.transform.FindChild("HeaderText").GetComponent<TextMeshPro>();
chmText.fontStyle = FontStyles.Bold | FontStyles.SmallCaps;
chmText.fontWeight = FontWeight.Black;
chmText.outlineWidth = 0.17f;
var chmCollider = categoryHeaderMasked.gameObject.AddComponent<BoxCollider2D>();
chmCollider.size = new Vector2(7, 0.7f);
chmCollider.offset = new Vector2(1.5f, -0.3f);
var chmButton = categoryHeaderMasked.gameObject.AddComponent<PassiveButton>();
chmButton.ClickSound = __instance.BackButton.GetComponent<PassiveButton>().ClickSound;
chmButton.OnMouseOver = new();
chmButton.OnMouseOut = new();
chmButton.OnClick.AddListener((UnityAction)(() =>
{
toi.CollapsesSection = !toi.CollapsesSection;
ReCreateSettings(__instance);
}));
chmButton.SetButtonEnableState(true);
categoryHeaderMasked.gameObject.SetActive(enabled);
ModGameOptionsMenu.CategoryHeaderList.TryAdd(option.Id, categoryHeaderMasked);
if (enabled) num -= 0.63f;
header = toi;
continue;
}
option.Header = header;
if (option.IsHeader && enabled)
num -= 0.18f;
BaseGameSetting baseGameSetting = GetSetting(option);
if (baseGameSetting == null) continue;
OptionBehaviour optionBehaviour;
try
{
optionBehaviour = baseGameSetting.Type switch
{
OptionTypes.Checkbox => Object.Instantiate(__instance.checkboxOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
OptionTypes.String => Object.Instantiate(__instance.stringOptionOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
OptionTypes.Float or OptionTypes.Int => Object.Instantiate(__instance.numberOptionOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer),
_ => throw new Exception("Skipped option type")
};
}
catch { continue; }
optionBehaviour.transform.localPosition = new(posX, num, posZ);
OptionBehaviourSetSizeAndPosition(optionBehaviour, option, baseGameSetting.Type);
if (!ModGameOptionsMenu.OptionList.ContainsValue(option.Id) && option.Name == "Preset")
GameSettingMenuPatch.PresetBehaviour = (NumberOption)optionBehaviour;
optionBehaviour.transform.localPosition = new(0.952f, num, -2f);
optionBehaviour.SetClickMask(__instance.ButtonClickMask);
optionBehaviour.SetUpFromData(baseGameSetting, 20);
ModGameOptionsMenu.OptionList.TryAdd(optionBehaviour.GetHashCode(), option.Id);
ModGameOptionsMenu.BehaviourList.TryAdd(option.Id, optionBehaviour);
optionBehaviour.gameObject.SetActive(enabled);
optionBehaviour.OnValueChanged = new Action<OptionBehaviour>(__instance.ValueChanged);
__instance.Children.Add(optionBehaviour);
option.OptionBehaviour = optionBehaviour;
if (enabled) num -= 0.45f;
}
catch { continue; }
optionBehaviour.transform.localPosition = new(posX, num, posZ);
OptionBehaviourSetSizeAndPosition(optionBehaviour, option, baseGameSetting.Type);
if (!ModGameOptionsMenu.OptionList.ContainsValue(option.Id) && option.Name == "Preset")
GameSettingMenuPatch.PresetBehaviour = (NumberOption)optionBehaviour;
optionBehaviour.transform.localPosition = new(0.952f, num, -2f);
optionBehaviour.SetClickMask(__instance.ButtonClickMask);
optionBehaviour.SetUpFromData(baseGameSetting, 20);
ModGameOptionsMenu.OptionList.TryAdd(optionBehaviour.GetHashCode(), option.Id);
ModGameOptionsMenu.BehaviourList.TryAdd(option.Id, optionBehaviour);
optionBehaviour.gameObject.SetActive(enabled);
optionBehaviour.OnValueChanged = new Action<OptionBehaviour>(__instance.ValueChanged);
__instance.Children.Add(optionBehaviour);
option.OptionBehaviour = optionBehaviour;
if (enabled) num -= 0.45f;
catch (Exception e) { Utils.ThrowException(e); }
if (stopwatch.ElapsedMilliseconds >= frameBudget)
{
+2 -2
View File
@@ -1522,7 +1522,7 @@
"UndercoverInfoLong": "(Crewmates):\\nThe Impostors knows who Undercover is and sees him as a teammate, but Undercover himself does not know who the Impostors are.",
"Unshifter": "Unshifter",
"UnshifterInfo": "Unshift Shapeshifted Players",
"UnshifterInfoLong": "(Crewmates)\nAs the Unshifter(Credits to Dechis), you may use your kill button on someone to unshift them if they are shapeshifted. Using the kill button in Non-Shifted players does nothing but a message. Depending on settings, the target may receive a notification.",
"UnshifterInfoLong": "(Crewmates):\\nAs the Unshifter, you may use your kill button on someone to unshift them if they are shapeshifted. Using the kill button in Non-Shifted players does nothing but a message. Depending on settings, the target may receive a notification.\\n<size=50%>Credit: Dechis</size>",
"UnshifterCooldown": "Unshift Cooldown",
"UnshifterUseLimit": "Maximum Unshift Attempts",
"UnshifterTargetKnows": "Target Knows they're being unshifted",
@@ -1844,7 +1844,7 @@
"Fabricator.SetDeathReason": "<#00ff00>✓ <#00bb00>Your next kill will have the death reason: <#ffffff>{0}</color>",
"Fakeshifter": "Fakeshifter",
"FakeshifterInfo": "Make a Player Fake-Shapeshift",
"FakeshifterInfoLong": "(Impostors):\nAs the Fakeshifter, you can use your shapeshift menu to mark a player. That player will appear for everyone, except themselves, as a random player. After some time, that same player will shapeshift back to their original appearance, and play the egg animation for everyone.",
"FakeshifterInfoLong": "(Impostors):\\nAs the Fakeshifter, you can use your shapeshift menu to mark a player. That player will appear for everyone, except themselves, as a random player. After some time, that same player will shapeshift back to their original appearance, and play the egg animation for everyone.",
"FakeshifterAbilityDuration": "Delay for the target to shapeshift back",
"Fireworker": "Fireworker",
"FireworkerInfo": "Go out with a BANG",