Skip to content

Commit

Permalink
Add Support AU 2023.7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanTheFungle committed Jul 16, 2023
1 parent 6bacd92 commit a08ddd2
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 83 deletions.
4 changes: 2 additions & 2 deletions PropHunt/CustomRoleSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public static void PropOptionsMenuPatch(RolesSettingsMenu __instance)
}


[HarmonyPatch(typeof(GameOptionsData), nameof(GameOptionsData.ToHudString))]
[HarmonyPatch(typeof(IGameOptionsExtensions), nameof(IGameOptionsExtensions.ToHudString))]
[HarmonyPrefix]
public static void SyncCustomSettings(GameOptionsData __instance)
public static void SyncCustomSettings()
{
if (hidingOption && maxMissOption && infectionOption)
{
Expand Down
54 changes: 27 additions & 27 deletions PropHunt/Patches.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Patches for PropHuntPlugin
// Copyright (C) 2022 ugackMiner
// Copyright (C) 2023 ugackMiner
using HarmonyLib;
using Reactor;
using Reactor.Utilities.Extensions;
using UnityEngine;
using AmongUs.Data;
using Reactor.Utilities;
using AmongUs.GameOptions;
using TMPro;

namespace PropHunt
{
Expand Down Expand Up @@ -51,15 +53,15 @@ public static void PlayerControlStartPatch(PlayerControl __instance)
{
__instance.gameObject.AddComponent<SpriteRenderer>();
__instance.GetComponent<CircleCollider2D>().radius = 0.00001f;
if (AmongUsClient.Instance.GameMode != GameModes.FreePlay)
if (AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay)
{
GameObject.FindObjectOfType<PingTracker>().enabled = false;
}
}


// Runs periodically, resets animation data for players
[HarmonyPatch(typeof(PlayerPhysics), "HandleAnimation")]
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.HandleAnimation))]
[HarmonyPostfix]
public static void PlayerPhysicsAnimationPatch(PlayerPhysics __instance)
{
Expand Down Expand Up @@ -101,9 +103,9 @@ public static void MakePropImpostorPatch(PlayerControl __instance)
}

