mirror of
https://github.com/Brybry16/BetterPolus.git
synced 2026-10-19 15:51:40 +00:00
v2023.7.12+ support + config file entry + tasks room adjustment
This commit is contained in:
1 parent
e764e1daac
commit
137db3e1a1
10 files changed
+448
-374
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.2.0</Version>
|
||||
<Version>1.2.1</Version>
|
||||
|
||||
<Description>An Among Us mod that tweaks Polus, allowing a more balanced experience.</Description>
|
||||
<Authors>Brybry</Authors>
|
||||
@@ -10,12 +10,15 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2022.10.25" />
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.662" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.0.1" />
|
||||
<PackageReference Include="Reactor" Version="2.0.0" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.7.11" />
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.672" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="Copy" AfterTargets="Build">
|
||||
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFiles="$(AmongUs)/BepInEx/plugins/$(AssemblyName).dll" />
|
||||
</Target>
|
||||
|
||||
@@ -1,47 +1,33 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
|
||||
namespace BetterPolus
|
||||
namespace BetterPolus;
|
||||
|
||||
[BepInPlugin(Id, Name, Version)]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public class BetterPolusPlugin : BasePlugin
|
||||
{
|
||||
[BepInPlugin(Id, Name, Version)]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public class BetterPolusPlugin : BasePlugin
|
||||
private const string Id = "ch.brybry.betterpolus";
|
||||
private const string Name = "BetterPolus Mod";
|
||||
public const string Version = "1.2.1";
|
||||
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
public static ManualLogSource log;
|
||||
public static ConfigEntry<bool> Enabled { get; private set; }
|
||||
public static ConfigEntry<float> ReactorCountdown { get; private set; }
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
public const string Id = "ch.brybry.betterpolus";
|
||||
public const string Name = "BetterPolus Mod";
|
||||
public const string Version = "1.2.0";
|
||||
log = Log;
|
||||
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
public static ManualLogSource log;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
log = Log;
|
||||
Enabled = Config.Bind("Polus", "Enable Better Polus", true, "Enable Polus map modifications");
|
||||
ReactorCountdown = Config.Bind("Polus", "Reactor Countdown", 40f, "Reactor sabotage countdown in Polus map");
|
||||
|
||||
log.LogMessage($"{Name} loaded");
|
||||
log.LogMessage($"{Name} loaded");
|
||||
|
||||
Harmony.PatchAll();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))]
|
||||
public static class VersionShowerPatch
|
||||
{
|
||||
public static void Postfix(VersionShower __instance)
|
||||
{
|
||||
__instance.text.text += $"<size=70%> + <color=#5E4CA6FF>BetterPolus v{Version}</color> by Brybry</size>";
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.Awake))]
|
||||
public static class ModStampPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
public static void Prefix()
|
||||
{
|
||||
DestroyableSingleton<ModManager>.Instance.ShowModStamp();
|
||||
}
|
||||
}
|
||||
Harmony.PatchAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterPolus.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsClient))]
|
||||
public static class AmongUsClientPatches
|
||||
{
|
||||
[HarmonyPatch(nameof(AmongUsClient.Awake))]
|
||||
[HarmonyPrefix]
|
||||
private static void AwakePrefix()
|
||||
{
|
||||
DestroyableSingleton<ModManager>.Instance.ShowModStamp();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using Il2CppSystem.Text;
|
||||
|
||||
namespace BetterPolus.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(NormalPlayerTask))]
|
||||
public static class NormalPlayerTaskPatches
|
||||
{
|
||||
private static readonly List<TaskTypes> TaskTypesToPatch = new()
|
||||
{ TaskTypes.RebootWifi, TaskTypes.RecordTemperature, TaskTypes.ChartCourse };
|
||||
|
||||
[HarmonyPatch(nameof(NormalPlayerTask.AppendTaskText))]
|
||||
[HarmonyPrefix]
|
||||
private static bool AppendTaskTextPrefix(NormalPlayerTask __instance, StringBuilder sb)
|
||||
{
|
||||
if (!BetterPolusPlugin.Enabled.Value || !ShipStatus.Instance || ShipStatus.Instance.Type != ShipStatus.MapType.Pb) return true;
|
||||
if (!TaskTypesToPatch.Contains(__instance.TaskType)) return true;
|
||||
var flag = __instance.ShouldYellowText();
|
||||
if (flag)
|
||||
{
|
||||
sb.Append(__instance.IsComplete ? "<color=#00DD00FF>" : "<color=#FFFF00FF>");
|
||||
}
|
||||
|
||||
var room = GetUpdatedRoom(__instance);
|
||||
|
||||
sb.Append(DestroyableSingleton<TranslationController>.Instance.GetString(room));
|
||||
sb.Append(": ");
|
||||
sb.Append(DestroyableSingleton<TranslationController>.Instance.GetString(__instance.TaskType));
|
||||
if (__instance is { ShowTaskTimer: true, TimerStarted: NormalPlayerTask.TimerState.Started })
|
||||
{
|
||||
sb.Append(" (");
|
||||
sb.Append(DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.SecondsAbbv,
|
||||
(int)__instance.TaskTimer));
|
||||
sb.Append(")");
|
||||
}
|
||||
else if (__instance.ShowTaskStep)
|
||||
{
|
||||
sb.Append(" (");
|
||||
sb.Append(__instance.taskStep);
|
||||
sb.Append("/");
|
||||
sb.Append(__instance.MaxStep);
|
||||
sb.Append(")");
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
sb.Append("</color>");
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static SystemTypes GetUpdatedRoom(NormalPlayerTask task)
|
||||
{
|
||||
return task.TaskType switch
|
||||
{
|
||||
TaskTypes.RecordTemperature => SystemTypes.Outside,
|
||||
TaskTypes.RebootWifi => SystemTypes.Dropship,
|
||||
TaskTypes.ChartCourse => SystemTypes.Comms,
|
||||
_ => task.StartAt
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterPolus.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(ReactorSystemType))]
|
||||
public static class ReactorSystemTypePatches
|
||||
{
|
||||
[HarmonyPatch(nameof(ReactorSystemType.RepairDamage))]
|
||||
[HarmonyPrefix]
|
||||
private static bool RepairDamagePrefix(ReactorSystemType __instance, PlayerControl player, byte opCode)
|
||||
{
|
||||
if (ShipStatus.Instance.Type != ShipStatus.MapType.Pb || opCode != 128 || __instance.IsActive) return true;
|
||||
|
||||
__instance.Countdown = BetterPolusPlugin.ReactorCountdown.Value;
|
||||
__instance.UserConsolePairs.Clear();
|
||||
__instance.IsDirty = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterPolus.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus))]
|
||||
public static class ShipStatusPatches
|
||||
{
|
||||
// Positions
|
||||
public static readonly Vector3 DvdScreenNewPos = new Vector3(26.635f, -15.92f, 1f);
|
||||
public static readonly Vector3 VitalsNewPos = new Vector3(31.275f, -6.45f, 1f);
|
||||
|
||||
public static readonly Vector3 WifiNewPos = new Vector3(15.975f, 0.084f, 1f);
|
||||
public static readonly Vector3 NavNewPos = new Vector3(11.07f, -15.298f, -0.015f);
|
||||
|
||||
public static readonly Vector3 TempColdNewPos = new Vector3(7.772f, -17.103f, -0.017f);
|
||||
|
||||
// Scales
|
||||
public const float DvdScreenNewScale = 0.75f;
|
||||
|
||||
// Checks
|
||||
public static bool IsAdjustmentsDone;
|
||||
public static bool IsObjectsFetched;
|
||||
public static bool IsRoomsFetched;
|
||||
public static bool IsVentsFetched;
|
||||
|
||||
// Tasks Tweak
|
||||
public static Console WifiConsole;
|
||||
public static Console NavConsole;
|
||||
|
||||
// Vitals Tweak
|
||||
public static SystemConsole Vitals;
|
||||
public static GameObject DvdScreenOffice;
|
||||
|
||||
// Vents Tweak
|
||||
public static Vent ElectricBuildingVent;
|
||||
public static Vent ElectricalVent;
|
||||
public static Vent ScienceBuildingVent;
|
||||
public static Vent StorageVent;
|
||||
|
||||
// TempCold Tweak
|
||||
public static Console TempCold;
|
||||
|
||||
// Rooms
|
||||
public static GameObject Comms;
|
||||
public static GameObject DropShip;
|
||||
public static GameObject Outside;
|
||||
public static GameObject Science;
|
||||
|
||||
private static void ApplyChanges(ShipStatus instance)
|
||||
{
|
||||
if (instance.Type == ShipStatus.MapType.Pb)
|
||||
{
|
||||
FindPolusObjects();
|
||||
AdjustPolus();
|
||||
}
|
||||
}
|
||||
|
||||
public static void FindPolusObjects()
|
||||
{
|
||||
FindVents();
|
||||
FindRooms();
|
||||
FindObjects();
|
||||
}
|
||||
|
||||
public static void AdjustPolus()
|
||||
{
|
||||
if (IsObjectsFetched && IsRoomsFetched)
|
||||
{
|
||||
MoveVitals();
|
||||
SwitchNavWifi();
|
||||
MoveTempCold();
|
||||
}
|
||||
else
|
||||
{
|
||||
BetterPolusPlugin.log.LogError("Couldn't move elements as not all of them have been fetched.");
|
||||
}
|
||||
|
||||
AdjustVents();
|
||||
|
||||
IsAdjustmentsDone = true;
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// - Objects Fetching -
|
||||
// --------------------
|
||||
|
||||
public static void FindVents()
|
||||
{
|
||||
var ventsList = Object.FindObjectsOfType<Vent>().ToList();
|
||||
|
||||
if (ElectricBuildingVent == null)
|
||||
{
|
||||
ElectricBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ElectricBuildingVent");
|
||||
}
|
||||
|
||||
if (ElectricalVent == null)
|
||||
{
|
||||
ElectricalVent = ventsList.Find(vent => vent.gameObject.name == "ElectricalVent");
|
||||
}
|
||||
|
||||
if (ScienceBuildingVent == null)
|
||||
{
|
||||
ScienceBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ScienceBuildingVent");
|
||||
}
|
||||
|
||||
if (StorageVent == null)
|
||||
{
|
||||
StorageVent = ventsList.Find(vent => vent.gameObject.name == "StorageVent");
|
||||
}
|
||||
|
||||
IsVentsFetched = ElectricBuildingVent != null && ElectricalVent != null && ScienceBuildingVent != null &&
|
||||
StorageVent != null;
|
||||
}
|
||||
|
||||
public static void FindRooms()
|
||||
{
|
||||
if (Comms == null)
|
||||
{
|
||||
Comms = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Comms");
|
||||
}
|
||||
|
||||
if (DropShip == null)
|
||||
{
|
||||
DropShip = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Dropship");
|
||||
}
|
||||
|
||||
if (Outside == null)
|
||||
{
|
||||
Outside = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Outside");
|
||||
}
|
||||
|
||||
if (Science == null)
|
||||
{
|
||||
Science = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Science");
|
||||
}
|
||||
|
||||
IsRoomsFetched = Comms != null && DropShip != null && Outside != null && Science != null;
|
||||
}
|
||||
|
||||
public static void FindObjects()
|
||||
{
|
||||
if (WifiConsole == null)
|
||||
{
|
||||
WifiConsole = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_wifi");
|
||||
}
|
||||
|
||||
if (NavConsole == null)
|
||||
{
|
||||
NavConsole = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_nav");
|
||||
}
|
||||
|
||||
if (Vitals == null)
|
||||
{
|
||||
Vitals = Object.FindObjectsOfType<SystemConsole>().ToList()
|
||||
.Find(console => console.name == "panel_vitals");
|
||||
}
|
||||
|
||||
if (DvdScreenOffice == null)
|
||||
{
|
||||
GameObject DvdScreenAdmin = Object.FindObjectsOfType<GameObject>().ToList()
|
||||
.Find(o => o.name == "dvdscreen");
|
||||
|
||||
if (DvdScreenAdmin != null)
|
||||
{
|
||||
DvdScreenOffice = Object.Instantiate(DvdScreenAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
if (TempCold == null)
|
||||
{
|
||||
TempCold = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_tempcold");
|
||||
}
|
||||
|
||||
IsObjectsFetched = WifiConsole != null && NavConsole != null && Vitals != null &&
|
||||
DvdScreenOffice != null && TempCold != null;
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// - Map Adjustments -
|
||||
// -------------------
|
||||
|
||||
public static void AdjustVents()
|
||||
{
|
||||
if (IsVentsFetched)
|
||||
{
|
||||
ElectricBuildingVent.Left = ElectricalVent;
|
||||
ElectricalVent.Center = ElectricBuildingVent;
|
||||
|
||||
ScienceBuildingVent.Left = StorageVent;
|
||||
StorageVent.Center = ScienceBuildingVent;
|
||||
}
|
||||
else
|
||||
{
|
||||
BetterPolusPlugin.log.LogError("Couldn't adjust Vents as not all objects have been fetched.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveTempCold()
|
||||
{
|
||||
if (TempCold.transform.position != TempColdNewPos)
|
||||
{
|
||||
Transform tempColdTransform = TempCold.transform;
|
||||
tempColdTransform.parent = Outside.transform;
|
||||
tempColdTransform.position = TempColdNewPos;
|
||||
|
||||
// Fixes collider being too high
|
||||
BoxCollider2D collider = TempCold.GetComponent<BoxCollider2D>();
|
||||
collider.isTrigger = false;
|
||||
collider.size += new Vector2(0f, -0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SwitchNavWifi()
|
||||
{
|
||||
if (WifiConsole.transform.position != WifiNewPos)
|
||||
{
|
||||
Transform wifiTransform = WifiConsole.transform;
|
||||
wifiTransform.parent = DropShip.transform;
|
||||
wifiTransform.position = WifiNewPos;
|
||||
}
|
||||
|
||||
if (NavConsole.transform.position != NavNewPos)
|
||||
{
|
||||
Transform navTransform = NavConsole.transform;
|
||||
navTransform.parent = Comms.transform;
|
||||
navTransform.position = NavNewPos;
|
||||
|
||||
// Prevents crewmate being able to do the task from outside
|
||||
NavConsole.checkWalls = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveVitals()
|
||||
{
|
||||
if (Vitals.transform.position != VitalsNewPos)
|
||||
{
|
||||
// Vitals
|
||||
Transform vitalsTransform = Vitals.gameObject.transform;
|
||||
vitalsTransform.parent = Science.transform;
|
||||
vitalsTransform.position = VitalsNewPos;
|
||||
}
|
||||
|
||||
if (DvdScreenOffice.transform.position != DvdScreenNewPos)
|
||||
{
|
||||
// DvdScreen
|
||||
Transform dvdScreenTransform = DvdScreenOffice.transform;
|
||||
dvdScreenTransform.position = DvdScreenNewPos;
|
||||
|
||||
var localScale = dvdScreenTransform.localScale;
|
||||
localScale =
|
||||
new Vector3(DvdScreenNewScale, localScale.y,
|
||||
localScale.z);
|
||||
dvdScreenTransform.localScale = localScale;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(ShipStatus.Begin))]
|
||||
[HarmonyPrefix]
|
||||
private static void BeginPrefix(ShipStatus __instance)
|
||||
{
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(ShipStatus.Awake))]
|
||||
[HarmonyPrefix]
|
||||
private static void AwakePrefix(ShipStatus __instance)
|
||||
{
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(ShipStatus.FixedUpdate))]
|
||||
[HarmonyPrefix]
|
||||
private static void FixedUpdate(ShipStatus __instance)
|
||||
{
|
||||
if (IsObjectsFetched && IsAdjustmentsDone) return;
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterPolus.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(VersionShower))]
|
||||
public static class VersionShowerPatches
|
||||
{
|
||||
[HarmonyPatch(nameof(VersionShower.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void StartPostfix(VersionShower __instance)
|
||||
{
|
||||
__instance.text.text += $"<size=70%> + <color=#5E4CA6FF>BetterPolus v{BetterPolusPlugin.Version}</color> by Brybry</size>";
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//*
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterPolus
|
||||
{
|
||||
[HarmonyPatch(typeof(ReactorSystemType), nameof(ReactorSystemType.RepairDamage))]
|
||||
public static class ReactorSystemType_RepairDamagePatch
|
||||
{
|
||||
public static bool Prefix(ReactorSystemType __instance, PlayerControl player, byte opCode)
|
||||
{
|
||||
if (ShipStatus.Instance.Type == ShipStatus.MapType.Pb && opCode == 128 && !__instance.IsActive)
|
||||
{
|
||||
__instance.Countdown = 40f;
|
||||
__instance.UserConsolePairs.Clear();
|
||||
__instance.IsDirty = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//*/
|
||||
@@ -1,298 +0,0 @@
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterPolus
|
||||
{
|
||||
[HarmonyPatch(typeof(ShipStatus))]
|
||||
public static class ShipStatusPatch
|
||||
{
|
||||
// Positions
|
||||
public static readonly Vector3 DvdScreenNewPos = new Vector3(26.635f, -15.92f, 1f);
|
||||
public static readonly Vector3 VitalsNewPos = new Vector3(31.275f, -6.45f, 1f);
|
||||
|
||||
public static readonly Vector3 WifiNewPos = new Vector3(15.975f, 0.084f, 1f);
|
||||
public static readonly Vector3 NavNewPos = new Vector3(11.07f, -15.298f, -0.015f);
|
||||
|
||||
public static readonly Vector3 TempColdNewPos = new Vector3(7.772f, -17.103f, -0.017f);
|
||||
|
||||
// Scales
|
||||
public const float DvdScreenNewScale = 0.75f;
|
||||
|
||||
// Checks
|
||||
public static bool IsAdjustmentsDone;
|
||||
public static bool IsObjectsFetched;
|
||||
public static bool IsRoomsFetched;
|
||||
public static bool IsVentsFetched;
|
||||
|
||||
// Tasks Tweak
|
||||
public static Console WifiConsole;
|
||||
public static Console NavConsole;
|
||||
|
||||
// Vitals Tweak
|
||||
public static SystemConsole Vitals;
|
||||
public static GameObject DvdScreenOffice;
|
||||
|
||||
// Vents Tweak
|
||||
public static Vent ElectricBuildingVent;
|
||||
public static Vent ElectricalVent;
|
||||
public static Vent ScienceBuildingVent;
|
||||
public static Vent StorageVent;
|
||||
|
||||
// TempCold Tweak
|
||||
public static Console TempCold;
|
||||
|
||||
// Rooms
|
||||
public static GameObject Comms;
|
||||
public static GameObject DropShip;
|
||||
public static GameObject Outside;
|
||||
public static GameObject Science;
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Begin))]
|
||||
public static class ShipStatusBeginPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch]
|
||||
public static void Prefix(ShipStatus __instance)
|
||||
{
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Awake))]
|
||||
public static class ShipStatusAwakePatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch]
|
||||
public static void Prefix(ShipStatus __instance)
|
||||
{
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.FixedUpdate))]
|
||||
public static class ShipStatusFixedUpdatePatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch]
|
||||
public static void Prefix(ShipStatus __instance)
|
||||
{
|
||||
if (!IsObjectsFetched || !IsAdjustmentsDone)
|
||||
{
|
||||
ApplyChanges(__instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyChanges(ShipStatus instance)
|
||||
{
|
||||
if (instance.Type == ShipStatus.MapType.Pb)
|
||||
{
|
||||
FindPolusObjects();
|
||||
AdjustPolus();
|
||||
}
|
||||
}
|
||||
|
||||
public static void FindPolusObjects()
|
||||
{
|
||||
FindVents();
|
||||
FindRooms();
|
||||
FindObjects();
|
||||
}
|
||||
|
||||
public static void AdjustPolus()
|
||||
{
|
||||
if (IsObjectsFetched && IsRoomsFetched)
|
||||
{
|
||||
MoveVitals();
|
||||
SwitchNavWifi();
|
||||
MoveTempCold();
|
||||
}
|
||||
else
|
||||
{
|
||||
BetterPolusPlugin.log.LogError("Couldn't move elements as not all of them have been fetched.");
|
||||
}
|
||||
|
||||
AdjustVents();
|
||||
|
||||
IsAdjustmentsDone = true;
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// - Objects Fetching -
|
||||
// --------------------
|
||||
|
||||
public static void FindVents()
|
||||
{
|
||||
var ventsList = Object.FindObjectsOfType<Vent>().ToList();
|
||||
|
||||
if (ElectricBuildingVent == null)
|
||||
{
|
||||
ElectricBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ElectricBuildingVent");
|
||||
}
|
||||
|
||||
if (ElectricalVent == null)
|
||||
{
|
||||
ElectricalVent = ventsList.Find(vent => vent.gameObject.name == "ElectricalVent");
|
||||
}
|
||||
|
||||
if (ScienceBuildingVent == null)
|
||||
{
|
||||
ScienceBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ScienceBuildingVent");
|
||||
}
|
||||
|
||||
if (StorageVent == null)
|
||||
{
|
||||
StorageVent = ventsList.Find(vent => vent.gameObject.name == "StorageVent");
|
||||
}
|
||||
|
||||
IsVentsFetched = ElectricBuildingVent != null && ElectricalVent != null && ScienceBuildingVent != null &&
|
||||
StorageVent != null;
|
||||
}
|
||||
|
||||
public static void FindRooms()
|
||||
{
|
||||
if (Comms == null)
|
||||
{
|
||||
Comms = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Comms");
|
||||
}
|
||||
|
||||
if (DropShip == null)
|
||||
{
|
||||
DropShip = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Dropship");
|
||||
}
|
||||
|
||||
if (Outside == null)
|
||||
{
|
||||
Outside = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Outside");
|
||||
}
|
||||
|
||||
if (Science == null)
|
||||
{
|
||||
Science = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Science");
|
||||
}
|
||||
|
||||
IsRoomsFetched = Comms != null && DropShip != null && Outside != null && Science != null;
|
||||
}
|
||||
|
||||
public static void FindObjects()
|
||||
{
|
||||
if (WifiConsole == null)
|
||||
{
|
||||
WifiConsole = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_wifi");
|
||||
}
|
||||
|
||||
if (NavConsole == null)
|
||||
{
|
||||
NavConsole = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_nav");
|
||||
}
|
||||
|
||||
if (Vitals == null)
|
||||
{
|
||||
Vitals = Object.FindObjectsOfType<SystemConsole>().ToList()
|
||||
.Find(console => console.name == "panel_vitals");
|
||||
}
|
||||
|
||||
if (DvdScreenOffice == null)
|
||||
{
|
||||
GameObject DvdScreenAdmin = Object.FindObjectsOfType<GameObject>().ToList()
|
||||
.Find(o => o.name == "dvdscreen");
|
||||
|
||||
if (DvdScreenAdmin != null)
|
||||
{
|
||||
DvdScreenOffice = Object.Instantiate(DvdScreenAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
if (TempCold == null)
|
||||
{
|
||||
TempCold = Object.FindObjectsOfType<Console>().ToList()
|
||||
.Find(console => console.name == "panel_tempcold");
|
||||
}
|
||||
|
||||
IsObjectsFetched = WifiConsole != null && NavConsole != null && Vitals != null &&
|
||||
DvdScreenOffice != null && TempCold != null;
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// - Map Adjustments -
|
||||
// -------------------
|
||||
|
||||
public static void AdjustVents()
|
||||
{
|
||||
if (IsVentsFetched)
|
||||
{
|
||||
ElectricBuildingVent.Left = ElectricalVent;
|
||||
ElectricalVent.Center = ElectricBuildingVent;
|
||||
|
||||
ScienceBuildingVent.Left = StorageVent;
|
||||
StorageVent.Center = ScienceBuildingVent;
|
||||
}
|
||||
else
|
||||
{
|
||||
BetterPolusPlugin.log.LogError("Couldn't adjust Vents as not all objects have been fetched.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveTempCold()
|
||||
{
|
||||
if (TempCold.transform.position != TempColdNewPos)
|
||||
{
|
||||
Transform tempColdTransform = TempCold.transform;
|
||||
tempColdTransform.parent = Outside.transform;
|
||||
tempColdTransform.position = TempColdNewPos;
|
||||
|
||||
// Fixes collider being too high
|
||||
BoxCollider2D collider = TempCold.GetComponent<BoxCollider2D>();
|
||||
collider.isTrigger = false;
|
||||
collider.size += new Vector2(0f, -0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SwitchNavWifi()
|
||||
{
|
||||
if (WifiConsole.transform.position != WifiNewPos)
|
||||
{
|
||||
Transform wifiTransform = WifiConsole.transform;
|
||||
wifiTransform.parent = DropShip.transform;
|
||||
wifiTransform.position = WifiNewPos;
|
||||
}
|
||||
|
||||
if (NavConsole.transform.position != NavNewPos)
|
||||
{
|
||||
Transform navTransform = NavConsole.transform;
|
||||
navTransform.parent = Comms.transform;
|
||||
navTransform.position = NavNewPos;
|
||||
|
||||
// Prevents crewmate being able to do the task from outside
|
||||
NavConsole.checkWalls = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveVitals()
|
||||
{
|
||||
if (Vitals.transform.position != VitalsNewPos)
|
||||
{
|
||||
// Vitals
|
||||
Transform vitalsTransform = Vitals.gameObject.transform;
|
||||
vitalsTransform.parent = Science.transform;
|
||||
vitalsTransform.position = VitalsNewPos;
|
||||
}
|
||||
|
||||
if (DvdScreenOffice.transform.position != DvdScreenNewPos)
|
||||
{
|
||||
// DvdScreen
|
||||
Transform dvdScreenTransform = DvdScreenOffice.transform;
|
||||
dvdScreenTransform.position = DvdScreenNewPos;
|
||||
|
||||
var localScale = dvdScreenTransform.localScale;
|
||||
localScale =
|
||||
new Vector3(DvdScreenNewScale, localScale.y,
|
||||
localScale.z);
|
||||
dvdScreenTransform.localScale = localScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,18 +86,28 @@ There are two ways to install the mod :
|
||||
5. Run the game. The mod should be installed and it should work.
|
||||
|
||||
## Releases
|
||||
| Among Us Version | Mod Version | All-in-one pack | DLL file |
|
||||
|-------------| ----------- | :-------------: | :------: |
|
||||
| v2023.6.13+ | Ver. 1.2.0be670 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus_All-in-one-Pack-1.2.0be670.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus.dll)** |
|
||||
| v2022.10.25+ | Ver. 1.2.0 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus_All-in-one-Pack-1.2.0.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus.dll)** |
|
||||
| v2021.11.9.5+ | Ver. 1.1.4 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.4/BetterPolus_All-in-one-Pack-1.1.4.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.4/BetterPolus-1.1.4.dll)** |
|
||||
| v2021.6.30 | Ver. 1.1.3 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.3/BetterPolus_All-in-one-Pack-1.1.3.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.3/BetterPolus-1.1.3.dll)** |
|
||||
| v2021.3.31.3 | Ver. 1.1.2 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.2/BetterPolus_All-in-one-Pack-1.1.2.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.2/BetterPolus-2021.3.31.3s.dll)** |
|
||||
| v2021.3.5s | Ver. 1.1.1 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.1/BetterPolus_All-in-one-Pack-1.1.1.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.1/BetterPolus-2021.3.5s.dll)** |
|
||||
| v2020.12.9s | Ver. 1.1 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1/BetterPolus_All-in-one-Pack-1.1.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1/BetterPolus-2020.12.9s.dll)** |
|
||||
| v2020.12.9s | Ver. 1.0 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.0.0/BetterPolus_All-in-one-Pack.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.0.0/BetterPolus-2020.12.9s.dll)** |
|
||||
| Among Us Version | Mod Version | All-in-one pack | DLL file |
|
||||
|------------------|-----------------|:---------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------:|
|
||||
| v2023.7.12+ | Ver. 1.2.1 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.1/BetterPolus_All-in-one-Pack-1.2.1.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.1/BetterPolus.dll)** |
|
||||
| v2023.6.13+ | Ver. 1.2.0be670 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus_All-in-one-Pack-1.2.0be670.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus.dll)** |
|
||||
| v2022.10.25+ | Ver. 1.2.0 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus_All-in-one-Pack-1.2.0.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.2.0/BetterPolus.dll)** |
|
||||
| v2021.11.9.5+ | Ver. 1.1.4 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.4/BetterPolus_All-in-one-Pack-1.1.4.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.4/BetterPolus-1.1.4.dll)** |
|
||||
| v2021.6.30 | Ver. 1.1.3 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.3/BetterPolus_All-in-one-Pack-1.1.3.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.3/BetterPolus-1.1.3.dll)** |
|
||||
| v2021.3.31.3 | Ver. 1.1.2 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.2/BetterPolus_All-in-one-Pack-1.1.2.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.2/BetterPolus-2021.3.31.3s.dll)** |
|
||||
| v2021.3.5s | Ver. 1.1.1 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.1/BetterPolus_All-in-one-Pack-1.1.1.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1.1/BetterPolus-2021.3.5s.dll)** |
|
||||
| v2020.12.9s | Ver. 1.1 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1/BetterPolus_All-in-one-Pack-1.1.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.1/BetterPolus-2020.12.9s.dll)** |
|
||||
| v2020.12.9s | Ver. 1.0 | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.0.0/BetterPolus_All-in-one-Pack.zip)** | **[Download](https://github.com/Brybry16/BetterPolus/releases/download/v1.0.0/BetterPolus-2020.12.9s.dll)** |
|
||||
|
||||
### Changelog
|
||||
<details>
|
||||
<summary>Version 1.2.1</summary>
|
||||
<ul>
|
||||
<li>Added compatibility with Among Us v2023.7.12s</li>
|
||||
<li>Seismic Stabilizers Sabotage duration is customizable in config file (40s by default)</li>
|
||||
<li>Polus map modifications can be disabled in config file (enabled by default)</li>
|
||||
<li>The names of tasks room that have been moved appear correctly</li>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Version 1.2.0</summary>
|
||||
<ul>
|
||||
@@ -175,7 +185,7 @@ There are two ways to install the mod :
|
||||
|
||||
## Q&A
|
||||
**How do I know if BetterPolus is correctly installed?**<br>
|
||||
Just check that there is a line saying that BetterPolus has been loaded in the top left of the main menu.
|
||||
Just check that there is a line saying that BetterPolus has been loaded in the bottom left of the main menu.
|
||||
|
||||
**Does this works with (Better-)CrewLink (Proximity Chat)?**<br>
|
||||
Of course!
|
||||
|
||||
Reference in new issue
Block a user