Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bugs #192

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions TONX/Patches/GameOptionsMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,6 @@ private static void UpdateOption(ref bool isOdd, OptionItem item, ref float offs
}

item.OptionBehaviour.gameObject.SetActive(enabled);
if (item is TextOptionItem)
{
foreach (var button in stringOption.GetComponentsInChildren<PassiveButton>())
{
button.gameObject.SetActive(false);
}
stringOption.LabelBackground.gameObject.SetActive(false);
stringOption.ValueText.gameObject.SetActive(false);
// stringOption.TitleText.gameObject.SetActive(true);

}

if (enabled)
{
Expand All @@ -314,6 +303,8 @@ private static void UpdateOption(ref bool isOdd, OptionItem item, ref float offs
offset,
-2f);

stringOption.ValueText.text = item.GetString();

isOdd = !isOdd;
}
}
Expand All @@ -329,7 +320,17 @@ public static bool Prefix(StringOption __instance)
var option = OptionItem.AllOptions.FirstOrDefault(opt => opt.OptionBehaviour == __instance);
if (option == null) return true;

if (option is TextOptionItem) option.OptionBehaviour.ValueText.gameObject.SetActive(false);
if (option is TextOptionItem)
{
foreach (var button in option.OptionBehaviour.GetComponentsInChildren<PassiveButton>())
{
button.gameObject.SetActive(false);
}
option.OptionBehaviour.LabelBackground.gameObject.SetActive(false);
option.OptionBehaviour.ValueText.gameObject.SetActive(false);
// stringOption.TitleText.gameObject.SetActive(true);
}

__instance.OnValueChanged = new Action<OptionBehaviour>((o) => { });
__instance.TitleText.text = option.GetName(option is RoleSpawnChanceOptionItem);
__instance.Value = __instance.oldValue = option.CurrentValue;
Expand Down
24 changes: 12 additions & 12 deletions TONX/Roles/Crewmate/Sheriff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using TONX.Roles.Core;
using TONX.Roles.Core.Interfaces;
using TONX.Roles.Neutral;
using TONX.Roles.Neutral;
using UnityEngine;
using static TONX.Translator;

Expand All @@ -22,7 +22,7 @@ public sealed class Sheriff : RoleBase, IKiller, ISchrodingerCatOwner
SetupOptionItem,
"sh|警長",
"#f8cd46",
true,
true,
introSound: () => GetIntroSound(RoleTypes.Crewmate)
);
public Sheriff(PlayerControl player)
Expand Down Expand Up @@ -97,7 +97,7 @@ public static void SetUpNeutralOptions(int idOffset)
foreach (var neutral in CustomRolesHelper.AllStandardRoles.Where(x => x.IsNeutral()).ToArray())
{
if (neutral is CustomRoles.SchrodingerCat) continue;
SetUpKillTargetOption(neutral, idOffset, true, CanKillNeutrals);
SetUpKillTargetOption(neutral, idOffset, true, CanKillNeutralsMode);
idOffset++;
}
foreach (var catType in EnumHelper.GetAllValues<SchrodingerCat.TeamType>())
Expand All @@ -106,7 +106,7 @@ public static void SetUpNeutralOptions(int idOffset)
{
continue;
}
SetUpSchrodingerCatKillTargetOption(catType, idOffset, true, CanKillNeutrals);
SetUpSchrodingerCatKillTargetOption(catType, idOffset, true, CanKillNeutralsMode);
idOffset++;
}
}
Expand Down Expand Up @@ -168,19 +168,19 @@ public bool OnCheckMurderAsKiller(MurderInfo info)
if (ShotLimit <= 0) return false;
ShotLimit--;
SendRPC();
if (!killer.Is(CustomRoles.Madmate) ?
CanBeKilledBy(target) :
(!SetMadCanKill.GetBool() ||
(target.GetCustomRole().IsCrewmate() && MadCanKillCrew.GetBool()) ||
(target.GetCustomRole().IsNeutral() && MadCanKillNeutral.GetBool()) ||
(target.GetCustomRole().IsImpostor() && MadCanKillImp.GetBool())
if (!killer.Is(CustomRoles.Madmate) ?
CanBeKilledBy(target) :
(!SetMadCanKill.GetBool() ||
(target.GetCustomRole().IsCrewmate() && MadCanKillCrew.GetBool()) ||
(target.GetCustomRole().IsNeutral() && MadCanKillNeutral.GetBool()) ||
(target.GetCustomRole().IsImpostor() && MadCanKillImp.GetBool())
))
{
killer.ResetKillCooldown();
return true;
}
PlayerState.GetByPlayerId(killer.PlayerId).DeathReason = CustomDeathReason.Misfire;
killer.RpcMurderPlayer(killer);
PlayerState.GetByPlayerId(killer.PlayerId).DeathReason = CustomDeathReason.Misfire;
killer.RpcMurderPlayer(killer);
if (!MisfireKillsTarget.GetBool()) return false;
}
return true;
Expand Down
Loading