Skip to content

Commit 114ff3b

Browse files
committed
v5.2.1 Source Code
1 parent e3e84fd commit 114ff3b

File tree

39 files changed

+566
-224
lines changed

39 files changed

+566
-224
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
4141
# Releases
4242
| Among Us - Version| Mod Version | Link |
4343
|----------|-------------|-----------------|
44+
| 2024.10.29s & 2024.10.29e | v5.2.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.1/ToU.v5.2.1.zip) |
4445
| 2024.10.29s & 2024.10.29e | v5.2.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.0/ToU.v5.2.0.zip) |
4546
| 2024.10.29s & 2024.10.29e | v5.1.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.2/ToU.v5.1.2.zip) |
4647
| 2024.9.4s & 2024.9.4e | v5.1.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.1/ToU.v5.1.1.zip) |
@@ -109,6 +110,19 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
109110
<details>
110111
<summary> Changelog </summary>
111112
<details>
113+
<summary> v5.2.1 </summary>
114+
<ul> <li>Bug Fix: Warden/Warlock Chat Command Issue</li> </ul>
115+
<ul> <li>Bug Fix: Mini clipping out of the map when transported, dispersed or morphed</li> </ul>
116+
<ul> <li>Bug Fix: Imitator not changing back correctly upon meeting beginning</li> </ul>
117+
<ul> <li>Bug Fix: Scavenger task text not updating when target is killed or disconnects</li> </ul>
118+
<ul> <li>Disabled Spy and Torch on Fungle</li> </ul>
119+
<ul> <li>Divided the Hat Tabs Up, courtesy of @whichtwix</li> </ul>
120+
<ul> <li>Notification for modded settings change, courtesy of @whichtwix</li> </ul>
121+
<ul> <li>Fixed some issues with lag when players join the game, courtesy of @whichtwix and @lekillerdesgames</li> </ul>
122+
<ul> <li>Display Role List in lobby, courtesy of @ItzLoonie</li> </ul>
123+
<ul> <li>Cancel start game button, courtesy of @Tommy-XL</li> </ul>
124+
</details>
125+
<details>
112126
<summary> v5.2.0 </summary>
113127
<ul> <li>Role Distribution Changed to Hybrid system between role lists and percentages (game modes removed as they can be set up through role lists)</li> </ul>
114128
<ul> <li>New Role: Lookout</li> </ul>
@@ -939,7 +953,7 @@ On top of this, the Mystic briefly gets an arrow pointing in the direction of th
939953
## Oracle
940954
### **Team: Crewmates**
941955
The Oracle is a Crewmate that can get another player to confess information to them.\
942-
The Oracle has 3 abilities, the first is that when they die, the person confessin to them will reveal their alignment.\
956+
The Oracle has 3 abilities, the first is that when they die, the person confessing to them will reveal their alignment.\
943957
The second, is that every meeting the Oracle receives a confession about who might be evil.\
944958
The final ability is giving a blessing to the person confessing to them, with this the confessing player gains vote immunity!
945959
### Game Options