// Make it so that seekers only win if they got ALL the props
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.CheckEndCriteria))]
[HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))]
[HarmonyPrefix]
public static bool CheckEndPatch(ShipStatus __instance)
public static bool CheckEndPatch(LogicGameFlowNormal __instance)
{
if (!GameData.Instance || TutorialManager.InstanceExists)
{
Expand Down Expand Up @@ -139,10 +141,10 @@ public static bool CheckEndPatch(ShipStatus __instance)
if (DestroyableSingleton<TutorialManager>.InstanceExists)
{
DestroyableSingleton<HudManager>.Instance.ShowPopUp(DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.GameOverImpostorKills, System.Array.Empty<Il2CppSystem.Object>()));
ShipStatus.ReviveEveryone();
GameManager.Instance.ReviveEveryoneFreeplay();
return false;
}
if (PlayerControl.GameOptions.gameType == GameType.Normal)
if (GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.Normal)
{
GameOverReason endReason;
switch (TempData.LastDeathReason)
Expand All @@ -157,16 +159,16 @@ public static bool CheckEndPatch(ShipStatus __instance)
endReason = GameOverReason.ImpostorByVote;
break;
}
ShipStatus.RpcEndGame(endReason, !DataManager.Player.Ads.HasPurchasedAdRemoval);
GameManager.Instance.RpcEndGame(endReason, !DataManager.Player.Ads.HasPurchasedAdRemoval);
return false;
}
}
else if (!DestroyableSingleton<TutorialManager>.InstanceExists)
{
if (PlayerControl.GameOptions.gameType == GameType.Normal && GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks)
if (GameOptionsManager.Instance.currentNormalGameOptions.GameMode == GameModes.Normal && GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks)
{
__instance.enabled = false;
ShipStatus.RpcEndGame(GameOverReason.HumansByTask, !DataManager.Player.Ads.HasPurchasedAdRemoval);
ShipStatus.Instance.enabled = false;
GameManager.Instance.RpcEndGame(GameOverReason.HumansByTask, !DataManager.Player.Ads.HasPurchasedAdRemoval);
return false;
}
}
Expand All @@ -183,13 +185,13 @@ public static bool CheckEndPatch(ShipStatus __instance)
if (allComplete)
{
DestroyableSingleton<HudManager>.Instance.ShowPopUp(DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.GameOverTaskWin, System.Array.Empty<Il2CppSystem.Object>()));
__instance.Begin();
ShipStatus.Instance.Begin();
}

}
if (aliveImpostors <= 0)
{
ShipStatus.RpcEndGame(GameOverReason.HumansByVote, !DataManager.Player.Ads.HasPurchasedAdRemoval);
GameManager.Instance.RpcEndGame(GameOverReason.HumansByVote, !DataManager.Player.Ads.HasPurchasedAdRemoval);
return false;
}
return false;
Expand All @@ -213,9 +215,9 @@ public static void KillButtonClickPatch(KillButton __instance)
if (__instance.currentTarget == null && !__instance.isCoolingDown && !PlayerControl.LocalPlayer.Data.IsDead && !PlayerControl.LocalPlayer.inVent)
{
PropHuntPlugin.missedKills++;
if (AmongUsClient.Instance.GameMode != GameModes.FreePlay)
if (AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay)
{
TMPro.TextMeshPro pingText = GameObject.FindObjectOfType<PingTracker>().text;
TextMeshPro pingText = GameObject.FindObjectOfType<PingTracker>().text;
pingText.text = string.Format("Remaining Attempts: {0}", PropHuntPlugin.maxMissedKills - PropHuntPlugin.missedKills);
pingText.color = Color.red;
}
Expand All @@ -225,7 +227,7 @@ public static void KillButtonClickPatch(KillButton __instance)
PropHuntPlugin.missedKills = 0;
}
Coroutines.Start(PropHuntPlugin.Utility.KillConsoleAnimation());
GameObject closestProp = PropHuntPlugin.Utility.FindClosestConsole(PlayerControl.LocalPlayer.gameObject, GameOptionsData.KillDistances[Mathf.Clamp(PlayerControl.GameOptions.KillDistance, 0, 2)]);
GameObject closestProp = PropHuntPlugin.Utility.FindClosestConsole(PlayerControl.LocalPlayer.gameObject, GameOptionsData.KillDistances[Mathf.Clamp(GameOptionsManager.Instance.currentNormalGameOptions.KillDistance, 0, 2)]);
if (closestProp != null)
{
GameObject.Destroy(closestProp.gameObject);
Expand All @@ -234,11 +236,11 @@ public static void KillButtonClickPatch(KillButton __instance)
}

// Make the game start with AT LEAST one impostor (happens if there are >4 players)
[HarmonyPatch(typeof(GameOptionsData), nameof(GameOptionsData.GetAdjustedNumImpostors))]
[HarmonyPatch(typeof(IGameOptionsExtensions), nameof(IGameOptionsExtensions.GetAdjustedNumImpostors))]
[HarmonyPrefix]
public static bool ForceNotZeroImps(GameOptionsData __instance, ref int __result)
public static bool ForceNotZeroImps(ref int __result)
{
int numImpostors = PlayerControl.GameOptions.NumImpostors;
int numImpostors = GameOptionsManager.Instance.currentNormalGameOptions.NumImpostors;
int num = 3;
if (GameData.Instance.PlayerCount < GameOptionsData.MaxImpostors.Length)
{
Expand All @@ -252,14 +254,12 @@ public static bool ForceNotZeroImps(GameOptionsData __instance, ref int __result
return false;
}



// Change the minimum amount of players to start a game
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Start))]
[HarmonyPostfix]
public static void MinPlayerPatch(GameStartManager __instance)
{
__instance.MinPlayers = 2;
__instance.MinPlayers = 4;
}

// Disable a lot of stuff
Expand Down Expand Up @@ -304,9 +304,9 @@ public static void IntroCuscenePatch()
}

