Skip to content

Commit

Permalink
Fix BetterPolus wifi z pos, fix communications walls z pos, fix objec…
Browse files Browse the repository at this point in the history
…ts positioning
  • Loading branch information
EnoPM committed Oct 7, 2023
1 parent 874e1bb commit 6b5a95c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion BetterOtherRoles/BetterOtherRoles.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.4.7</Version>
<Version>1.4.8</Version>
<Description>BetterOtherRoles</Description>
<Authors>EnoPM</Authors>
<LangVersion>latest</LangVersion>
Expand Down
1 change: 0 additions & 1 deletion BetterOtherRoles/Eno/PluginUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,4 @@ public class GithubAsset

[JsonPropertyName("browser_download_url")]
public string DownloadUrl { get; set; }

}
2 changes: 1 addition & 1 deletion BetterOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BetterOtherRolesPlugin : BasePlugin
{
public const string Name = "Better Other Roles";
public const string Id = "betterohterroles.eno.pm";
public const string VersionString = "1.4.7";
public const string VersionString = "1.4.8";

public static Version Version = Version.Parse(VersionString);
internal static BepInEx.Logging.ManualLogSource Logger;
Expand Down
28 changes: 1 addition & 27 deletions BetterOtherRoles/Modules/BetterPolus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static BetterPolus()
{
UpdatedPositions[EditableObjects.DvdScreen] = new Vector3(26.635f, -15.92f, 1f);
UpdatedPositions[EditableObjects.Vitals] = new Vector3(31.275f, -6.45f, 1f);
UpdatedPositions[EditableObjects.Wifi] = new Vector3(15.975f, 0.084f, -0.015f);
UpdatedPositions[EditableObjects.Wifi] = new Vector3(15.975f, 0.084f, 0.001f);
UpdatedPositions[EditableObjects.NavTask] = new Vector3(11.07f, -15.298f, -0.015f);
UpdatedPositions[EditableObjects.TempCold] = new Vector3(7.772f, -17.103f, -0.017f);

Expand All @@ -65,7 +65,6 @@ public static void Start()
{
Clear();
if (!ShipStatus.Instance) return;
AdjustRoomsZ();
if (Enabled.getBool())
{
if (IsAdjustmentsDone) return;
Expand All @@ -78,23 +77,6 @@ public static void Start()
}
}

private static void AdjustRoomsZ()
{
if (!ShipStatus.Instance || ShipStatus.Instance.Type != ShipStatus.MapType.Pb) return;
var gameObjects = Object.FindObjectsOfType<GameObject>().ToList();
var comms = gameObjects.Find(o => o.name == "Comms");
var weapons = gameObjects.Find(o => o.name == "Weapons");
var dropship = gameObjects.Find(o => o.name == "Dropship");
var ramp = gameObjects.Find(o => o.name == "ramp");
var gun = gameObjects.Find(o => o.name == "gun0001");

AdjustZPosition(comms, 2f);
AdjustZPosition(weapons, 2f);
AdjustZPosition(dropship, 2f);
AdjustZPosition(ramp, 1.9f);
AdjustZPosition(gun, -2f);
}

public static void ApplyChanges(ShipStatus shipStatus)
{
if (!Enabled.getBool() || shipStatus.Type != ShipStatus.MapType.Pb || IsAdjustmentsDone) return;
Expand Down Expand Up @@ -181,14 +163,6 @@ private static void FindPolusObjects()
}
}

private static void AdjustZPosition(GameObject obj, float z)
{
if (!obj) return;
var pos = obj.transform.position;
pos.z = z;
obj.transform.position = pos;
}

private static void AdjustVents()
{
DefaultVentLefts[EditableObjects.ElectricBuildingVent] = Vents[EditableObjects.ElectricBuildingVent].Left;
Expand Down
12 changes: 11 additions & 1 deletion BetterOtherRoles/Modules/TaskPositionsRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private static void MoveWires(List<Console> wires)
private static void MoveUpload(Console upload, List<Console> downloads)
{
if (BetterOtherRoles.Rnd.Next(downloads.Count + 1) == 1) return;
//var download = downloads.Find(d => d.Room == SystemTypes.Weapons);
var download = downloads.GetOneRandom();
var uploadObj = upload.gameObject;
var downloadObj = download.gameObject;
Expand All @@ -88,6 +89,15 @@ private static void MoveUpload(Console upload, List<Console> downloads)

uploadObj.transform.position = downloadPos;
downloadObj.transform.position = uploadPos;

if (ShipStatus.Instance.Type == ShipStatus.MapType.Pb)
{
if (download.Room == SystemTypes.LifeSupp)
{
uploadPos.y -= 0.1f;
downloadObj.transform.position = uploadPos;
}
}

uploadObj.GetComponent<SpriteRenderer>().sprite = downloadSprite;
downloadObj.GetComponent<SpriteRenderer>().sprite = uploadSprite;
Expand All @@ -99,7 +109,7 @@ private static void MoveUpload(Console upload, List<Console> downloads)
{
download.checkWalls = true;
}

upload.onlySameRoom = false;
download.onlySameRoom = false;

Expand Down
2 changes: 1 addition & 1 deletion BetterOtherRoles/Objects/JackInTheBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void startAnimation(int ventId) {
public JackInTheBox(Vector2 p) {
gameObject = new GameObject("JackInTheBox"){layer = 11};
gameObject.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
Vector3 position = new Vector3(p.x, p.y, p.y/1000f + 0.01f);
Vector3 position = new Vector3(p.x, p.y, p.y / 1000 + 0.001f);
position += (Vector3)CachedPlayer.LocalPlayer.PlayerControl.Collider.offset; // Add collider offset that DoMove moves the player up at a valid position
// Create the marker
gameObject.transform.position = position;
Expand Down
10 changes: 8 additions & 2 deletions BetterOtherRoles/Objects/Portal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ public static void startTeleport(byte playerId, byte exit) {
public Portal(Vector2 p) {
portalGameObject = new GameObject("Portal"){ layer = 11 };
//Vector3 position = new Vector3(p.x, p.y, CachedPlayer.LocalPlayer.transform.position.z + 1f);
Vector3 position = new Vector3(p.x, p.y, p.y / 1000f + 0.01f);
var position = new Vector3(p.x, p.y, p.y / 1000 + 0.001f);
if (firstPortal == null && ShipStatus.Instance && ShipStatus.Instance.Type == ShipStatus.MapType.Pb &&
Math.Abs(position.x - 13.32f) < 0.01f && Math.Abs(position.y + 25.69f) < 0.01f)
{
position.x = 40.3f;
position.y = -6.7f;
}

// Create the portal
portalGameObject.transform.position = position;
Expand All @@ -100,7 +106,7 @@ public Portal(Vector2 p) {
animationFgRenderer.material = FastDestroyableSingleton<HatManager>.Instance.PlayerMaterial;

// Only render the inactive portals for the Portalmaker
bool playerIsPortalmaker = CachedPlayer.LocalPlayer.PlayerControl == BetterOtherRoles.Portalmaker.portalmaker;
bool playerIsPortalmaker = CachedPlayer.LocalPlayer.PlayerControl == Portalmaker.portalmaker;
portalGameObject.SetActive(playerIsPortalmaker);
portalFgAnimationGameObject.SetActive(true);

Expand Down
15 changes: 15 additions & 0 deletions BetterOtherRoles/Patches/TutorialManagerPatches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using BetterOtherRoles.Modules;
using HarmonyLib;

namespace BetterOtherRoles.Patches;

[HarmonyPatch(typeof(TutorialManager))]
public class TutorialManagerPatches
{
[HarmonyPatch(nameof(TutorialManager.RunTutorial))]
[HarmonyPostfix]
private static void RunTutorialPostfix()
{
GameEvents.TriggerGameStarted();
}
}

0 comments on commit 6b5a95c

Please sign in to comment.