Some fixes

This commit is contained in:
ang-xd committed 2025-02-13 16:51:00 -05:00
1 parent 59ab2736ab
commit e412e5ead5
8 files changed
+37 -45

No files matched your search

@@ -16,6 +16,7 @@ public class TeleportButton : CustomActionButton
public override float Cooldown => OptionGroupSingleton<TeleporterOptions>.Instance.TeleportCooldown.Value;
public override float EffectDuration => OptionGroupSingleton<TeleporterOptions>.Instance.TeleportDuration;
public override int MaxUses => 2;
public override LoadableAsset<Sprite> Sprite => ExampleAssets.TeleportButton;
@@ -1,15 +1,10 @@
namespace MiraAPI.Events.Vanilla.Meeting;
/// <summary>
/// The event that is invoked when a player is ejected.
/// The event that is invoked when a player is ejected. Non-cancelable.
/// </summary>
public class EjectionEvent : MiraCancelableEvent
public class EjectionEvent : MiraEvent
{
/// <summary>
/// Gets the player that is being ejected.
/// </summary>
public PlayerControl? Player { get; }
/// <summary>
/// Gets the instance of the ExileController.
/// </summary>
@@ -18,11 +13,9 @@ public class EjectionEvent : MiraCancelableEvent
/// <summary>
/// Initializes a new instance of the <see cref="EjectionEvent"/> class.
/// </summary>
/// <param name="player">The player who is being ejected.</param>
/// <param name="controller">The exile controller.</param>
public EjectionEvent(PlayerControl player, ExileController controller)
public EjectionEvent(ExileController controller)
{
Player = player;
ExileController = controller;
}
}
+5
View File
@@ -344,6 +344,11 @@ public abstract class CustomActionButton
{
UsesLeft--;
Button?.SetUsesRemaining(UsesLeft);
if (Button != null)
{
Button.usesRemainingSprite.color = UsesLeft == 0 ? Color.red : Color.white;
}
}
OnClick();
-1
View File
@@ -1,6 +1,5 @@
using MiraAPI.Events.Mira;
using MiraAPI.PluginLoading;
using Reactor.Utilities;
using System;
using System.Collections.Generic;
using System.Reflection;
+7 -7
View File
@@ -1,14 +1,14 @@
using System;
using Il2CppInterop.Runtime.Attributes;
using MiraAPI.Modifiers.Types;
using MiraAPI.Utilities;
using Reactor.Utilities;
using Reactor.Utilities.Attributes;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Text;
using Il2CppInterop.Runtime.Attributes;
using MiraAPI.Modifiers.Types;
using MiraAPI.Utilities;
using Reactor.Utilities;
using Reactor.Utilities.Attributes;
using TMPro;
using UnityEngine;
@@ -107,7 +107,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
var baseModifiers = filteredModifiers as BaseModifier[] ?? filteredModifiers.ToArray();
if (baseModifiers.Length != 0)
if (baseModifiers.Length != 0 && !MeetingHud.Instance)
{
var stringBuild = new StringBuilder();
foreach (var mod in baseModifiers)
+1 -5
View File
@@ -15,13 +15,9 @@ public static class EjectionPatches
[HarmonyPatch(nameof(ExileController.Begin))]
public static void BeginPostfix(ExileController __instance)
{
var @event = new EjectionEvent(__instance.initData.networkedPlayer.Object, __instance);
var @event = new EjectionEvent(__instance);
MiraEventManager.InvokeEvent(@event);
if (@event.IsCancelled)
{
return;
}
if (!__instance.initData.networkedPlayer || !__instance.initData.networkedPlayer.Role ||
__instance.initData.networkedPlayer.Role is not ICustomRole role)
{
-11
View File
@@ -328,17 +328,6 @@ public static class Extensions
.GetNearestDeadBodies(playerControl.GetTruePosition(), radius, Helpers.CreateFilter(Constants.NotShipMask))
.Find(component => component && !component.Reported);
}
/// <summary>
/// Get all living players.
/// </summary>
/// <returns>A list of alive players.</returns>
public static List<PlayerControl> GetAlivePlayers()
{
return PlayerControl.AllPlayerControls.ToArray().Where(x => !x.Data.IsDead).ToList();
}
/// <summary>
/// Finds the nearest object of a specified type to a player. It will only work if the object has a collider.
/// </summary>
+20 -11
View File
@@ -1,5 +1,5 @@
using System.Collections;
using MiraAPI.Roles;
using MiraAPI.Roles;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -15,6 +15,15 @@ namespace MiraAPI.Utilities;
/// </summary>
public static class Helpers
{
/// <summary>
/// Get all living players.
/// </summary>
/// <returns>A list of alive players.</returns>
public static List<PlayerControl> GetAlivePlayers()
{
return PlayerControl.AllPlayerControls.ToArray().Where(x => !x.Data.IsDead).ToList();
}
/// <summary>
/// Returns an empty coroutine.
/// </summary>
@@ -99,14 +108,14 @@ public static class Helpers
}
return (from player in newList
let vector = player.GetTruePosition() - source
let magnitude = vector.magnitude
where !PhysicsHelpers.AnyNonTriggersBetween(
source,
vector.normalized,
magnitude,
Constants.ShipAndObjectsMask)
select player).ToList();
let vector = player.GetTruePosition() - source
let magnitude = vector.magnitude
where !PhysicsHelpers.AnyNonTriggersBetween(
source,
vector.normalized,
magnitude,
Constants.ShipAndObjectsMask)
select player).ToList();
}
/// <summary>
@@ -168,7 +177,7 @@ public static class Helpers
select playerControl);
outputList.Sort(
delegate(PlayerControl a, PlayerControl b)
delegate (PlayerControl a, PlayerControl b)
{
var magnitude2 = (a.GetTruePosition() - source).magnitude;
var magnitude3 = (b.GetTruePosition() - source).magnitude;