From 1be27b03d9e618626fbfc2c3ca446aea5659b7f4 Mon Sep 17 00:00:00 2001 From: Brybry Date: Sat, 6 Feb 2021 18:36:53 +0100 Subject: [PATCH 1/2] Bump to version 1.1 Fixed Crewmates being able to access ChartCourse Task from outside. Moved Temperature (cold) task to the 'Death Valley' (Outside, between Comms & O2). Moved Vitals where Temperature (cold) was originally. --- BetterPolus/BetterPolus.csproj | 2 +- BetterPolus/BetterPolusPlugin.cs | 6 +- BetterPolus/ShipStatusPatch.cs | 206 +++++++++++++++++------------- BetterPolus/VersionShowerPatch.cs | 3 +- 4 files changed, 122 insertions(+), 95 deletions(-) diff --git a/BetterPolus/BetterPolus.csproj b/BetterPolus/BetterPolus.csproj index fcfef87..44c6bbd 100644 --- a/BetterPolus/BetterPolus.csproj +++ b/BetterPolus/BetterPolus.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 1.0.0 + 1.1 2020.12.9s NuclearPowered/Mappings:0.1.0-alpha.2 diff --git a/BetterPolus/BetterPolusPlugin.cs b/BetterPolus/BetterPolusPlugin.cs index b8737ba..13b780a 100644 --- a/BetterPolus/BetterPolusPlugin.cs +++ b/BetterPolus/BetterPolusPlugin.cs @@ -14,12 +14,14 @@ public class BetterPolusPlugin : BasePlugin public const string Id = "ch.brybry.betterpolus"; public Harmony Harmony { get; } = new Harmony(Id); - public static ManualLogSource Logger; + public static ManualLogSource log; public override void Load() { - Logger = Log; + log = Log; + + log.LogMessage("BetterPolus Mod loaded"); Harmony.PatchAll(); } diff --git a/BetterPolus/ShipStatusPatch.cs b/BetterPolus/ShipStatusPatch.cs index 86fc7b8..f9c3767 100644 --- a/BetterPolus/ShipStatusPatch.cs +++ b/BetterPolus/ShipStatusPatch.cs @@ -1,6 +1,10 @@ -using System.Linq; +using System; +using System.Linq; +using System.Reflection; using HarmonyLib; +using UnhollowerBaseLib; using UnityEngine; +using Object = UnityEngine.Object; namespace BetterPolus { @@ -9,17 +13,20 @@ public static class ShipStatusPatch { // Positions public static readonly Vector3 DvdScreenNewPos = new Vector3(26.635f, -15.92f, 1f); - public static readonly Vector3 VitalsNewPos = new Vector3(30.255f, -6.66f, 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; - public const float VitalsNewScale = 1.05f; // Checks - public static bool IsObjectsFetched; public static bool IsAdjustmentsDone; + public static bool IsObjectsFetched; + public static bool IsRoomsFetched; public static bool IsVentsFetched; // Tasks Tweak @@ -28,7 +35,6 @@ public static class ShipStatusPatch // Vitals Tweak public static SystemConsole Vitals; - public static GameObject WeatherMap; public static GameObject DvdScreenOffice; // Vents Tweak @@ -36,6 +42,15 @@ public static class ShipStatusPatch 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 @@ -82,10 +97,26 @@ public static void ApplyChanges(ShipStatus instance) } } + public static void FindPolusObjects() + { + FindVents(); + FindRooms(); + FindObjects(); + } + public static void AdjustPolus() { - MoveVitals(); - SwitchNavWifi(); + 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; @@ -97,8 +128,6 @@ public static void AdjustPolus() public static void FindVents() { - BetterPolusPlugin.Logger.LogMessage("Fetching Vent Objects"); - var ventsList = Object.FindObjectsOfType().ToList(); if (ElectricBuildingVent == null) @@ -125,64 +154,70 @@ public static void FindVents() StorageVent != null; } - public static void FindPolusObjects() + public static void FindRooms() { - - FindVents(); + if (Comms == null) + { + Comms = Object.FindObjectsOfType().ToList().Find(o => o.name == "Comms"); + } - // if (Comms == null) - // { - // Comms = Object.FindObjectsOfType().ToList().Find(o => o.name == "Comms"); - // } - // - // if (DropShip == null) - // { - // DropShip = Object.FindObjectsOfType().ToList().Find(o => o.name == "Dropship"); - // } + if (DropShip == null) + { + DropShip = Object.FindObjectsOfType().ToList().Find(o => o.name == "Dropship"); + } + + if (Outside == null) + { + Outside = Object.FindObjectsOfType().ToList().Find(o => o.name == "Outside"); + } + if (Science == null) + { + Science = Object.FindObjectsOfType().ToList().Find(o => o.name == "Science"); + } + + IsRoomsFetched = Comms != null && DropShip != null && Outside != null && Science != null; + } + + public static void FindObjects() + { if (WifiConsole == null) { - BetterPolusPlugin.Logger.LogMessage("Fetching WifiConsole Object"); WifiConsole = Object.FindObjectsOfType().ToList() .Find(console => console.name == "panel_wifi"); } if (NavConsole == null) { - BetterPolusPlugin.Logger.LogMessage("Fetching NavConsole Object"); NavConsole = Object.FindObjectsOfType().ToList() .Find(console => console.name == "panel_nav"); } if (Vitals == null) { - BetterPolusPlugin.Logger.LogMessage("Fetching Vitals Object"); Vitals = Object.FindObjectsOfType().ToList() .Find(console => console.name == "panel_vitals"); } - - if (WeatherMap == null) - { - BetterPolusPlugin.Logger.LogMessage("Fetching WeatherMap Object"); - WeatherMap = Object.FindObjectsOfType().ToList() - .Find(o => o.name == "Weathermap0001"); - } if (DvdScreenOffice == null) { - BetterPolusPlugin.Logger.LogMessage("Fetching DvdScreenAdmin Object"); GameObject DvdScreenAdmin = Object.FindObjectsOfType().ToList() .Find(o => o.name == "dvdscreen"); if (DvdScreenAdmin != null) { - BetterPolusPlugin.Logger.LogMessage("Creating DvdScreenOffice Object"); DvdScreenOffice = Object.Instantiate(DvdScreenAdmin); } } - IsObjectsFetched = WifiConsole != null && NavConsole != null && Vitals != null && WeatherMap != null && - DvdScreenOffice != null; + if (TempCold == null) + { + TempCold = Object.FindObjectsOfType().ToList() + .Find(console => console.name == "panel_tempcold"); + } + + IsObjectsFetched = WifiConsole != null && NavConsole != null && Vitals != null && + DvdScreenOffice != null && TempCold != null; } // ------------------- @@ -193,8 +228,6 @@ public static void AdjustVents() { if (IsVentsFetched) { - BetterPolusPlugin.Logger.LogMessage("Adjusting Vents"); - ElectricBuildingVent.Left = ElectricalVent; ElectricalVent.Center = ElectricBuildingVent; @@ -203,75 +236,66 @@ public static void AdjustVents() } else { - BetterPolusPlugin.Logger.LogError("Couldn't adjust Vents as not all objects have been fetched."); + 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(); + collider.isTrigger = false; + collider.size += new Vector2(0f, -0.3f); } } public static void SwitchNavWifi() { - if (IsObjectsFetched) + if (WifiConsole.transform.position != WifiNewPos) { - if (WifiConsole.transform.position != WifiNewPos) - { - BetterPolusPlugin.Logger.LogMessage("Moving Wifi to Dropship"); - Transform wifiTransform = WifiConsole.transform; - wifiTransform.position = WifiNewPos; - WifiConsole.Room = SystemTypes.Dropship; - } - - if (NavConsole.transform.position != NavNewPos) - { - BetterPolusPlugin.Logger.LogMessage("Moving Nav to Comms"); - Transform navTransform = NavConsole.transform; - navTransform.position = NavNewPos; - NavConsole.Room = SystemTypes.Comms; - } + Transform wifiTransform = WifiConsole.transform; + wifiTransform.parent = DropShip.transform; + wifiTransform.position = WifiNewPos; } - else + + if (NavConsole.transform.position != NavNewPos) { - BetterPolusPlugin.Logger.LogError("Couldn't Switch Nav & Wifi as not all objects have been fetched."); + 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 (IsObjectsFetched) + if (Vitals.transform.position != VitalsNewPos) { - if (Vitals.transform.position != VitalsNewPos) - { - // Vitals - BetterPolusPlugin.Logger.LogMessage("Moving Vitals to Laboratory"); - Transform vitalsTransform = Vitals.gameObject.transform; - vitalsTransform.position = VitalsNewPos; - var localScale = vitalsTransform.localScale; - localScale = - new Vector3(VitalsNewScale, localScale.y, localScale.z); - vitalsTransform.localScale = localScale; - } - - if (WeatherMap.active) - { - // WeatherMap - BetterPolusPlugin.Logger.LogMessage("Deactivating WeatherMap"); - WeatherMap.SetActive(false); - } - - if (DvdScreenOffice.transform.position != DvdScreenNewPos) - { - // DvdScreen - BetterPolusPlugin.Logger.LogMessage("Moving DvdScreenOffice"); - Transform dvdScreenTransform = DvdScreenOffice.transform; - dvdScreenTransform.position = DvdScreenNewPos; - var localScale = dvdScreenTransform.localScale; - localScale = - new Vector3(DvdScreenNewScale, localScale.y, - localScale.z); - dvdScreenTransform.localScale = localScale; - } + // Vitals + Transform vitalsTransform = Vitals.gameObject.transform; + vitalsTransform.parent = Science.transform; + vitalsTransform.position = VitalsNewPos; } - else + + if (DvdScreenOffice.transform.position != DvdScreenNewPos) { - BetterPolusPlugin.Logger.LogError("Couldn't move Vitals as not all objects have been fetched."); + // DvdScreen + Transform dvdScreenTransform = DvdScreenOffice.transform; + dvdScreenTransform.position = DvdScreenNewPos; + + var localScale = dvdScreenTransform.localScale; + localScale = + new Vector3(DvdScreenNewScale, localScale.y, + localScale.z); + dvdScreenTransform.localScale = localScale; } } } diff --git a/BetterPolus/VersionShowerPatch.cs b/BetterPolus/VersionShowerPatch.cs index dd5b97e..384c092 100644 --- a/BetterPolus/VersionShowerPatch.cs +++ b/BetterPolus/VersionShowerPatch.cs @@ -9,13 +9,14 @@ public class VersionShowerPatch { [HarmonyPostfix] [HarmonyPatch] + [HarmonyPriority(Priority.First)] public static void Postfix(VersionShower __instance) { var reactorVS = GameObject.Find("ReactorVersion"); GameObject.Destroy(reactorVS); TextRenderer text = __instance.text; - text.Text += "\nLoaded [5E4CA6FF]BetterPolus []Mod by Brybry"; + text.Text += "\nLoaded [5E4CA6FF]BetterPolus v1.1-R []by Brybry"; } } } \ No newline at end of file From b780e398d28fb40fa3217d45a588ae82ce6225de Mon Sep 17 00:00:00 2001 From: Brybry Date: Sat, 6 Feb 2021 19:01:35 +0100 Subject: [PATCH 2/2] Update Readme + small cleanup --- BetterPolus/ShipStatusPatch.cs | 8 ++------ README.md | 13 +++++++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/BetterPolus/ShipStatusPatch.cs b/BetterPolus/ShipStatusPatch.cs index f9c3767..a569490 100644 --- a/BetterPolus/ShipStatusPatch.cs +++ b/BetterPolus/ShipStatusPatch.cs @@ -1,10 +1,6 @@ -using System; -using System.Linq; -using System.Reflection; +using System.Linq; using HarmonyLib; -using UnhollowerBaseLib; using UnityEngine; -using Object = UnityEngine.Object; namespace BetterPolus { @@ -88,7 +84,7 @@ public static void Prefix(ShipStatus __instance) } } - public static void ApplyChanges(ShipStatus instance) + private static void ApplyChanges(ShipStatus instance) { if (instance.Type == ShipStatus.MapType.Pb) { diff --git a/README.md b/README.md index 3e86242..a4f28c8 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ An Among Us mod that tweaks Polus, allowing a more balanced experience. - **Vitals** have been moved to **Laboratory**. - The **Reboot Wifi task** is now located in the **Dropship**. - The **Chart Course** task is now located in **Comms**. +- The **Temperature (cold)** task is now located **Outside (Between O2 & Comms)**. - The **Vents** near both Reactor Pods are **not linked to each other** anymore. - The Vent on **top of Electrical** is linked to the Vent on **top of Security**. - The Vent **outside of Laboratory** is linked to the Vent **inside Storage**. @@ -39,11 +40,19 @@ There are two ways to install the mod : ## Releases | Among Us Version | Mod Version | All-in-one pack | DLL file | | ---------------- | ----------- | :-------------: | :------: | - | v2020.12.9s | Ver. 1.0.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)** | + | 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
- Version 1.0.0 + Version 1.1 +
    +
  • Fixed Crewmates being able to access Chart Course Task from outside of Comms.
  • +
  • Moved Temperature (cold) task to the 'Death Valley' (Outside, between Comms & O2).
  • +
  • Moved Vitals where Temperature (cold) was originally (in Laboratory).
  • +
+ + Version 1.0
  • Vitals have been moved to Laboratory.
  • The Reboot Wifi task is now located in the Dropship.