source/Extensions/AmongUsExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public static void SetOutfit(this PlayerControl playerControl, CustomPlayerOutfi
6666
playerControl.Data.SetOutfit((PlayerOutfitType)CustomOutfitType, outfit);
6767
playerControl.SetOutfit(CustomOutfitType);
6868
}
69+
6970
public static void SetOutfit(this PlayerControl playerControl, CustomPlayerOutfitType CustomOutfitType)
7071
{
7172
var outfitType = (PlayerOutfitType)CustomOutfitType;

source/Patches/CrewmateRoles/ImitatorMod/StopImitate.cs renamed to source/Patches/AddMeetingButtons.cs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@
44
using TownOfUs.CrewmateRoles.InvestigatorMod;
55
using TownOfUs.CrewmateRoles.TrapperMod;
66
using System.Collections.Generic;
7-
using System.Linq;
8-
9-
namespace TownOfUs.CrewmateRoles.ImitatorMod
7+
using System.Collections;
8+
using TownOfUs.CrewmateRoles.DeputyMod;
9+
using TownOfUs.CrewmateRoles.ImitatorMod;
10+
using TownOfUs.CrewmateRoles.JailorMod;
11+
using TownOfUs.CrewmateRoles.MayorMod;
12+
using TownOfUs.CrewmateRoles.PoliticianMod;
13+
using TownOfUs.CrewmateRoles.ProsecutorMod;
14+
using TownOfUs.CrewmateRoles.SwapperMod;
15+
using TownOfUs.CrewmateRoles.VigilanteMod;
16+
using TownOfUs.ImpostorRoles.HypnotistMod;
17+
using TownOfUs.Modifiers.AssassinMod;
18+
using TownOfUs.NeutralRoles.DoomsayerMod;
19+
20+
namespace TownOfUs.Patches
1021
{
11-
12-
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.StartMeeting))]
13-
class StartMeetingPatch
22+
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
23+
class AddMeetingButtons
1424
{
15-
public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)] NetworkedPlayerInfo meetingTarget)
25+
public static void Prefix(MeetingHud __instance)
1626
{
17-
if (__instance == null)
18-
{
19-
return;
20-
}
2127
if (StartImitate.ImitatingPlayer != null && !StartImitate.ImitatingPlayer.Is(RoleEnum.Traitor))
2228
{
2329
List<RoleEnum> trappedPlayers = null;
@@ -183,7 +189,20 @@ public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)] Network
183189
Role.GetRole<Imitator>(StartImitate.ImitatingPlayer).ImitatePlayer = null;
184190
StartImitate.ImitatingPlayer = null;
185191
}
192+
193+
AddButtonDeputy.AddDepButtons(__instance);
194+
AddButtonImitator.AddImitatorButtons(__instance);
195+
TempJail.AddTempJail(__instance);
196+
AddJailButtons.AddJailorButtons(__instance);
197+
AddRevealButton.AddMayorButtons(__instance);
198+
AddRevealButtonPolitician.AddPoliticianButtons(__instance);
199+
AddProsecute.AddProsecuteButton(__instance);
200+
AddButton.AddSwapperButtons(__instance);
201+
AddButtonVigi.AddVigilanteButtons(__instance);
202+
AddHysteriaButton.AddHypnoButtons(__instance);
203+
AddButtonAssassin.AddAssassinButtons(__instance);
204+
AddButtonDoom.AddDoomsayerButtons(__instance);
186205
return;
187206
}
188207
}
189-
}
208+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
using HarmonyLib;
2+
using Reactor.Utilities;
3+
using UnityEngine;
4+
using TownOfUs.CustomOption;
5+
6+
namespace TownOfUs.Patches
7+
{
8+
[HarmonyPatch]
9+
class CancelCountdownStart
10+
{
11+
private static PassiveButton CancelStartButton;
12+
13+
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Start))]
14+
[HarmonyPrefix]
15+
public static void PrefixStart(GameStartManager __instance)
16+
{
17+
CancelStartButton = Object.Instantiate(__instance.StartButton, __instance.transform);
18+
CancelStartButton.name = "CancelButton";
19+
20+
var cancelLabel = CancelStartButton.buttonText;
21+
cancelLabel.gameObject.GetComponent<TextTranslatorTMP>()?.OnDestroy();
22+
cancelLabel.text = "Cancel";
23+
24+
var cancelButtonInactiveRenderer = CancelStartButton.inactiveSprites.GetComponent<SpriteRenderer>();
25+
cancelButtonInactiveRenderer.color = new(0.8f, 0f, 0f, 1f);
26+
27+
var cancelButtonActiveRenderer = CancelStartButton.activeSprites.GetComponent<SpriteRenderer>();
28+
cancelButtonActiveRenderer.color = Color.red;
29+
30+
var cancelButtonInactiveShine = CancelStartButton.inactiveSprites.transform.Find("Shine");
31+
32+
if (cancelButtonInactiveShine)
33+
cancelButtonInactiveShine.gameObject.SetActive(false);
34+
35+
CancelStartButton.activeTextColor = CancelStartButton.inactiveTextColor = Color.white;
36+
37+
CancelStartButton.OnClick = new();
38+
CancelStartButton.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
39+
{
40+
__instance.ResetStartState();
41+
}));
42+
CancelStartButton.gameObject.SetActive(false);
43+
}
44+
45+
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))]
46+
[HarmonyPrefix]
47+
public static void PrefixUpdate(GameStartManager __instance)
48+
{
49+
if (__instance == null || !AmongUsClient.Instance.AmHost) return;
50+
51+
__instance.MinPlayers = 4;
52+
53+
CancelStartButton.gameObject.SetActive(__instance.startState is GameStartManager.StartingStates.Countdown);
54+
55+
var startTexttransform = __instance.GameStartText.transform;
56+
if (startTexttransform.localPosition.y != 2f)
57+
{
58+
startTexttransform.localPosition = new Vector3(startTexttransform.localPosition.x, 2f, startTexttransform.localPosition.z);
59+
}
60+
}
61+
62+
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.ResetStartState))]
63+
[HarmonyPrefix]
64+
public static void Prefix(GameStartManager __instance)
65+
{
66+
if (__instance?.startState is GameStartManager.StartingStates.Countdown)
67+
{
68+
SoundManager.Instance.StopSound(__instance.gameStartSound);
69+
if (AmongUsClient.Instance.AmHost)
70+
{
71+
RandomMap.Reset();
72+
GameManager.Instance.LogicOptions.SyncOptions();
73+
Coroutines.Start(Rpc.SendRpc());
74+
}
75+
}
76+
}
77+
78+
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.SetStartCounter))]
79+
[HarmonyPrefix]
80+
public static void Prefix(GameStartManager __instance, sbyte sec)
81+
{
82+
if (sec == -1)
83+
{
84+
SoundManager.Instance.StopSound(__instance.gameStartSound);
85+
}
86+
}
87+
}
88+
}