// Change the role text
[HarmonyPatch(typeof(IntroCutscene._ShowRole_d__24), nameof(IntroCutscene._ShowRole_d__24.MoveNext))]
[HarmonyPatch(typeof(IntroCutscene._ShowRole_d__39), nameof(IntroCutscene._ShowRole_d__39.MoveNext))]
[HarmonyPostfix]
public static void IntroCutsceneRolePatch(IntroCutscene._ShowRole_d__24 __instance)
public static void IntroCutsceneRolePatch(IntroCutscene._ShowRole_d__39 __instance)
{
// IEnumerator hooking (help from @Daemon#6489 in the reactor discord)
if (__instance.__1__state == 1)
Expand All @@ -325,9 +325,9 @@ public static void IntroCutsceneRolePatch(IntroCutscene._ShowRole_d__24 __instan
}

// Extend the intro cutscene for impostors
[HarmonyPatch(typeof(IntroCutscene._CoBegin_d__19), nameof(IntroCutscene._CoBegin_d__19.MoveNext))]
[HarmonyPatch(typeof(IntroCutscene._CoBegin_d__33), nameof(IntroCutscene._CoBegin_d__33.MoveNext))]
[HarmonyPrefix]
public static bool IntroCutsceneCoBeginPatch(IntroCutscene._CoBegin_d__19 __instance)
public static bool IntroCutsceneCoBeginPatch(IntroCutscene._CoBegin_d__33 __instance)
{
if (__instance.__1__state != 2 || !PlayerControl.LocalPlayer.Data.Role.IsImpostor)
{
Expand Down
28 changes: 28 additions & 0 deletions PropHunt/PingTrackerUpdate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using HarmonyLib;
using UnityEngine;

namespace PropHunt
{
//[HarmonyPriority(Priority.VeryHigh)] // to show this message first, or be overrided if any plugins do
[HarmonyPatch(typeof(PingTracker), nameof(PingTracker.Update))]
public static class PingTracker_Update
{

[HarmonyPostfix]
public static void Postfix(PingTracker __instance)
{
var position = __instance.GetComponent<AspectPosition>();
position.DistanceFromEdge = new Vector3(3.6f, 0.1f, 0);
position.AdjustPosition();

__instance.text.text =
"<color=#00FF00FF>PropHunt v" + PropHuntPlugin.VersionString + "</color>\n" +
$"Ping: {AmongUsClient.Instance.Ping}ms\n" +
(!MeetingHud.Instance
? "<color=#00FF00FF>Modded By: ugackMiner53 &</color>\n" +
"<color=#00FF00FF>Continued : JeanAU</color>\n" : "") +
(AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started
? "<color=#00FF00FF>Formerly:Continued by : JeanAU</color>" : "");
}
}
}
12 changes: 5 additions & 7 deletions PropHunt/PropHunt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
<LangVersion>latest</LangVersion>
<DebugType>embedded</DebugType>

<VersionPrefix>2022.11.5</VersionPrefix>
<VersionPrefix>2023.7.11</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<Description>Prop Hunt Mod</Description>
<Description>Prop Hunt Mod Reactivited</Description>
<Authors>ugackMiner</Authors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Reactor" Version="2.0.0" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.662" Private="false" ExcludeAssets="runtime;native" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2022.10.25" PrivateAssets="all" />

<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="Reactor" Version="2.1.0" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.670" Private="false" ExcludeAssets="runtime;native" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.7.11" PrivateAssets="all" />
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.0.1" PrivateAssets="all" ExcludeAssets="runtime" />
</ItemGroup>

Expand Down
13 changes: 8 additions & 5 deletions PropHunt/PropHuntPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
namespace PropHunt;


[BepInPlugin("com.ugackminer.amongus.prophunt", "Prop Hunt", "v2022.11.5")]
[BepInPlugin("com.jeanau.prophunt-r", "Prop Hunt-Reactivited", VersionString)]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
public partial class PropHuntPlugin : BasePlugin
{
public const string VersionString = "2023.7.16";

// Backend Variables
public Harmony Harmony { get; } = new("com.ugackminer.amongus.prophunt");
public Harmony Harmony { get; } = new("com.jeanau.prophunt-r");

public ConfigEntry<float> HidingTime { get; private set; }
public ConfigEntry<int> MaxMissedKills { get; private set; }
public ConfigEntry<bool> Infection { get; private set; }
Expand Down Expand Up @@ -109,10 +112,10 @@ public static System.Collections.IEnumerator KillConsoleAnimation()
if (Constants.ShouldPlaySfx())
{
SoundManager.Instance.PlaySound(ShipStatus.Instance.SabotageSound, false, 0.8f);
HudManager.Instance.FullScreen.color = new Color(1f, 0f, 0f, 0.372549027f);
HudManager.Instance.FullScreen.gameObject.SetActive(true);
DestroyableSingleton<HudManager>.Instance.FullScreen.color = new Color(1f, 0f, 0f, 0.372549027f);
DestroyableSingleton<HudManager>.Instance.FullScreen.gameObject.SetActive(true);
yield return new WaitForSeconds(0.5f);
HudManager.Instance.FullScreen.gameObject.SetActive(false);
DestroyableSingleton<HudManager>.Instance.FullScreen.gameObject.SetActive(false);
}
yield break;
}
Expand Down
33 changes: 33 additions & 0 deletions PropHunt/VersionShower.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using HarmonyLib;
using UnityEngine;

namespace PropHunt
{
[HarmonyPriority(Priority.VeryHigh)] // to show this message first, or be overrided if any plugins do
[HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))]
public static class VersionShowerUpdate
{
public static void Postfix(VersionShower __instance)
{
var text = __instance.text;
text.text += " - <color=#ff0000>TownOfUs v" + PropHuntPlugin.VersionString + "</color>";
text.transform.localPosition += new Vector3(-0.8f, -0.08f, 0f);

if (GameObject.Find("RightPanel"))
{
text.transform.SetParent(GameObject.Find("RightPanel").transform);

var aspect = text.gameObject.AddComponent<AspectPosition>();
aspect.Alignment = AspectPosition.EdgeAlignments.Top;
aspect.DistanceFromEdge = new Vector3(-0.2f, 2.5f, 8f);

aspect.StartCoroutine(Effects.Lerp(0.1f, new System.Action<float>((p) =>
{
aspect.AdjustPosition();
})));

return;
}
}
}
}
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[![Made With Reactor](./Images/madewithreactor.png)](https://github.com/NuclearPowered/Reactor)
### Note : __Note: This repository is an unofficial continuation of PropHunt due to the original repository being discontinued__.

[![Made With Reactor](./Images/madewithreactor.png)](https://github.com/NuclearPowered/Reactor)

![Prop Hunt Logo](./Images/prophuntlogo.png)

```Compatible with 2022.10.25s ```
```Compatible with Among Us 2023.7.12s ```
# Prop Hunt

A mod for [Among Us](https://store.steampowered.com/app/945360/Among_Us/) which adds a completely new gamemode, Prop Hunt!
A mod for [Among Us](https://store.steampowered.com/app/945360/Among_Us/) which adds a completely new gamemode, Prop Hunt Reactivited!


## How To Play
Expand All @@ -31,14 +33,18 @@ Prop Hunt replaces the default roles in the game with two new roles, the **Seeke
| Infection Mode | Whether Props become Seekers when they are killed | True |

## Installation
Download the zip from the [latest release](https://github.com/ugackMiner53/PropHunt/releases), and extract the contents into your Among Us game folder.
Download the zip from the [latest release](https://github.com/JeanAU/PropHunt-Reactivited/releases), and extract the contents into your Among Us game folder.

Although the mod *may* work on official servers, it is highly discouraged to do so, and will likely get you banned. Instead, try to setup your own modded server using [Impostor](https://github.com/Impostor/Impostor), [Hindenburg](https://github.com/SkeldJS/Hindenburg) or another Reactor compatible server.
Although the mod *may* work on official servers, it is highly discouraged to do so, and will likely get you banned. Instead, try to add [MiniRegionInstall](https://github.com/miniduikboot/Mini.RegionInstall) you can see in their github repo.

## Compatability
Prop Hunt is fully compatible with [Submerged](https://github.com/SubmergedAmongUs/Submerged)!
Prop Hunt is fully compatible with [Submerged] (https://github.com/SubmergedAmongUs/Submerged)!


However, Prop Hunt will **not** work with many other mods, such as role mods and any other mod which modifies the gameplay loop.

## Contributing
Contributions are welcome! Submit a [pull request](https://github.com/ugackMiner53/PropHunt/pulls) and give a brief description and the code will be reviewed as soon as possible.
Contributions are welcome! Submit a [pull request](https://github.com/JeanAU/PropHunt-Reactivited/pulls) and give a brief description and the code will be reviewed as soon as possible.

## Issues ?
If you have any bugs or any need to contact me, join the Discord Server or create a ticket on GitHub.
34 changes: 0 additions & 34 deletions build.cake

This file was deleted.

4 changes: 3 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<configuration>
<packageSources>
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Samboy063" value="https://nuget.samboy.dev/v3/index.json" />
</packageSources>
</configuration>

0 comments on commit a08ddd2

Please sign in to comment.