Skip to content

Commit

Permalink
Repositions + Coroutine Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MyDragonBreath committed Jul 2, 2024
1 parent bf19f74 commit 6c04c2f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion MCI/Components/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Debugger(System.IntPtr ptr) : base(ptr)
{
Keyboard_Joystick.CreatePlayer();
}
GUILayout.Label("Hold F6 when pressing to bypass player limit.");
GUILayout.Label("Hold LftShft when pressing to bypass player limit.");
if (GUILayout.Button("Remove Last Bot"))
InstanceControl.RemovePlayer((byte)InstanceControl.Clients.Count);
Expand Down
10 changes: 8 additions & 2 deletions MCI/Embedded/ReactorCoroutines/Coroutines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ private void OnDestroy()
}
}

private static readonly ConditionalWeakTable<IEnumerator, Coroutine> _ourCoroutineStore = new();
internal static readonly ConditionalWeakTable<IEnumerator, Coroutine> _ourCoroutineStore = new();

internal static IEnumerator GenericRoutine(IEnumerator coroutine)
{
yield return coroutine;
_ourCoroutineStore.Remove(coroutine);
}

[return: NotNullIfNotNull("coroutine")]
public static IEnumerator? Start(IEnumerator? coroutine)

Check warning on line 40 in MCI/Embedded/ReactorCoroutines/Coroutines.cs

View workflow job for this annotation

GitHub Actions / build (6.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 40 in MCI/Embedded/ReactorCoroutines/Coroutines.cs

View workflow job for this annotation

GitHub Actions / build (6.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 40 in MCI/Embedded/ReactorCoroutines/Coroutines.cs

View workflow job for this annotation

GitHub Actions / build (6.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 40 in MCI/Embedded/ReactorCoroutines/Coroutines.cs

View workflow job for this annotation

GitHub Actions / build (6.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
if (coroutine != null)
{
_ourCoroutineStore.AddOrUpdate(coroutine, Component.Instance!.StartCoroutine(coroutine));
_ourCoroutineStore.AddOrUpdate(coroutine, Component.Instance!.StartCoroutine(GenericRoutine(coroutine)));
}

return coroutine;
Expand Down
25 changes: 24 additions & 1 deletion MCI/MCIPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
Expand All @@ -13,11 +14,12 @@ namespace MCI;
[BepInDependency(SubmergedCompatibility.SUBMERGED_GUID, BepInDependency.DependencyFlags.SoftDependency)]
public partial class MCIPlugin : BasePlugin
{
public const string VersionString = "0.0.6";
public const string VersionString = "0.0.7";
public static Version vVersion = new(VersionString);
public Harmony Harmony { get; } = new(Id);

public static MCIPlugin Singleton { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; }

public static string RobotName { get; set; } = "Bot";

Expand All @@ -31,6 +33,7 @@ public override void Load()
{
if (Singleton != null)
return;
Logger = this.Log;

Singleton = this;
Harmony.PatchAll();
Expand All @@ -47,5 +50,25 @@ public override void Load()
if (scene.name == "MainMenu")
ModManager.Instance.ShowModStamp();
}));

Logger.LogWarning($"\n-------------------------\n" + // Yellow stands out.
$"| MultiClientInstancing |\n" +
$"| |\n" +
$"| Developed By: |\n" +
$"| MyDragonBreath |\n" +
$"| WhichTwix |\n" +
$"| AlchlcDvl |\n" +
$"| lekillerdesgames |\n" +
$"-------------------------\n" +
$"| Controls: |\n" +
$"| F5: Add Players |\n" +
$"| + LSHIFT To Bypass 15|\n" +
$"| F6: Toggle Bot Removal|\n" +
$"| + LSHIFT IKWIDM |\n" +
$"| F9: Cycle Upwards |\n" +
$"| F10: Cycle Downwards |\n" +
$"| F11: Remove All |\n" +
$"| F1: Toggle Debugger |\n" +
$"-------------------------");
}
}
7 changes: 6 additions & 1 deletion MCI/Patches/Countdown.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
using HarmonyLib;
using MCI.Embedded.ReactorCoroutines;
using System.Linq;

namespace MCI.Patches;

[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))]
public static class CountdownPatch
{
public static void Prefix(GameStartManager __instance) => __instance.countDownTimer = 0;
public static void Prefix(GameStartManager __instance) {
__instance.countDownTimer = 0;
if (Coroutines._ourCoroutineStore.Any(x => x.Value != null)) __instance.countDownTimer = 1;
}
}
2 changes: 1 addition & 1 deletion MCI/Patches/KeyboardJoystick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static void CreatePlayer()
{
ControllingFigure = PlayerControl.LocalPlayer.PlayerId;

if (PlayerControl.AllPlayerControls.Count == 15 && !Input.GetKeyDown(KeyCode.F6))
if (PlayerControl.AllPlayerControls.Count == 15 && !Input.GetKeyDown(KeyCode.LeftShift))
return; //press f6 and f5 to bypass limit

InstanceControl.CleanUpLoad();
Expand Down
3 changes: 2 additions & 1 deletion MCI/Patches/PingTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public static void Postfix(PingTracker __instance)
{
var position = __instance.GetComponent<AspectPosition>();
position.Alignment = AspectPosition.EdgeAlignments.Top;
position.DistanceFromEdge = new(3.6f, 0.1f, 0);
position.DistanceFromEdge = new(0f, 0.1f, 0);
//position.DistanceFromEdge = new(3.6f, 0.1f, 0);
position.AdjustPosition();
__instance.text.text += "\n<color=#ff6700FF>MCI v" + MCIPlugin.VersionString + "</color>";
__instance.text.text += MCIPlugin.Enabled ? " <color=#00ff00FF>[Active]</color>" : " <color=#ff0000FF>[InActive]</color>";
Expand Down

0 comments on commit 6c04c2f

Please sign in to comment.