Skip to content

Commit

Permalink
v5.0.3 Source Code
Browse files Browse the repository at this point in the history
  • Loading branch information
MyDragonBreath committed Dec 15, 2023
1 parent 198b9b8 commit a6cbe49
Show file tree
Hide file tree
Showing 135 changed files with 1,066 additions and 683 deletions.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
# Releases
| Among Us - Version| Mod Version | Link |
|----------|-------------|-----------------|
| 2023.11.28s & 2023.11.28e | v5.0.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.3/ToU.v5.0.3.zip) |
| 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) |
| 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) |
| 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) |
Expand Down Expand Up @@ -146,6 +147,21 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
<details>
<summary> Changelog </summary>
<details>
<summary> v5.0.3 </summary>
<ul> <li>Compatibility with the new Among Us version v2023.11.28</li> </ul>
<ul> <li>Role gen system reparied, courtesy of @AlchlcDvl</li> </ul>
<ul> <li>Role color is now used for interaction highlights</li> </ul>
<ul> <li>Changes to intro role colors, courtesy of @Loonie-Toons</li> </ul>
<ul> <li>Custom keybinds for interactions - integration to among us keybinds, courtesy of @whichtwix</li> </ul>
<ul> <li>Added a tiny discord rich prescense line</li> </ul>
<ul> <li>Disperse added back to submerged and heli</li> </ul>
<ul> <li>Multiple revived people from altruist appear on imposters arrows, rather than just the latest, courtesy of @whichtwix</li> </ul>
<ul> <li>Ping tracker reduced in size</li> </ul>
<ul> <li>Host is now shown in the ping tracker whilst in the lobby</li> </ul>
<ul> <li>Shows host in top left of lobby meetings</li> </ul>
<ul> <li>-- Soon to come: Full rewrite.</li> </ul>
</details>
<details>
<summary> v5.0.2 </summary>
<ul> <li>Compatibility with the new Among Us version v2023.7.12</li> </ul>
<ul> <li>New Setting: Detective can detect last killer</li> </ul>
Expand Down Expand Up @@ -725,6 +741,15 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa
\
A first launch may take up to 5 minutes, so be patient if it doesn't launch immediately.<br/>
<br/>
If the mod does not work and the version of Among Us that you see in the main menu, under the town of us logo or bottom left, does not correspond to the version indicated in the [releases table](#releases) above please do the following to get the correct version:

**1. Go to Among Us in your Steam library**\
\
**2. Click the gears icon or right click among us and then go into properties**\
\
**3. Go to betas and select "public-previous" in the drop box**\
\
**4. Reinstall the game and redo the mod installation, recreate your copy of the game if necessary**

## Installation Guide (Epic Games)
**1. [Download](#releases) the Town of Us version corresponding to the installed Among Us version.**\
Expand Down Expand Up @@ -756,6 +781,25 @@ A first launch may take up to 5 minutes, so be patient if it doesn't launch imme
A first launch may take up to 5 minutes, so be patient if it doesn't launch immediately.<br/>
<br/>

If the mod does not work and the version of Among Us that you see in the main menu, under the town of us logo or bottom left, does not correspond to the version indicated in the [releases table](#releases) above please do the following to get the correct version:

**1. Download the latest downgrade script(DowngradeEpic.ps1) [here](https://github.com/whichtwix/EpicGamesDowngrader/releases/latest).**\
\
**2. Right click the file and click "run with powershell". If it does not open or instantly closes do the following:**\
- search powershell in your windows search bar and open it <br>
- navigate to the folder the script is in, by doing for example ```cd downloads``` or ```cd desktop``` <br>
- write ```Set-ExecutionPolicy Unrestricted -Scope Process``` and click enter <br>
- write ```./DowngradeEpic.ps1``` and click enter <br>
\
**3. Click the y key the couple times it prompts, and look above the prompt at the 'install path' to see where among us is getting installed.**\
\
**4. After its finished reinstall the mod to that path**\
\
**5. Open the game using a .cmd file that gets created in the same folder the script is, it will have the version of among us in its name. Do not use the epic launcher.**\
\
If there any problems with the script please check the [faq](https://github.com/whichtwix/EpicGamesDowngrader/tree/main#common-issues), and make contact with the discord server or in a issue [here](https://github.com/whichtwix/EpicGamesDowngrader/issues/new).<br/>
<br/>

![Install](https://i.imgur.com/pvBAyZN.png)
<br/>
## Issues
Expand Down Expand Up @@ -1928,4 +1972,4 @@ v1.2.0 has Essentials embedded and can be found [here](https://github.com/slushi

#
<p align="center">This mod is not affiliated with Among Us or Innersloth LLC, and the content contained therein is not endorsed or otherwise sponsored by Innersloth LLC. Portions of the materials contained herein are property of Innersloth LLC.</p>
<p align="center">© Innersloth LLC.</p>
<p align="center">© Innersloth LLC.</p>
2 changes: 1 addition & 1 deletion source/Extensions/AmongUsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static Texture2D CreateEmptyTexture(int width = 0, int height = 0)
return new Texture2D(width, height, TextureFormat.RGBA32, Texture.GenerateAllMips, false, IntPtr.Zero);
}

public static TMPro.TextMeshPro nameText(this PlayerControl p) => p.cosmetics.nameText;
public static TMPro.TextMeshPro nameText(this PlayerControl p) => p?.cosmetics?.nameText;

public static TMPro.TextMeshPro NameText(this PoolablePlayer p) => p.cosmetics.nameText;

Expand Down
2 changes: 1 addition & 1 deletion source/Patches/AddHauntPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void ExileControllerPostfix(ExileController __instance)
[HarmonyPatch(typeof(Object), nameof(Object.Destroy), new Type[] { typeof(GameObject) })]
public static void Prefix(GameObject obj)
{
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 5) return;
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 6) return;
if (obj.name?.Contains("ExileCutscene") == true) ExileControllerPostfix(ExileControllerPatch.lastExiled);
}
}
Expand Down
3 changes: 2 additions & 1 deletion source/Patches/CamoComms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public static void Postfix(HudManager __instance)
if (ShipStatus.Instance != null)
switch (GameOptionsManager.Instance.currentNormalGameOptions.MapId)
{
default:
case 0:
case 2:
case 3:
case 4:
case 5:
case 6:
var comms1 = ShipStatus.Instance.Systems[SystemTypes.Comms].Cast<HudOverrideSystemType>();
if (comms1.IsActive)
Expand All @@ -32,6 +32,7 @@ public static void Postfix(HudManager __instance)

break;
case 1:
case 5:
var comms2 = ShipStatus.Instance.Systems[SystemTypes.Comms].Cast<HqHudSystemType>();
if (comms2.IsActive)
{
Expand Down
8 changes: 4 additions & 4 deletions source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ namespace TownOfUs.CrewmateRoles.AltruistMod
{
public class Coroutine
{
public static ArrowBehaviour Arrow;
public static PlayerControl Target;
public static Dictionary<PlayerControl, ArrowBehaviour> Revived = new();
public static Sprite Sprite => TownOfUs.Arrow;

public static IEnumerator AltruistRevive(DeadBody target, Altruist role)
Expand Down Expand Up @@ -103,13 +102,14 @@ public static IEnumerator AltruistRevive(DeadBody target, Altruist role)
if (PlayerControl.LocalPlayer.Data.IsImpostor() || PlayerControl.LocalPlayer.Is(Faction.NeutralKilling))
{
var gameObj = new GameObject();
Arrow = gameObj.AddComponent<ArrowBehaviour>();
var Arrow = gameObj.AddComponent<ArrowBehaviour>();
gameObj.transform.parent = PlayerControl.LocalPlayer.gameObject.transform;
var renderer = gameObj.AddComponent<SpriteRenderer>();
renderer.sprite = Sprite;
Arrow.image = renderer;
gameObj.layer = 5;
Target = player;
Revived.Add(player, Arrow);
//Target = player;
yield return Utils.FlashCoroutine(role.Color, 1f, 0.5f);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using HarmonyLib;
using Hazel;
using Reactor.Utilities;
using TownOfUs.Roles;
using UnityEngine;
Expand Down
10 changes: 5 additions & 5 deletions source/Patches/CrewmateRoles/AltruistMod/UpdateArrows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ public class UpdateArrows
{
public static void Postfix(PlayerControl __instance)
{
if (Coroutine.Arrow != null)
foreach (var revived in Coroutine.Revived)
{
if (LobbyBehaviour.Instance || MeetingHud.Instance || PlayerControl.LocalPlayer.Data.IsDead ||
Coroutine.Target.Data.IsDead)
revived.Key.Data.IsDead)
{
Coroutine.Arrow.gameObject.Destroy();
Coroutine.Target = null;
revived.Value.gameObject.Destroy();
Coroutine.Revived.Remove(revived.Key);
return;
}

Coroutine.Arrow.target = Coroutine.Target.transform.position;
revived.Value.target = revived.Key.transform.position;
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions source/Patches/CrewmateRoles/EngineerMod/KillButtonSprite.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using HarmonyLib;
using TownOfUs.Roles;
using UnityEngine;
Expand Down Expand Up @@ -47,11 +46,9 @@ public static void Postfix(HudManager __instance)
if (!ShipStatus.Instance) return;
var system = ShipStatus.Instance.Systems[SystemTypes.Sabotage].Cast<SabotageSystemType>();
if (system == null) return;
var specials = system.specials.ToArray();
var dummyActive = system.dummy.IsActive;
var sabActive = specials.Any(s => s.IsActive);
var sabActive = system.AnyActive;
var renderer = __instance.KillButton.graphic;
if (sabActive & !dummyActive & role.ButtonUsable & __instance.KillButton.enabled)
if (sabActive & role.ButtonUsable & __instance.KillButton.enabled)
{
renderer.color = Palette.EnabledColor;
renderer.material.SetFloat("_Desat", 0f);
Expand Down
42 changes: 25 additions & 17 deletions source/Patches/CrewmateRoles/EngineerMod/PerformKill.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Linq;
using HarmonyLib;
using Hazel;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.EngineerMod
Expand All @@ -21,12 +19,10 @@ public static bool Prefix(KillButton __instance)
if (!role.ButtonUsable) return false;
var system = ShipStatus.Instance.Systems[SystemTypes.Sabotage].Cast<SabotageSystemType>();
if (system == null) return false;
var specials = system.specials.ToArray();
var dummyActive = system.dummy.IsActive;
var sabActive = specials.Any(s => s.IsActive);
if (!sabActive | dummyActive) return false;
var sabActive = system.AnyActive;
if (!sabActive) return false;
role.UsesLeft -= 1;

Utils.Rpc(CustomRPC.EngineerFix, PlayerControl.LocalPlayer.NetId);
switch (GameOptionsManager.Instance.currentNormalGameOptions.MapId)
{
case 0:
Expand Down Expand Up @@ -63,12 +59,24 @@ public static bool Prefix(KillButton __instance)
case 4:
var comms4 = ShipStatus.Instance.Systems[SystemTypes.Comms].Cast<HudOverrideSystemType>();
if (comms4.IsActive) return FixComms();
var reactor = ShipStatus.Instance.Systems[SystemTypes.Reactor].Cast<HeliSabotageSystem>();
var reactor = ShipStatus.Instance.Systems[SystemTypes.HeliSabotage].Cast<HeliSabotageSystem>();
if (reactor.IsActive) return FixAirshipReactor();
var lights4 = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast<SwitchSystem>();
if (lights4.IsActive) return FixLights(lights4);
break;
case 5:
var reactor7 = ShipStatus.Instance.Systems[SystemTypes.Reactor].Cast<ReactorSystemType>();
if (reactor7.IsActive) return FixReactor(SystemTypes.Reactor);
var comms7 = ShipStatus.Instance.Systems[SystemTypes.Comms].Cast<HqHudSystemType>();
if (comms7.IsActive) return FixMiraComms();
var mushroom = ShipStatus.Instance.Systems[SystemTypes.MushroomMixupSabotage].Cast<MushroomMixupSabotageSystem>();
if (mushroom.IsActive)
{
mushroom.currentSecondsUntilHeal = 0.1f;
return false;
}
break;
case 6:
var reactor5 = ShipStatus.Instance.Systems[SystemTypes.Reactor].Cast<ReactorSystemType>();
if (reactor5.IsActive) return FixReactor(SystemTypes.Reactor);
var lights5 = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast<SwitchSystem>();
Expand All @@ -83,7 +91,7 @@ public static bool Prefix(KillButton __instance)
}
}
break;
case 6:
case 7:
var comms6 = ShipStatus.Instance.Systems[SystemTypes.Comms].Cast<HudOverrideSystemType>();
if (comms6.IsActive) return FixComms();
var reactor6 = ShipStatus.Instance.Systems[SystemTypes.Reactor].Cast<ReactorSystemType>();
Expand All @@ -95,40 +103,40 @@ public static bool Prefix(KillButton __instance)
break;
}

Utils.Rpc(CustomRPC.EngineerFix, PlayerControl.LocalPlayer.NetId);


return false;
}

private static bool FixComms()
{
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Comms, 0);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.Comms, 0);
return false;
}

private static bool FixMiraComms()
{
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Comms, 16 | 0);
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Comms, 16 | 1);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.Comms, 16 | 0);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.Comms, 16 | 1);
return false;
}

private static bool FixAirshipReactor()
{
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, 16 | 0);
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, 16 | 1);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.HeliSabotage, 16 | 0);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.HeliSabotage, 16 | 1);
return false;
}

