Skip to content

Commit 198b9b8

Browse files
committed
v5.0.2 Source Code
1 parent 84de769 commit 198b9b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+646
-228
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
8484
# Releases
8585
| Among Us - Version| Mod Version | Link |
8686
|----------|-------------|-----------------|
87+
| 2023.7.12s & 2023.7.12e | v5.0.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.2/ToU.v5.0.2.zip) |
8788
| 2023.6.13s & 2023.6.13e | v5.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.1/ToU.v5.0.1.zip) |
8889
| 2023.6.13s & 2023.6.13e | v5.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.0/ToU.v5.0.0.zip) |
8990
| 2023.3.28s & 2023.3.28e | v4.0.6 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.6/ToU.v4.0.6.zip) |
@@ -145,11 +146,19 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
145146
<details>
146147
<summary> Changelog </summary>
147148
<details>
149+
<summary> v5.0.2 </summary>
150+
<ul> <li>Compatibility with the new Among Us version v2023.7.12</li> </ul>
151+
<ul> <li>New Setting: Detective can detect last killer</li> </ul>
152+
<ul> <li>New Setting: Neutral Evil Win Ends Game</li> </ul>
153+
<ul> <li>New Settings: Neutral Evils can kill players on victory</li> </ul>
154+
</details>
155+
<details>
148156
<summary> v5.0.1 </summary>
149157
<ul> <li>Bug Fix: Airship Ladders work again</li> </ul>
150158
</details>
151159
<details>
152160
<summary> v5.0.0 </summary>
161+
<ul> <li>Compatibility with the new Among Us version v2023.6.13</li> </ul>
153162
<ul> <li>New Role: Doomsayer</li> </ul>
154163
<ul> <li>New Role: Vampire</li> </ul>
155164
<ul> <li>New Role: Vampire Hunter</li> </ul>
@@ -787,6 +796,7 @@ If the killer of the inspected player dies, the following round the examine butt
787796
| Show Detective Reports | Whether the Detective should get information when reporting a body | Toggle | True |
788797
| Time Where Detective Reports Will Have Role | If a body has been dead for shorter than this amount, the Detective's report will contain the killer's role | Time | 15s |
789798
| Time Where Detective Reports Will Have Faction | If a body has been dead for shorter than this amount, the Detective's report will contain the killer's faction | Time | 30s |
799+
| Can Detect Last Killer | Whether the Detective can also detect the last player who killed (resets on round start) | Toggle | False |
790800

791801
-----------------------
792802
## Haunter
@@ -1245,6 +1255,7 @@ If that player gets voted out, they win the game.
12451255
| Executioner | The percentage probability of the Executioner appearing | Percentage | 0% |
12461256
| Executioner becomes on Target Dead | Which role the Executioner becomes when their target dies | Crewmate / Amnesiac / Survivor / Jester | Crewmate |
12471257
| Executioner Can Button | Whether the Executioner Can Press the Button | Toggle | True |
1258+
| Executioner Torment On Victory | Whether the Executioner can torment someone when they win | Toggle | True |
12481259

12491260
-----------------------
12501261
## Jester
@@ -1260,6 +1271,7 @@ However, the Jester does not win if the Crewmates, Impostors or another Neutral
12601271
| Jester Can Button | Whether the Jester Can Press the Button | Toggle | True |
12611272
| Jester Can Vent | Whether the Jester Can Vent | Toggle | False |
12621273
| Jester Has Impostor Vision | Whether the Jester Has Impostor Vision | Toggle | False |
1274+
| Jester Haunt On Victory | Whether the Jester can haunt someone when they win | Toggle | True |
12631275

