Skip to content

Commit

Permalink
Merge pull request #1 from Brybry16/dev
Browse files Browse the repository at this point in the history
BetterPolus version 1.1
  • Loading branch information
Brybry16 authored Feb 6, 2021
2 parents 5644038 + b780e39 commit 1b7a9f3
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 97 deletions.
2 changes: 1 addition & 1 deletion BetterPolus/BetterPolus.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.0.0</Version>
<Version>1.1</Version>
<GameVersion>2020.12.9s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.1.0-alpha.2</Mappings>

Expand Down
6 changes: 4 additions & 2 deletions BetterPolus/BetterPolusPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
202 changes: 111 additions & 91 deletions BetterPolus/ShipStatusPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,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
Expand All @@ -28,14 +31,22 @@ public static class ShipStatusPatch

// Vitals Tweak
public static SystemConsole Vitals;
public static GameObject WeatherMap;
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
Expand Down Expand Up @@ -73,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)
{
Expand All @@ -82,10 +93,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;
Expand All @@ -97,8 +124,6 @@ public static void AdjustPolus()

public static void FindVents()
{
BetterPolusPlugin.Logger.LogMessage("Fetching Vent Objects");

var ventsList = Object.FindObjectsOfType<Vent>().ToList();

if (ElectricBuildingVent == null)
Expand All @@ -125,64 +150,70 @@ public static void FindVents()
StorageVent != null;
}

public static void FindPolusObjects()
public static void FindRooms()
{

FindVents();
if (Comms == null)
{
Comms = Object.FindObjectsOfType<GameObject>().ToList().Find(o => o.name == "Comms");
}

// 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 (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)
{
BetterPolusPlugin.Logger.LogMessage("Fetching WifiConsole Object");
WifiConsole = Object.FindObjectsOfType<Console>().ToList()
.Find(console => console.name == "panel_wifi");
}

if (NavConsole == null)
{
BetterPolusPlugin.Logger.LogMessage("Fetching NavConsole Object");
NavConsole = Object.FindObjectsOfType<Console>().ToList()
.Find(console => console.name == "panel_nav");
}

if (Vitals == null)
{
BetterPolusPlugin.Logger.LogMessage("Fetching Vitals Object");
Vitals = Object.FindObjectsOfType<SystemConsole>().ToList()
.Find(console => console.name == "panel_vitals");
}

if (WeatherMap == null)
{
BetterPolusPlugin.Logger.LogMessage("Fetching WeatherMap Object");
WeatherMap = Object.FindObjectsOfType<GameObject>().ToList()
.Find(o => o.name == "Weathermap0001");
}

if (DvdScreenOffice == null)
{
BetterPolusPlugin.Logger.LogMessage("Fetching DvdScreenAdmin Object");
GameObject DvdScreenAdmin = Object.FindObjectsOfType<GameObject>().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<Console>().ToList()
.Find(console => console.name == "panel_tempcold");
}

IsObjectsFetched = WifiConsole != null && NavConsole != null && Vitals != null &&
DvdScreenOffice != null && TempCold != null;
}

// -------------------
Expand All @@ -193,8 +224,6 @@ public static void AdjustVents()
{
if (IsVentsFetched)
{
BetterPolusPlugin.Logger.LogMessage("Adjusting Vents");

ElectricBuildingVent.Left = ElectricalVent;
ElectricalVent.Center = ElectricBuildingVent;

Expand All @@ -203,75 +232,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<BoxCollider2D>();
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;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion BetterPolus/VersionShowerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down Expand Up @@ -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
<details>
<summary>Version 1.0.0</summary>
<summary>Version 1.1</summary>
<ul>
<li>Fixed Crewmates being able to access Chart Course Task from outside of Comms.</li>
<li>Moved Temperature (cold) task to the 'Death Valley' (Outside, between Comms & O2).</li>
<li>Moved Vitals where Temperature (cold) was originally (in Laboratory).</li>
</ul>

<summary>Version 1.0</summary>
<ul>
<li>Vitals have been moved to Laboratory.</li>
<li>The Reboot Wifi task is now located in the Dropship.</li>
Expand Down

0 comments on commit 1b7a9f3

Please sign in to comment.