Skip to content

Commit

Permalink
添加禁用破坏选项
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Oct 25, 2024
1 parent f648e00 commit 0900514
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 18 deletions.
Binary file modified Strings.xlsx
Binary file not shown.
6 changes: 4 additions & 2 deletions TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ public static void enableCursor(bool initalSetCursor)
public static bool roleCanSabotage(this PlayerControl player)
{
var roleCouldUse = false;
if (Jackal.canSabotage && (player == Jackal.jackal || player == Sidekick.sidekick || Jackal.formerJackals.Contains(player)))
if (Jackal.canSabotage && (player == Jackal.jackal || player == Sidekick.sidekick || Jackal.formerJackals.Contains(player)) && !ModOption.disableSabotage)
roleCouldUse = true;
if (player.Data?.Role != null && player.Data.Role.IsImpostor)
if (Pavlovsdogs.canSabotage && (player == Pavlovsdogs.pavlovsowner || Pavlovsdogs.pavlovsdogs.Any(p => p == player)) && !ModOption.disableSabotage)
roleCouldUse = true;
if (player.Data?.Role != null && player.Data.Role.IsImpostor && !ModOption.disableSabotage)
roleCouldUse = true;
return roleCouldUse;
}
Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/Options/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ public class CustomOptionHolder
public static CustomOption allowModGuess;
public static CustomOption ghostSpeed;
public static CustomOption finishTasksBeforeHauntingOrZoomingOut;
public static CustomOption disableSabotage;
public static CustomOption camsNightVision;
public static CustomOption camsNoNightVisionIfImpVision;

Expand Down Expand Up @@ -768,6 +769,7 @@ public static void Load()
blockGameEnd = Create(29, Types.General, cs(Color.yellow, "blockGameEnd"), true);
deadImpsBlockSabotage = Create(32, Types.General, cs(Palette.ImpostorRed, "deadImpsBlockSabotage"), false);
randomLigherPlayer = Create(34, Types.General, "randomLigherPlayer", true);
disableSabotage = Create(35, Types.General, cs(Palette.ImpostorRed, "disableSabotage"), false, enableMapOptions);
allowModGuess = Create(31, Types.General, "allowModGuess", false);
//ghostSpeed = Create(33, Types.General, "ghostSpeed", 1f, 0.75f, 5f, 0.125f);

Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/Options/ModOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ internal class ModOption
public static bool disableCamsRoundOne;
public static bool isRoundOne = true;
public static bool camoComms;
public static bool disableSabotage;
public static bool fungleDisableCamoComms;
public static bool randomGameStartPosition;
public static bool allowModGuess;
Expand Down Expand Up @@ -115,6 +116,7 @@ public static void clearAndReloadMapOptions()
randomLigherPlayer = CustomOptionHolder.randomLigherPlayer.getBool();
allowModGuess = CustomOptionHolder.allowModGuess.getBool();
CursedTasks = CustomOptionHolder.enableCursedTasks.getBool();
disableSabotage = CustomOptionHolder.disableSabotage.getBool();
firstKillPlayer = null;
isRoundOne = true;
isCanceled = false;
Expand Down
9 changes: 9 additions & 0 deletions TheOtherRoles/Patches/UsablesPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ public static bool Prefix(Vent __instance)
}
}

[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.UpdateSystem), [typeof(SystemTypes), typeof(PlayerControl), typeof(byte)])]
internal class UpdateSystemPatch
{
public static bool Prefix(ShipStatus __instance)
{
return !disableSabotage;
}
}

[HarmonyPatch(typeof(Vent), nameof(Vent.Use))]
public static class VentUsePatch
{
Expand Down
40 changes: 24 additions & 16 deletions TheOtherRoles/Resources/stringData.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@
"0": "Block Dead Impostor From Sabotaging",
"13": "伪装者死亡后不能破坏"
},
"disableSabotage": {
"13": "禁用破坏功能"
},
"randomLigherPlayer": {
"13": "随机判断玩家深浅色\n( 不会影响角色外观)"
},
Expand Down Expand Up @@ -2369,27 +2372,32 @@
"0": "YOU ARE BLACKMAILED",
"13": "嘘!不许说话!"
},
"differentVersionTou": {
"0": "has a different or no version of The Other Us",
"13": "安装了不同版本的TheOtherUs"
"errorNotInstalled": {
"0": "{0} has a different or no version of GMIA",
"11": "{0} TheOtherRolesGMIAのバージョンが違うか、導入されていません!",
"13": "{0} 安装了不同版本的TheOtherUs"
},
"oldTouVersion": {
"0": "has an older version of The Other Us",
"13": "安装了旧版本的TheOtherUs"
"errorOlderVersion": {
"0": "{0} has an older version of GMIA",
"11": "{0} 古いバージョンのTheOtherRolesGMIAを導入しています!",
"13": "{0} 安装了旧版本的TheOtherUs"
},
"newTouVersion": {
"0": "has a newer version of The Other Us",
"13": "安装了较新版本的TheOtherUs"
"errorNewerVersion": {
"0": "{0} has a newer version of GMIA",
"11": "{0} 最新バージョンのTheOtherRolesを導入しています",
"13": "{0} 安装了较新版本的TheOtherUs"
},
"modifiedTouVersion": {
"0": "has a modified version of TOU",
"13": "安装了修改过的TheOtherUs"
"errorWrongVersion": {
"0": "{0} has a modified version of GMIA",
"11": "{0} TORGMIAのバージョンが変更されています",
"13": "{0} 安装了修改过的TheOtherUs"
},
"HostNoTou": {
"0": "The host has no or a different version of The Other Us\nYou will be kicked in",
"13": "房主没有或不同版本的TheOtherUs\n即将被踢出房间"
"errorHostNoVersion": {
"0": "The host has no or a different version of GMIA\nYou will be kicked in {0}s",
"11": "ホストにTORGMIAが導入されてないかバージョンが違います\n{0}秒後に自動キックされます!!",
"13": "房主没有或不同版本的TheOtherUs\n即将被踢出房间 {0}"
},
"DifferentTouVersions": {
"errorDifferentVersion": {
"0": "Players With Different Versions:",
"13": "装了不同版本模组的玩家:"
},
Expand Down

0 comments on commit 0900514

Please sign in to comment.