12641276
-----------------------
12651277
## Phantom
@@ -1272,6 +1284,7 @@ They become half-invisible when they die and has to complete all their tasks wit
12721284
|----------|:-------------:|:------:|:------:|
12731285
| Phantom | The percentage probability of the Phantom appearing | Percentage | 0% |
12741286
| When Phantom Can Be Clicked | The amount of tasks remaining when the Phantom Can Be Clicked | Number | 5 |
1287+
| Phantom Spook On Victory | Whether the Phantom can spook someone when they win | Toggle | True |
12751288

12761289
-----------------------
12771290
## Arsonist
@@ -1837,6 +1850,7 @@ When they are the only remaining Impostor, they will have their kill cooldown sh
18371850
| Disable Meeting Skip Button | Whether the meeting button is disabled | No / Emergency / Always | No |
18381851
| Enable Hidden Roles | Whether hidden roles are added to the role selections | Toggle | True |
18391852
| First Death Shield Next Game | Whether the first player to die gets a shield for the first round next game | Toggle | False |
1853+
| Neutral Evils Win Ends Game | Whether a Neutral Evil role winning ends the game | Toggle | True |
18401854

18411855
-----------------------
18421856
# Task Tracking Settings
@@ -1900,7 +1914,7 @@ If you have any bugs or any need to contact me, join the [Discord Server](https:
19001914
[TheOtherRoles](https://github.com/Eisbison/TheOtherRoles) - For the inspiration of the Vigilante, Tracker and Spy roles, as well as the Bait modifier.\
19011915
[5up](https://www.twitch.tv/5uppp) and the Submarine Team - For the inspiration of the Grenadier role.\
19021916
[Guus](https://github.com/OhMyGuus) - For support for the old Among Us versions (v2021.11.9.5 and v2021.12.15).\
1903-
[MyDragonBreath](https://github.com/MyDragonBreath) - For Submerged Compatibility, the Trapper and Aurial roles, the Aftermath modifier and support for the new Among Us versions (v2022.6.21 & v2023.6.13).\
1917+
[MyDragonBreath](https://github.com/MyDragonBreath) - For Submerged Compatibility, the Trapper and Aurial roles, the Aftermath modifier and support for the new Among Us versions (v2022.6.21, v2023.6.13 & v2023.7.12).\
19041918
[ItsTheNumberH](https://github.com/itsTheNumberH/Town-Of-H) - For the code used for Blind, Bait, Poisoner and partially for Tracker, as well as other bug fixes.\
19051919
[Ruiner](https://github.com/ruiner189/Town-Of-Us-Redux) - For lovers changed into a modifier and Task Tracking.\
19061920
[Term](https://www.twitch.tv/termboii) - For creating Transporter, Medium, Blackmailer, Plaguebearer, Sleuth, Multitasker and porting v2.5.0 to the new Among Us version (v2021.12.15).\

source/Patches/AmongUsClient_OnGameEnd.cs

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -109,57 +109,60 @@ public static void Prefix()
109109
return;
110110
}
111111

112-
foreach (var role in Role.AllRoles)
112+
if (CustomGameOptions.NeutralEvilWinEndsGame)
113113
{
114-
var type = role.RoleType;
115-
116-
if (type == RoleEnum.Jester)
114+
foreach (var role in Role.AllRoles)
117115
{
118-
var jester = (Jester)role;
119-
if (jester.VotedOut)
116+
var type = role.RoleType;
117+
118+
if (type == RoleEnum.Jester)
120119
{
121-
TempData.winners = new List<WinningPlayerData>();
122-
var jestData = new WinningPlayerData(jester.Player.Data);
123-
jestData.IsDead = false;
124-
if (PlayerControl.LocalPlayer != jester.Player) jestData.IsYou = false;
125-
TempData.winners.Add(jestData);
126-
return;
120+
var jester = (Jester)role;
121+
if (jester.VotedOut)
122+
{
123+
TempData.winners = new List<WinningPlayerData>();
124+
var jestData = new WinningPlayerData(jester.Player.Data);
125+
jestData.IsDead = false;
126+
if (PlayerControl.LocalPlayer != jester.Player) jestData.IsYou = false;
127+
TempData.winners.Add(jestData);
128+
return;
129+
}
127130
}
128-
}
129-
else if (type == RoleEnum.Executioner)
130-
{
131-
var executioner = (Executioner)role;
132-
if (executioner.TargetVotedOut)
131+
else if (type == RoleEnum.Executioner)
133132
{
134-
TempData.winners = new List<WinningPlayerData>();
135-
var exeData = new WinningPlayerData(executioner.Player.Data);
136-
if (PlayerControl.LocalPlayer != executioner.Player) exeData.IsYou = false;
137-
TempData.winners.Add(exeData);
138-
return;
133+
var executioner = (Executioner)role;
134+
if (executioner.TargetVotedOut)
135+
{
136+
TempData.winners = new List<WinningPlayerData>();
137+
var exeData = new WinningPlayerData(executioner.Player.Data);
138+
if (PlayerControl.LocalPlayer != executioner.Player) exeData.IsYou = false;
139+
TempData.winners.Add(exeData);
140+
return;
141+
}
139142
}
140-
}
141-
else if (type == RoleEnum.Doomsayer)
142-
{
143-
var doom = (Doomsayer)role;
144-
if (doom.WonByGuessing)
143+
else if (type == RoleEnum.Doomsayer)
145144
{
146-
TempData.winners = new List<WinningPlayerData>();
147-
var doomData = new WinningPlayerData(doom.Player.Data);
148-
if (PlayerControl.LocalPlayer != doom.Player) doomData.IsYou = false;
149-
TempData.winners.Add(doomData);
150-
return;
145+
var doom = (Doomsayer)role;
146+
if (doom.WonByGuessing)
147+
{
148+
TempData.winners = new List<WinningPlayerData>();
149+
var doomData = new WinningPlayerData(doom.Player.Data);
150+
if (PlayerControl.LocalPlayer != doom.Player) doomData.IsYou = false;
151+
TempData.winners.Add(doomData);
152+
return;
153+
}
151154
}
152-
}
153-
else if (type == RoleEnum.Phantom)
154-
{
155-
var phantom = (Phantom)role;
156-
if (phantom.CompletedTasks)
155+
else if (type == RoleEnum.Phantom)
157156
{
158-
TempData.winners = new List<WinningPlayerData>();
159-
var phantomData = new WinningPlayerData(phantom.Player.Data);
160-
if (PlayerControl.LocalPlayer != phantom.Player) phantomData.IsYou = false;
161-
TempData.winners.Add(phantomData);
162-
return;
157+
var phantom = (Phantom)role;
158+
if (phantom.CompletedTasks)
159+
{
160+
TempData.winners = new List<WinningPlayerData>();
161+
var phantomData = new WinningPlayerData(phantom.Player.Data);
162+
if (PlayerControl.LocalPlayer != phantom.Player) phantomData.IsYou = false;
163+
TempData.winners.Add(phantomData);
164+
return;
165+
}
163166
}
164167
}
165168
}
@@ -275,7 +278,7 @@ public static void Prefix()
275278
var surv = (Survivor)role;
276279
if (!surv.Player.Data.IsDead && !surv.Player.Data.Disconnected)
277280
{
278-
var isImp = TempData.winners[0].IsImpostor;
281+
var isImp = TempData.winners.Count != 0 && TempData.winners[0].IsImpostor;
279282
var survWinData = new WinningPlayerData(surv.Player.Data);
280283
if (isImp) survWinData.IsImpostor = true;
281284
if (PlayerControl.LocalPlayer != surv.Player) survWinData.IsYou = false;

source/Patches/CanMove.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static bool Prefix(PlayerControl __instance, ref bool __result)
1313
&& !Minigame.Instance
1414
&& !__instance.shapeshifting
1515
&& (!DestroyableSingleton<HudManager>.InstanceExists
16-
|| !DestroyableSingleton<HudManager>.Instance.Chat.IsOpen
16+
|| !DestroyableSingleton<HudManager>.Instance.Chat.IsOpenOrOpening
1717
&& !DestroyableSingleton<HudManager>.Instance.KillOverlay.IsOpen
1818
&& !DestroyableSingleton<HudManager>.Instance.GameMenu.IsOpen)
1919
/*&& (!ControllerManager.Instance || !ControllerManager.Instance.IsUiControllerActive)*/

source/Patches/CrewmateRoles/AltruistMod/UpdateArrows.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using HarmonyLib;
22
using Reactor.Utilities.Extensions;
3-
using TownOfUs.Extensions;
43

54
namespace TownOfUs.CrewmateRoles.AltruistMod
65
{

source/Patches/CrewmateRoles/DetectiveMod/HudExamine.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,21 @@ public static void UpdateExamineButton(HudManager __instance)
4343
&& !MeetingHud.Instance && !PlayerControl.LocalPlayer.Data.IsDead
4444
&& AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started);
4545

46-
if (role.ExamineMode)
46+
role.ExamineButton.SetCoolDown(role.ExamineTimer(), CustomGameOptions.ExamineCd);
47+
Utils.SetTarget(ref role.ClosestPlayer, role.ExamineButton, float.NaN);
48+
49+
var renderer = role.ExamineButton.graphic;
50+
if (role.ClosestPlayer != null)
4751
{
48-
role.ExamineButton.SetCoolDown(role.ExamineTimer(), CustomGameOptions.ExamineCd);
49-
Utils.SetTarget(ref role.ClosestPlayer, role.ExamineButton, float.NaN);
50-
51-
var renderer = role.ExamineButton.graphic;
52-
if (role.ClosestPlayer != null)
53-
{
54-
renderer.color = Palette.EnabledColor;
55-
renderer.material.SetFloat("_Desat", 0f);
56-
}
57-
else
58-
{
59-
renderer.color = Palette.DisabledClear;
60-
renderer.material.SetFloat("_Desat", 1f);
61-
}
52+
renderer.color = Palette.EnabledColor;
53+
renderer.material.SetFloat("_Desat", 0f);
6254
}
6355
else
6456
{
65-
role.ExamineButton.SetCoolDown(0f, 1f);
66-
var renderer = role.ExamineButton.graphic;
6757
renderer.color = Palette.DisabledClear;
6858
renderer.material.SetFloat("_Desat", 1f);
6959
}
60+
7061
var data = PlayerControl.LocalPlayer.Data;
7162
var isDead = data.IsDead;
7263
var truePosition = PlayerControl.LocalPlayer.GetTruePosition();

source/Patches/CrewmateRoles/DetectiveMod/PerformKill.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ public static bool Prefix(KillButton __instance)
2424
{
2525
var flag2 = role.ExamineTimer() == 0f;
2626
if (!flag2) return false;
27-
if (!role.ExamineMode) return false;
2827
if (role.ClosestPlayer == null) return false;
2928
if (Vector2.Distance(role.ClosestPlayer.GetTruePosition(),
3029
PlayerControl.LocalPlayer.GetTruePosition()) > maxDistance) return false;
3130
if (role.ClosestPlayer == null) return false;
3231
var interact = Utils.Interact(PlayerControl.LocalPlayer, role.ClosestPlayer);
3332
if (interact[4] == true)
3433
{
35-
if (role.ClosestPlayer == role.DetectedKiller) Coroutines.Start(Utils.FlashCoroutine(Color.red));
34+
if (role.DetectedKillers.Contains(role.ClosestPlayer.PlayerId) || (CustomGameOptions.CanDetectLastKiller && role.LastKiller == role.ClosestPlayer)) Coroutines.Start(Utils.FlashCoroutine(Color.red));
3635
else Coroutines.Start(Utils.FlashCoroutine(Color.green));
3736
}
3837
if (interact[0] == true)
@@ -57,17 +56,13 @@ public static bool Prefix(KillButton __instance)
5756
PlayerControl.LocalPlayer.GetTruePosition()) > maxDistance) return false;
5857
var playerId = role.CurrentTarget.ParentId;
5958
var player = Utils.PlayerById(playerId);
60-
if ((player.IsInfected() || role.Player.IsInfected()))
59+
if (player.IsInfected() || role.Player.IsInfected())
6160
{
6261
foreach (var pb in Role.GetRoles(RoleEnum.Plaguebearer)) ((Plaguebearer)pb).RpcSpreadInfection(player, role.Player);
6362
}
6463
foreach (var deadPlayer in Murder.KilledPlayers)
6564
{
66-
if (deadPlayer.PlayerId == playerId)
67-
{
68-
role.DetectedKiller = Utils.PlayerById(deadPlayer.KillerId);
69-
role.ExamineMode = true;
70-
}
65+
if (deadPlayer.PlayerId == playerId) role.DetectedKillers.Add(deadPlayer.KillerId);
7166
}
7267
return false;
7368
}

source/Patches/CrewmateRoles/HaunterMod/SetHaunter.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using System;
22
using HarmonyLib;
3-
using Hazel;
43
using TownOfUs.Roles;
54
using UnityEngine;
65
using Object = UnityEngine.Object;
76
using Random = UnityEngine.Random;
87
using TownOfUs.Patches;
98
using TownOfUs.CrewmateRoles.AurialMod;
109
using TownOfUs.Patches.ScreenEffects;
10+
using System.Linq;
11+
using System.Collections.Generic;
1112

1213
namespace TownOfUs.CrewmateRoles.HaunterMod
1314
{
@@ -75,8 +76,20 @@ public static void ExileControllerPostfix(ExileController __instance)
7576
if (PlayerControl.LocalPlayer != WillBeHaunter) return;
7677

7778
if (Role.GetRole<Haunter>(PlayerControl.LocalPlayer).Caught) return;
78-
var startingVent =
79-
ShipStatus.Instance.AllVents[Random.RandomRangeInt(0, ShipStatus.Instance.AllVents.Count)];
79+
80+
List<Vent> vents = new();
81+
var CleanVentTasks = PlayerControl.LocalPlayer.myTasks.ToArray().Where(x => x.TaskType == TaskTypes.VentCleaning).ToList();
82+
if (CleanVentTasks != null)
83+
{
84+
var ids = CleanVentTasks.Where(x => !x.IsComplete)
85+
.ToList()
86+
.ConvertAll(x => x.FindConsoles()[0].ConsoleId);
87+
88+
vents = ShipStatus.Instance.AllVents.Where(x => !ids.Contains(x.Id)).ToList();
89+
}
90+
else vents = ShipStatus.Instance.AllVents.ToList();
91+
92+
var startingVent = vents[Random.RandomRangeInt(0, vents.Count)];
8093

8194

8295
Utils.Rpc(CustomRPC.SetPos, PlayerControl.LocalPlayer.PlayerId, startingVent.transform.position.x, startingVent.transform.position.y + 0.3636f);

source/Patches/CrewmateRoles/TransporterMod/Update.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ private static void Postfix(HudManager __instance)
2020
Role.GetRole<Transporter>(PlayerControl.LocalPlayer).Update(__instance);
2121
}
2222
}
23+
24+
[HarmonyPatch(typeof(ChatController), nameof(ChatController.UpdateChatMode))]
25+
class chatModeUpdate
26+
{
27+
private static bool Prefix(ChatController __instance)
28+
{
29+
if (!PlayerControl.LocalPlayer.Is(RoleEnum.Transporter)) return true;
30+
return (__instance != Role.GetRole<Transporter>(PlayerControl.LocalPlayer).TransportList);
31+
}
32+
}
2333
}

0 commit comments

Comments
 (0)