Skip to content

Commit

Permalink
Update to v4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gendelo3 committed Feb 23, 2025
1 parent 5443351 commit 61a70ef
Show file tree
Hide file tree
Showing 37 changed files with 944 additions and 110 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The [Role Assignment](#role-assignment) section explains how the roles are being
# Releases
| Among Us - Version| Mod Version | Link |
|----------|-------------|-----------------|
| 2024.11.26| v4.8.0| [Download](https://github.com/TheOtherRolesAU/TheOtherRoles/releases/download/v4.8.0/TheOtherRoles.zip)
| 2024.11.26| v4.7.0| [Download](https://github.com/TheOtherRolesAU/TheOtherRoles/releases/download/v4.7.0/TheOtherRoles.zip)
| 2024.6.18| v4.6.0| [Download](https://github.com/TheOtherRolesAU/TheOtherRoles/releases/download/v4.6.0/TheOtherRoles.zip)

Expand Down Expand Up @@ -135,6 +136,18 @@ The [Role Assignment](#role-assignment) section explains how the roles are being
# Changelog
<details>
<summary>Click to show the Changelog</summary>

**Version 4.8.0**
- Added an optional Role Draft mode, where players can select their role out of some roles that are shown to them.
- Added a new option to allow the medic to shift the medic shield as well - no more invincible medics.
- Added partial key rebinding - all kill buttons will now use the vanilla kill button shortcut, same for vent and each roles first ability.
- Fixed the way options view panel to match vanilla changes
- Fixed options not showing/hiding sub-options when switching Presets
- Fixed a bug where voting the witch would not save the target
- Fixed a some bugs with the trapper, bomber and portal
- Fixed a bug in PropHunt where you players could not transform into props
- Fixed the summary button for the last game appearing outside the lobby sometimes
- Changed the positioning of the ping tracker in meetings

**Version 4.7.0**
- Updated to Among Us version 2024.11.26 (Vanilla Updates)
Expand Down Expand Up @@ -904,6 +917,7 @@ Thanks to miniduikboot & GD for hosting modded servers (and so much more)
[TheEpicRoles](https://github.com/LaicosVK/TheEpicRoles) - Idea for the first kill shield (partly) and the tabbed option menu (fully + some code), by **LaicosVK** **DasMonschta** **Nova**\
[Ninja](#ninja), [Thief](#thief), [Lawyer](#lawyer) / [Pursuer](#pursuer), [Deputy](#deputy), [Portalmaker](#portalmaker), [Guesser Modifier](#guesser-modifier) - Idea: [K3ndo](https://github.com/K3ndoo) ; Developed by [Gendelo](https://github.com/gendelo3) & [Mallöris](https://github.com/Mallaris) \
[ugackMiner53](https://github.com/ugackMiner53/PropHunt) - Idea and core code for the Prop Hunt game mode
Role Draft Music: [Unreal Superhero 3 by Kenët & Rez](https://www.youtube.com/watch?v=9STiQ8cCIo0)

# Settings
The mod adds a few new settings to Among Us (in addition to the role settings):
Expand Down
33 changes: 27 additions & 6 deletions TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static class HudManagerStartPatch
private static CustomButton propHuntSpeedboostButton;
public static CustomButton propHuntAdminButton;
public static CustomButton propHuntFindButton;
public static CustomButton eventKickButton;

public static Dictionary<byte, List<CustomButton>> deputyHandcuffedButtons = null;
public static PoolablePlayer targetDisplay;
Expand Down Expand Up @@ -658,7 +659,7 @@ public static void createButtonsPostfix(HudManager __instance) {
Hacker.getAdminSprite(),
CustomButton.ButtonPositions.lowerRowRight,
__instance,
KeyCode.Q,
KeyCode.G,
true,
0f,
() => {
Expand Down Expand Up @@ -719,7 +720,7 @@ public static void createButtonsPostfix(HudManager __instance) {
Hacker.getVitalsSprite(),
CustomButton.ButtonPositions.lowerRowCenter,
__instance,
KeyCode.Q,
KeyCode.H,
true,
0f,
() => {
Expand Down Expand Up @@ -773,7 +774,7 @@ public static void createButtonsPostfix(HudManager __instance) {
Tracker.getTrackCorpsesButtonSprite(),
CustomButton.ButtonPositions.lowerRowCenter,
__instance,
KeyCode.Q,
KeyCode.G,
true,
Tracker.corpsesTrackingDuration,
() => {
Expand Down Expand Up @@ -964,7 +965,7 @@ public static void createButtonsPostfix(HudManager __instance) {
Portalmaker.getUsePortalButtonSprite(),
new Vector3(0.9f, -0.06f, 0),
__instance,
KeyCode.H,
KeyCode.J,
mirror: true
);

Expand Down Expand Up @@ -1004,7 +1005,7 @@ public static void createButtonsPostfix(HudManager __instance) {
Portalmaker.getUsePortalButtonSprite(),
new Vector3(0.9f, 1f, 0),
__instance,
KeyCode.J,
KeyCode.G,
mirror: true
);

Expand Down Expand Up @@ -1360,7 +1361,7 @@ public static void createButtonsPostfix(HudManager __instance) {
SecurityGuard.getCamSprite(),
CustomButton.ButtonPositions.lowerRowRight,
__instance,
KeyCode.Q,
KeyCode.G,
true,
0f,
() => {
Expand Down Expand Up @@ -2390,6 +2391,26 @@ public static void createButtonsPostfix(HudManager __instance) {
buttonText: "FIND"
);

eventKickButton = new CustomButton(
() => {
EventUtility.kickTarget();
},
() => { return EventUtility.isEnabled && Mini.mini != null && !Mini.mini.Data.IsDead && PlayerControl.LocalPlayer != Mini.mini; },
() => { return EventUtility.currentTarget != null; },
() => { },
EventUtility.getKickButtonSprite(),
CustomButton.ButtonPositions.highRowRight,
__instance,
KeyCode.K,
true,
3f,
() => {
// onEffectEnds
eventKickButton.Timer = 69;
},
buttonText: "KICK"
);

// Set the default (or settings from the previous game) timers / durations when spawning the buttons
initialized = true;
setCustomButtonCooldowns();
Expand Down
17 changes: 8 additions & 9 deletions TheOtherRoles/CustomGameModes/PropHunt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
using TMPro;
using UnityEngine;
using UnityEngine.Video;
using static TheOtherRoles.Snitch;
using static UnityEngine.GraphicsBuffer;

namespace TheOtherRoles.CustomGameModes {
[HarmonyPatch]
Expand Down Expand Up @@ -78,7 +76,6 @@ class PropHunt {
public static float dangerMeterActive = 0f;

private static List<GameObject> duplicatedCollider = new();
private static GameObject introObject;

public static void clearAndReload() {
remainingShots.Clear();
Expand Down Expand Up @@ -368,7 +365,7 @@ public static GameObject FindClosestDisguiseObject(GameObject origin, float radi
}
bool whiteListed = false;
foreach (var whiteListedWord in whitelistedObjects) {
if (collider.gameObject.name.Contains(whiteListedWord)) whiteListed = true;
if ((bool)(collider.gameObject?.name?.Contains(whiteListedWord))) whiteListed = true;
}
if (collider.GetComponent<Console>() != null || whiteListed) {
float dist = Vector2.Distance(origin.transform.position, collider.transform.position);
Expand All @@ -379,7 +376,9 @@ public static GameObject FindClosestDisguiseObject(GameObject origin, float radi
}
}
return bestCollider.gameObject;
} catch { return null; }
} catch (Exception e) {
TheOtherRolesPlugin.Logger.LogError($"Error in find closest disguise object: {e}");
return null; }
}

public static GameObject FindPropByNameAndPos(string propName, float posX) {
Expand Down Expand Up @@ -450,7 +449,6 @@ public static void IntroCutsceneDestroyPatch(IntroCutscene __instance) {
HudManager.Instance.FullScreen.enabled = false;
videoPlayer.Destroy();
assetBundle.Unload(false);
introObject.Destroy();
} else {
HudManager.Instance.FullScreen.enabled = true;
HudManager.Instance.FullScreen.gameObject.SetActive(true);
Expand Down Expand Up @@ -523,14 +521,15 @@ public static void MakePropImpostorPatch(PlayerControl __instance) {
[HarmonyPostfix]
public static void MapSetPostfix() { // Make sure the map in the settings is in sync with the map from li
if (TORMapOptions.gameMode != CustomGamemodes.PropHunt && TORMapOptions.gameMode != CustomGamemodes.HideNSeek || AmongUsClient.Instance.IsGameStarted) return;
int map = GameOptionsManager.Instance.currentGameOptions.MapId;
int? map = GameOptionsManager.Instance?.currentGameOptions?.MapId;
if (map == null) return;
if (map > 3) map--;
if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek)
if (CustomOptionHolder.hideNSeekMap.selection != map)
CustomOptionHolder.hideNSeekMap.updateSelection(map);
CustomOptionHolder.hideNSeekMap.updateSelection((int)map);
if (TORMapOptions.gameMode == CustomGamemodes.PropHunt)
if (CustomOptionHolder.propHuntMap.selection != map)
CustomOptionHolder.propHuntMap.updateSelection(map);
CustomOptionHolder.propHuntMap.updateSelection((int)map);
}


Expand Down
24 changes: 24 additions & 0 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ public class CustomOptionHolder {
public static CustomOption modifiersCountMin;
public static CustomOption modifiersCountMax;

public static CustomOption isDraftMode;
public static CustomOption draftModeAmountOfChoices;
public static CustomOption draftModeTimeToChoose;
public static CustomOption draftModeShowRoles;
public static CustomOption draftModeHideImpRoles;
public static CustomOption draftModeHideNeutralRoles;

public static CustomOption anyPlayerCanStopStart;
public static CustomOption enableEventMode;
public static CustomOption eventReallyNoMini;
public static CustomOption eventKicksPerRound;
public static CustomOption eventHeavyAge;
public static CustomOption deadImpsBlockSabotage;

public static CustomOption mafiaSpawnRate;
Expand Down Expand Up @@ -315,6 +325,7 @@ public class CustomOptionHolder {
public static CustomOption modifierArmored;

public static CustomOption modifierShifter;
public static CustomOption modifierShifterShiftsMedicShield;

public static CustomOption maxNumberOfMeetings;
public static CustomOption blockSkippingInEmergencyMeetings;
Expand Down Expand Up @@ -433,6 +444,13 @@ public static void Load() {

if (Utilities.EventUtility.canBeEnabled) enableEventMode = CustomOption.Create(10423, Types.General, cs(Color.green, "Enable Special Mode"), true, null, true);

isDraftMode = CustomOption.Create(600, Types.General, cs(Color.yellow, "Enable Role Draft"), false, null, true, null, "Role Draft");
draftModeAmountOfChoices = CustomOption.Create(601, Types.General, cs(Color.yellow, "Max Amount Of Roles\nTo Choose From"), 5f, 2f, 15f, 1f, isDraftMode, false);
draftModeTimeToChoose = CustomOption.Create(602, Types.General, cs(Color.yellow, "Time For Selection"), 5f, 3f, 20f, 1f, isDraftMode, false);
draftModeShowRoles = CustomOption.Create(603, Types.General, cs(Color.yellow, "Show Picked Roles"), false, isDraftMode, false);
draftModeHideImpRoles = CustomOption.Create(604, Types.General, cs(Color.yellow, "Hide Impostor Roles"), false, draftModeShowRoles, false);
draftModeHideNeutralRoles = CustomOption.Create(605, Types.General, cs(Color.yellow, "Hide Neutral Roles"), false, draftModeShowRoles, false);

// Using new id's for the options to not break compatibilty with older versions
crewmateRolesCountMin = CustomOption.Create(300, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Minimum Crewmate Roles"), 15f, 0f, 15f, 1f, null, true, heading: "Min/Max Roles");
crewmateRolesCountMax = CustomOption.Create(301, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Maximum Crewmate Roles"), 15f, 0f, 15f, 1f);
Expand Down Expand Up @@ -718,6 +736,11 @@ public static void Load() {
modifierMini = CustomOption.Create(1061, Types.Modifier, cs(Color.yellow, "Mini"), rates, null, true);
modifierMiniGrowingUpDuration = CustomOption.Create(1062, Types.Modifier, "Mini Growing Up Duration", 400f, 100f, 1500f, 100f, modifierMini);
modifierMiniGrowingUpInMeeting = CustomOption.Create(1063, Types.Modifier, "Mini Grows Up In Meeting", true, modifierMini);
if (Utilities.EventUtility.canBeEnabled || Utilities.EventUtility.isEnabled) {
eventKicksPerRound = CustomOption.Create(10424, Types.Modifier, cs(Color.green, "Maximum Kicks Mini Suffers"), 4f, 0f, 14f, 1f, modifierMini);
eventHeavyAge = CustomOption.Create(10425, Types.Modifier, cs(Color.green, "Age At Which Mini Is Heavy"), 12f, 6f, 18f, 0.5f, modifierMini);
eventReallyNoMini = CustomOption.Create(10426, Types.Modifier, cs(Color.green, "Really No Mini :("), false, modifierMini, invertedParent: true);
}

modifierVip = CustomOption.Create(1070, Types.Modifier, cs(Color.yellow, "VIP"), rates, null, true);
modifierVipQuantity = CustomOption.Create(1071, Types.Modifier, cs(Color.yellow, "VIP Quantity"), ratesModifier, modifierVip);
Expand All @@ -736,6 +759,7 @@ public static void Load() {
modifierArmored = CustomOption.Create(1101, Types.Modifier, cs(Color.yellow, "Armored"), rates, null, true);

modifierShifter = CustomOption.Create(1100, Types.Modifier, cs(Color.yellow, "Shifter"), rates, null, true);
modifierShifterShiftsMedicShield = CustomOption.Create(1102, Types.Modifier, "Can Shift Medic Shield", false, modifierShifter);

// Guesser Gamemode (2000 - 2999)
guesserGamemodeCrewNumber = CustomOption.Create(2001, Types.Guesser, cs(Guesser.color, "Number of Crew Guessers"), 15f, 0f, 15f, 1f, null, true, heading: "Amount of Guessers");
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public enum CustomGamemodes {
}
public static class Helpers
{

public static string previousEndGameSummary = "";
public static Dictionary<string, Sprite> CachedSprites = new();

public static Sprite loadSpriteFromResources(string path, float pixelsPerUnit, bool cache=true) {
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace TheOtherRoles
public class TheOtherRolesPlugin : BasePlugin
{
public const string Id = "me.eisbison.theotherroles";
public const string VersionString = "4.7.0";
public const string VersionString = "4.8.0";
public static uint betaDays = 0; // amount of days for the build to be usable (0 for infinite!)

public static Version Version = Version.Parse(VersionString);
Expand Down
1 change: 0 additions & 1 deletion TheOtherRoles/Modules/CustomColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public static bool Prefix(ChatNotification __instance, PlayerControl sender, str
str = ColorUtility.ToHtmlStringRGB(c);

color = c.r + c.g + c.b > 180 ? Palette.Black : Palette.White;
TheOtherRolesPlugin.Logger.LogMessage($"{c.r}, {c.g}, {c.b}");
}
__instance.playerColorText.text = __instance.player.ColorBlindName;
__instance.playerNameText.text = "<color=#" + str + ">" + (string.IsNullOrEmpty(sender.Data.PlayerName) ? "..." : sender.Data.PlayerName);
Expand Down
Loading

0 comments on commit 61a70ef

Please sign in to comment.