mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
Pray this works simulator (v1.9.4)
This commit is contained in:
1 parent
69c13b2fba
commit
037c3ce902
23 files changed
+804
-361
No files matched your search
@@ -225,12 +225,12 @@ public static class BanManager
|
||||
if (Options.AutoKickStartAsBan.GetBool())
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(clientId, true);
|
||||
Logger.SendInGame(Translator.Get("startWordKick", player.Data.PlayerName, Options.AutoKickStartTimes.GetInt()));
|
||||
Logger.SendInGame(Translator.Get("startWordBan", player.Data.PlayerName, Options.AutoKickStartTimes.GetInt()));
|
||||
}
|
||||
else
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(clientId, false);
|
||||
Logger.SendInGame(Translator.Get("startWordBan", player.Data.PlayerName, Options.AutoKickStartTimes.GetInt()));
|
||||
Logger.SendInGame(Translator.Get("startWordKick", player.Data.PlayerName, Options.AutoKickStartTimes.GetInt()));
|
||||
}
|
||||
Logger.Info(Translator.Get("startWordKick", player.Data.PlayerName, Options.AutoKickStartTimes.GetInt()), "StartWordKick");
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ internal static class CommandHelper
|
||||
new Cmd { Name = new[] { "/sr" }, Prompt = "/sr", Description = Translator.Get("SrDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/speedrun" }, Prompt = "/speedrun", Description = Translator.Get("SrDesc"), HasVariable = false },
|
||||
|
||||
new Cmd { Name = new[] { "/pns" }, Prompt = "/pns", Description = Translator.Get("pnsDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/poofandseek" }, Prompt = "/poofandseek", Description = Translator.Get("pnsDesc"), HasVariable = false },
|
||||
|
||||
new Cmd { Name = new[] { "/eg" }, Prompt = "/eg", Description = Translator.Get("egDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/endgame" }, Prompt = "/endgame", Description = Translator.Get("egDesc"), HasVariable = false },
|
||||
|
||||
@@ -100,6 +103,7 @@ internal static class CommandHelper
|
||||
HelperText.color = new Color(0.7f, 0.7f, 0.7f, 0.7f);
|
||||
HelperText.transform.localPosition = __instance.outputText.transform.localPosition;
|
||||
HelperText.enabled = false;
|
||||
HelperText.fontSharedMaterial = new Material(__instance.outputText.fontSharedMaterial);
|
||||
}
|
||||
|
||||
string t = __instance.text;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static readonly string[] gameModes =
|
||||
{
|
||||
"Standard", "Shift And Seek", "Speedrun"
|
||||
"Standard", "Shift And Seek", "Speedrun", "Poof And Seek"
|
||||
};
|
||||
|
||||
public static readonly string[] accessLevels =
|
||||
@@ -292,11 +292,9 @@ namespace AmongUsRevamped
|
||||
public static OptionItem NumSeekers;
|
||||
|
||||
public static OptionItem TabGroupSNS;
|
||||
public static OptionItem SNSSettingsOverride;
|
||||
public static OptionItem SNSChatInGame;
|
||||
public static OptionItem SNSChatInGameExtend;
|
||||
public static OptionItem CrewAutoWinsGameAfter;
|
||||
public static OptionItem CantKillTime;
|
||||
public static OptionItem MisfiresToSuicide;
|
||||
public static OptionItem SNSDisableSabotage;
|
||||
public static OptionItem SNSDisableReactor;
|
||||
@@ -306,12 +304,27 @@ namespace AmongUsRevamped
|
||||
public static OptionItem SNSDisableHeli;
|
||||
public static OptionItem SNSDisableMushroomMixup;
|
||||
public static OptionItem SNSDisableCloseDoor;
|
||||
public static OptionItem SNSImpostorsCanVent;
|
||||
|
||||
public static OptionItem TabGroupSpeedrun;
|
||||
public static OptionItem SpeedrunSettingsOverride;
|
||||
public static OptionItem GameAutoEndsAfter;
|
||||
public static OptionItem EngineerMode;
|
||||
|
||||
public static OptionItem TabGroupPNS;
|
||||
public static OptionItem PNSChatInGame;
|
||||
public static OptionItem PNSChatInGameExtend;
|
||||
public static OptionItem PNSCrewAutoWinsGameAfter;
|
||||
public static OptionItem BadMoveTimeToSuicide;
|
||||
public static OptionItem PNSDisableSabotage;
|
||||
public static OptionItem PNSDisableReactor;
|
||||
public static OptionItem PNSDisableOxygen;
|
||||
public static OptionItem PNSDisableLights;
|
||||
public static OptionItem PNSDisableComms;
|
||||
public static OptionItem PNSDisableHeli;
|
||||
public static OptionItem PNSDisableMushroomMixup;
|
||||
public static OptionItem PNSDisableCloseDoor;
|
||||
public static OptionItem PNSImpostorsCanVent;
|
||||
|
||||
public static bool IsLoaded = false;
|
||||
|
||||
public static void Load()
|
||||
@@ -442,14 +455,11 @@ namespace AmongUsRevamped
|
||||
|
||||
TabGroupSNS = TextOptionItem.Create(70050, Translator.Get("tabGroupSNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
SNSSettingsOverride = BooleanOptionItem.Create(70051, Translator.Get("snsSettingsOverride"), true, TabGroup.GamemodeSettings, false);
|
||||
SNSChatInGame = BooleanOptionItem.Create(70063, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
SNSChatInGameExtend = BooleanOptionItem.Create(70064, Translator.Get("snsChatInGameExtend"), false, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSChatInGame);
|
||||
CantKillTime = IntegerOptionItem.Create(70053, Translator.Get("cantKillTime"), new(0, 60, 5), 20, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70052, Translator.Get("misfiresToSuicide"), new(1, 10, 1), 2, TabGroup.GamemodeSettings, false);
|
||||
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, Translator.Get("crewAutoWinsGameAfter"), new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70052, Translator.Get("misfiresToSuicide"), new(1, 10, 1), 1, TabGroup.GamemodeSettings, false);
|
||||
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, Translator.Get("crewAutoWinsGameAfter"), new(60, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
SNSDisableSabotage = BooleanOptionItem.Create(70055, Translator.Get("snsDisableSabotage"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
@@ -473,14 +483,47 @@ namespace AmongUsRevamped
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableCloseDoor = BooleanOptionItem.Create(70062, Translator.Get("snsDisableCloseDoor"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
SNSImpostorsCanVent = BooleanOptionItem.Create(70063, Translator.Get("snsImpostorCanVent"), true, TabGroup.GamemodeSettings, false);
|
||||
|
||||
TabGroupSpeedrun = TextOptionItem.Create(70075, Translator.Get("tabGroupSpeedrun"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
SpeedrunSettingsOverride = BooleanOptionItem.Create(70076, Translator.Get("speedrunSettingsOverride"), true, TabGroup.GamemodeSettings, false);
|
||||
GameAutoEndsAfter = IntegerOptionItem.Create(70077, Translator.Get("gameAutoEndsAfter"), new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
EngineerMode = BooleanOptionItem.Create(70078, Translator.Get("engineerMode"), false, TabGroup.GamemodeSettings, false);
|
||||
|
||||
TabGroupPNS = TextOptionItem.Create(70100, Translator.Get("tabGroupPNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
PNSChatInGame = BooleanOptionItem.Create(70102, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
PNSChatInGameExtend = BooleanOptionItem.Create(70103, Translator.Get("snsChatInGameExtend"), false, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSChatInGame);
|
||||
BadMoveTimeToSuicide = IntegerOptionItem.Create(70104, Translator.Get("badMoveTimeToSuicide"), new(1, 30, 1), 3, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
PNSCrewAutoWinsGameAfter = IntegerOptionItem.Create(70105, Translator.Get("crewAutoWinsGameAfter"), new(60, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
PNSDisableSabotage = BooleanOptionItem.Create(70106, Translator.Get("pnsDisableSabotage"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
PNSDisableReactor = BooleanOptionItem.Create(70107, Translator.Get("snsDisableReactor"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableOxygen = BooleanOptionItem.Create(70108, Translator.Get("snsDisableOxygen"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableLights = BooleanOptionItem.Create(70109, Translator.Get("snsDisableLights"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableComms = BooleanOptionItem.Create(70110, Translator.Get("snsDisableComms"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableHeli = BooleanOptionItem.Create(70111, Translator.Get("snsDisableHeli"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableMushroomMixup = BooleanOptionItem.Create(70112, Translator.Get("snsDisableMushroomMixup"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
PNSDisableCloseDoor = BooleanOptionItem.Create(70113, Translator.Get("pnsDisableCloseDoor"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
PNSImpostorsCanVent = BooleanOptionItem.Create(70114, Translator.Get("snsImpostorCanVent"), true, TabGroup.GamemodeSettings, false);
|
||||
|
||||
// Gameplay Settings
|
||||
TabGroupSabotages = TextOptionItem.Create(60450, Translator.Get("tabGroupSabotages"), TabGroup.ModSettings)
|
||||
.SetColor(Color.blue);
|
||||
|
||||
+102
-6
@@ -1,3 +1,4 @@
|
||||
using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -9,6 +10,7 @@ namespace AmongUsRevamped;
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.FixedUpdate))]
|
||||
public static class FixedUpdate
|
||||
{
|
||||
public static Dictionary<byte, float> BadMovementTimer = new Dictionary<byte, float>();
|
||||
public static readonly Dictionary<string, Vector2> SpawnRange = new()
|
||||
{
|
||||
["Skeld"] = new(-0.8f, 1.2f),
|
||||
@@ -93,6 +95,79 @@ public static class FixedUpdate
|
||||
Position[p.PlayerId] = p.GetTruePosition();
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
|
||||
{
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data.RoleType == RoleTypes.Phantom && !p.PhantomFadeActive && !p.Data.IsDead && p.MyPhysics.GetVelocity() != new Vector2(0, 0) && OnGameStartPatch.PastStartScreen)
|
||||
{
|
||||
if (!BadMovementTimer.ContainsKey(p.Data.PlayerId))
|
||||
{
|
||||
BadMovementTimer[p.Data.PlayerId] = 0f;
|
||||
}
|
||||
|
||||
BadMovementTimer[p.Data.PlayerId] += Time.fixedDeltaTime;
|
||||
|
||||
if (BadMovementTimer[p.Data.PlayerId] > Options.BadMoveTimeToSuicide.GetInt())
|
||||
{
|
||||
p.RpcSetRole(RoleTypes.ImpostorGhost);
|
||||
Logger.Info($" {p.Data.PlayerName} wrongfully moved for {Options.BadMoveTimeToSuicide.GetInt()}s and suicided", "SNSKillManager");
|
||||
Logger.SendInGame($" {p.Data.PlayerName} wrongfully moved for {Options.BadMoveTimeToSuicide.GetInt()}s and suicided");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We check if any SnS Shapshifter is currently nearby their correct target.
|
||||
// If so, the global Kill Cooldown is set to 1 and all killing actions may proceed.
|
||||
// If not, the global Kill Cooldown is set to 0.
|
||||
// While this value is 0, the game stops the kill cooldown from decreasing.
|
||||
// If the Kill Cooldown value is 0 by default (which it will be at the start of a match), Among Us does not allow kills at all.
|
||||
// This means most of the time, we can successfully prevent invalid kills.
|
||||
// The only problem is that if one Shapeshifter is nearby their correct target, while another is not, the second Shapeshifter can kill too.
|
||||
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && !Utils.IsLobby)
|
||||
{
|
||||
bool shapeshifterNearTarget = false;
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data == null || p.Data.IsDead || p.shapeshiftTargetPlayerId == byte.MaxValue) continue;
|
||||
|
||||
PlayerControl shapeshiftTarget = null;
|
||||
|
||||
foreach (var t in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (t.Data == null || t.Data.IsDead) continue;
|
||||
|
||||
if (t.Data.PlayerId == p.shapeshiftTargetPlayerId)
|
||||
{
|
||||
shapeshiftTarget = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shapeshiftTarget == null) continue;
|
||||
|
||||
float distance = Vector2.Distance(p.GetTruePosition(), shapeshiftTarget.GetTruePosition());
|
||||
|
||||
if (distance <= 3f)
|
||||
{
|
||||
shapeshifterNearTarget = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float newCooldown = shapeshifterNearTarget ? 1f : 0f;
|
||||
|
||||
if (Main.NormalOptions.KillCooldown != newCooldown)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = newCooldown;
|
||||
OptionManager.SyncGameOptions();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSpawn(Vector2 pos)
|
||||
@@ -127,10 +202,16 @@ class FixedUpdateInGamePatch
|
||||
private static float t;
|
||||
private static GameObject settingsLabel;
|
||||
|
||||
public static bool CanUseKillButton(PlayerControl pc)
|
||||
{
|
||||
pc.Data.Role.CanUseKillButton = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255 || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
|
||||
t += Time.deltaTime;
|
||||
if (t < 0.2f) return;
|
||||
t = 0f;
|
||||
@@ -159,19 +240,22 @@ class FixedUpdateInGamePatch
|
||||
|
||||
switch (gamemode)
|
||||
{
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1: // SnS
|
||||
if (Main.NormalOptions.KillCooldown != 2.5f)
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
|
||||
if (Options.SNSSettingsOverride.GetBool() && settingsLabel == null)
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
if (Utils.InGame) return;
|
||||
if (Main.NormalOptions.KillCooldown != 1f) Main.NormalOptions.KillCooldown = 1f;
|
||||
break;
|
||||
|
||||
case 2: // Speedrun
|
||||
break;
|
||||
|
||||
case 3: // PnS
|
||||
if (Utils.InGame) return;
|
||||
if (Main.NormalOptions.KillCooldown != 1f) Main.NormalOptions.KillCooldown = 1f;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Utils.InGame && !Utils.IsMeeting && !ExileController.Instance)
|
||||
@@ -200,6 +284,18 @@ class FixedUpdateInGamePatch
|
||||
NormalGameEndChecker.CheckWinnerText("NoOneWinsSpeedrun");
|
||||
}
|
||||
}
|
||||
// 3 = Poof and Seek
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
|
||||
{
|
||||
if (Main.GameTimer > Options.PNSCrewAutoWinsGameAfter.GetInt())
|
||||
{
|
||||
Main.GameTimer = 0f;
|
||||
|
||||
Utils.ContinueEndGame((byte)GameOverReason.CrewmatesByVote);
|
||||
Logger.Info($" Crewmates won because the game took longer than {Options.PNSCrewAutoWinsGameAfter.GetInt()}s", "PNSManager");
|
||||
NormalGameEndChecker.CheckWinnerText("PnSTimer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using System;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
public static class OptionManager
|
||||
{
|
||||
private static OptionBackupData CachedOptions;
|
||||
public static void SyncGameOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var options = GameOptionsManager.Instance.CurrentGameOptions;
|
||||
|
||||
foreach (var component in GameManager.Instance.LogicComponents)
|
||||
{
|
||||
var logicOptions = component.TryCast<LogicOptions>();
|
||||
|
||||
if (logicOptions != null)
|
||||
{
|
||||
logicOptions.SetGameOptions(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CacheOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
CachedOptions = new OptionBackupData(GameOptionsManager.Instance.CurrentGameOptions);
|
||||
}
|
||||
|
||||
public static void RestoreOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || CachedOptions == null) return;
|
||||
|
||||
var restored = CachedOptions.Restore(GameOptionsManager.Instance.CurrentGameOptions);
|
||||
|
||||
GameOptionsManager.Instance.CurrentGameOptions = restored;
|
||||
|
||||
SyncGameOptions();
|
||||
}
|
||||
}
|
||||
@@ -229,6 +229,17 @@ public static class Utils
|
||||
PlayerControlSetRolePatch.manualSeekers.Clear();
|
||||
|
||||
OnGameStartPatch.PastStartScreen = false;
|
||||
|
||||
FixedUpdate.BadMovementTimer.Clear();
|
||||
|
||||
skeldVotes = 0;
|
||||
miraVotes = 0;
|
||||
polusVotes = 0;
|
||||
airshipVotes = 0;
|
||||
fungleVotes = 0;
|
||||
dleksVotes = 0;
|
||||
HasVoted.Clear();
|
||||
MapVoteActive = false;
|
||||
}
|
||||
|
||||
public static PlayerControl[] AllAlivePlayerControls
|
||||
|
||||
Reference in new issue
Block a user