source/Patches/ChatCommands.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,6 @@ public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] ref Pl
268268
AddRoleMessage(RoleEnum.Prosecutor);
269269
return false;
270270
}
271-
else if (chatText.ToLower().StartsWith("/war") || chatText.ToLower().StartsWith("/ war"))
272-
{
273-
AddRoleMessage(RoleEnum.Warlock);
274-
return false;
275-
}
276271
else if (chatText.ToLower().StartsWith("/ora") || chatText.ToLower().StartsWith("/ ora"))
277272
{
278273
AddRoleMessage(RoleEnum.Oracle);
@@ -298,6 +293,11 @@ public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] ref Pl
298293
AddRoleMessage(RoleEnum.Warden);
299294
return false;
300295
}
296+
else if (chatText.ToLower().StartsWith("/war") || chatText.ToLower().StartsWith("/ war"))
297+
{
298+
AddRoleMessage(RoleEnum.Warlock);
299+
return false;
300+
}
301301
else if (chatText.ToLower().StartsWith("/hypno") || chatText.ToLower().StartsWith("/ hypno"))
302302
{
303303
AddRoleMessage(RoleEnum.Hypnotist);

source/Patches/CrewmateRoles/DeputyMod/AddButton.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Linq;
3-
using HarmonyLib;
43
using Il2CppInterop.Runtime.InteropTypes.Arrays;
54
using Reactor.Utilities.Extensions;
65
using TownOfUs.CrewmateRoles.ImitatorMod;
@@ -20,7 +19,6 @@
2019

2120
namespace TownOfUs.CrewmateRoles.DeputyMod
2221
{
23-
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
2422
public class AddButtonDeputy
2523
{
2624
private static Sprite ShootSprite => TownOfUs.ShootSprite;
@@ -355,7 +353,7 @@ public static void Shoot(Deputy deputy, PlayerControl player, bool checkLover =
355353
AddHauntPatch.AssassinatedPlayers.Add(player);
356354
}
357355

358-
public static void Postfix(MeetingHud __instance)
356+
public static void AddDepButtons(MeetingHud __instance)
359357
{
360358
foreach (var role in Role.GetRoles(RoleEnum.Deputy))
361359
{

source/Patches/CrewmateRoles/ImitatorMod/AddButton.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
using System;
22
using System.Linq;
3-
using HarmonyLib;
43
using TownOfUs.Roles;
54
using UnityEngine;
65
using UnityEngine.UI;
76
using Object = UnityEngine.Object;
87

98
namespace TownOfUs.CrewmateRoles.ImitatorMod
109
{
11-
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
1210
public class AddButtonImitator
1311
{
1412
private static int _mostRecentId;
@@ -115,7 +113,7 @@ void Listener()
115113
return Listener;
116114
}
117115

118-
public static void Postfix(MeetingHud __instance)
116+
public static void AddImitatorButtons(MeetingHud __instance)
119117
{
120118
foreach (var role in Role.GetRoles(RoleEnum.Imitator))
121119
{

source/Patches/CrewmateRoles/ImitatorMod/TempJail.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using HarmonyLib;
21
using Reactor.Utilities.Extensions;
32
using TownOfUs.Roles;
43
using UnityEngine;
@@ -7,7 +6,6 @@
76

87
namespace TownOfUs.CrewmateRoles.ImitatorMod
98
{
10-
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
119
public class TempJail
1210
{
1311
public static Sprite CellSprite => TownOfUs.InJailSprite;
@@ -30,7 +28,7 @@ public static void GenCell(Imitator role, PlayerVoteArea voteArea)
3028
passive.OnClick = new Button.ButtonClickedEvent();
3129
}
3230

33-
public static void Postfix(MeetingHud __instance)
31+
public static void AddTempJail(MeetingHud __instance)
3432
{
3533
foreach (var role in Role.GetRoles(RoleEnum.Imitator))
3634
{

source/Patches/CrewmateRoles/JailorMod/AddButton.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Linq;
3-
using HarmonyLib;
43
using Il2CppInterop.Runtime.InteropTypes.Arrays;
54
using Reactor.Utilities.Extensions;
65
using TownOfUs.CrewmateRoles.MedicMod;
@@ -22,7 +21,6 @@
2221

2322
namespace TownOfUs.CrewmateRoles.JailorMod
2423
{
25-
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
2624
public class AddJailButtons
2725
{
2826
public static Sprite CellSprite => TownOfUs.InJailSprite;
@@ -377,7 +375,7 @@ public static void ExecuteKill (Jailor jailor, PlayerControl player, bool checkL
377375
AddHauntPatch.AssassinatedPlayers.Add(player);
378376
}
379377

380-
public static void Postfix(MeetingHud __instance)
378+
public static void AddJailorButtons(MeetingHud __instance)
381379
{
382380
foreach (var role in Role.GetRoles(RoleEnum.Jailor))
383381
{

source/Patches/CrewmateRoles/MayorMod/AddButton.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Linq;
3-
using HarmonyLib;
43
using Reactor.Utilities.Extensions;
54
using TownOfUs.Modifiers.AssassinMod;
65
using TownOfUs.CrewmateRoles.VigilanteMod;
@@ -13,7 +12,6 @@
1312

1413
namespace TownOfUs.CrewmateRoles.MayorMod
1514
{
16-
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
1715
public class AddRevealButton
1816
{
1917
public static Sprite RevealSprite => TownOfUs.RevealSprite;
@@ -80,7 +78,7 @@ public static void RemoveAssassin(Mayor mayor)
8078
}
8179
}
8280

83-
public static void Postfix(MeetingHud __instance)
81+
public static void AddMayorButtons(MeetingHud __instance)
8482
{
8583
foreach (var role in Role.GetRoles(RoleEnum.Mayor))
8684
{

0 commit comments

Comments
 (0)