private static bool FixReactor(SystemTypes system)
{
ShipStatus.Instance.RpcRepairSystem(system, 16);
ShipStatus.Instance.RpcUpdateSystem(system, 16);
return false;
}

private static bool FixOxygen()
{
ShipStatus.Instance.RpcRepairSystem(SystemTypes.LifeSupp, 16);
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.LifeSupp, 16);
return false;
}

Expand Down
1 change: 0 additions & 1 deletion source/Patches/CrewmateRoles/HaunterMod/RepickHaunter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using HarmonyLib;
using System.Linq;
using Hazel;
using UnityEngine;

namespace TownOfUs.CrewmateRoles.HaunterMod
Expand Down
11 changes: 9 additions & 2 deletions source/Patches/CrewmateRoles/HaunterMod/SetHaunter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public static void ExileControllerPostfix(ExileController __instance)
WillBeHaunter.gameObject.layer = LayerMask.NameToLayer("Players");
}

WillBeHaunter.gameObject.GetComponent<PassiveButton>().OnClick = new UnityEngine.UI.Button.ButtonClickedEvent();
WillBeHaunter.gameObject.GetComponent<PassiveButton>().OnClick.AddListener((Action)(() => WillBeHaunter.OnClick()));
WillBeHaunter.gameObject.GetComponent<BoxCollider2D>().enabled = true;

if (PlayerControl.LocalPlayer != WillBeHaunter) return;

if (Role.GetRole<Haunter>(PlayerControl.LocalPlayer).Caught) return;
Expand All @@ -93,8 +97,11 @@ public static void ExileControllerPostfix(ExileController __instance)


Utils.Rpc(CustomRPC.SetPos, PlayerControl.LocalPlayer.PlayerId, startingVent.transform.position.x, startingVent.transform.position.y + 0.3636f);
var pos = new Vector2(startingVent.transform.position.x, startingVent.transform.position.y + 0.3636f);

PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(new Vector2(startingVent.transform.position.x, startingVent.transform.position.y + 0.3636f));
PlayerControl.LocalPlayer.transform.position = pos;
PlayerControl.LocalPlayer.NetTransform.SnapTo(pos);
PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(pos);
PlayerControl.LocalPlayer.MyPhysics.RpcEnterVent(startingVent.Id);
}

Expand All @@ -103,7 +110,7 @@ public static void ExileControllerPostfix(ExileController __instance)
[HarmonyPatch(typeof(Object), nameof(Object.Destroy), new Type[] { typeof(GameObject) })]
public static void Prefix(GameObject obj)
{
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 5) return;
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 6) return;
if (obj.name?.Contains("ExileCutscene") == true) ExileControllerPostfix(ExileControllerPatch.lastExiled);
}
}
Expand Down
1 change: 0 additions & 1 deletion source/Patches/CrewmateRoles/HaunterMod/UpdateArrows.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using HarmonyLib;
using Reactor.Utilities.Extensions;
using TownOfUs.Extensions;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.HaunterMod
Expand Down
1 change: 0 additions & 1 deletion source/Patches/CrewmateRoles/ImitatorMod/SetImitate.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq;
using HarmonyLib;
using Hazel;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.ImitatorMod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq;
using HarmonyLib;
using Hazel;
using TownOfUs.Roles;
using UnityEngine;
using UnityEngine.UI;
Expand Down
3 changes: 1 addition & 2 deletions source/Patches/CrewmateRoles/ImitatorMod/StartImitate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using UnityEngine;
using Object = UnityEngine.Object;
using TownOfUs.Patches;
using Hazel;

namespace TownOfUs.CrewmateRoles.ImitatorMod
{
Expand Down Expand Up @@ -38,7 +37,7 @@ public static void ExileControllerPostfix(ExileController __instance)
[HarmonyPatch(typeof(Object), nameof(Object.Destroy), new Type[] { typeof(GameObject) })]
public static void Prefix(GameObject obj)
{
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 5) return;
if (!SubmergedCompatibility.Loaded || GameOptionsManager.Instance?.currentNormalGameOptions?.MapId != 6) return;
if (obj.name?.Contains("ExileCutscene") == true) ExileControllerPostfix(ExileControllerPatch.lastExiled);
}

Expand Down
1 change: 0 additions & 1 deletion source/Patches/CrewmateRoles/MayorMod/AddButton.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using HarmonyLib;
using Hazel;
using Reactor.Utilities.Extensions;
using TownOfUs.Modifiers.AssassinMod;
using TownOfUs.Roles;
Expand Down
Loading

0 comments on commit a6cbe49

Please sign in to comment.