Compare commits

..
13 Commits
Author SHA1 Message Date
Atony fc9e9740be Merge pull request #70 from All-Of-Us-Mods/dev
MiraAPI v0.3.2
2025-10-14 09:08:53 -05:00
Atony 3c51c88963 Bump version 2025-10-14 09:05:25 -05:00
Atony e42f5e6029 Log exception 2025-10-12 19:44:30 -05:00
Atony 61be7dda82 Maybe fix the issues with kill animations? 2025-10-12 18:33:45 -05:00
xChipseq 3220a4a820 change texture wrap mode to clamp 2025-10-11 00:46:35 +02:00
XtraCube 8fd142a92e fix custom murder dead body 2025-10-04 14:07:00 -04:00
XtraCube fcec6ad6e5 fix new role fields 2025-10-01 22:17:40 -04:00
XtraCube 10a7ffe886 add new role information to try and fix broken gamemanager 2025-10-01 20:59:44 -04:00
Atony 7e541733b7 More fixes for role names 2025-09-30 18:15:29 -05:00
Atony 99a275a97c Adjust edit pane for self-adjusting role names 2025-09-30 18:08:56 -05:00
XtraCube 67a5f0dd67 fixing inner scuff problems 2025-09-30 11:22:43 -04:00
XtraCube f13d46ec18 android support 2025-09-30 11:13:23 -04:00
Atony f9096b6160 Merge pull request #69 from All-Of-Us-Mods/dev
MiraAPI v0.3.1
2025-09-28 13:17:06 -05:00
12 changed files with 57 additions and 33 deletions

No files matched your search

+2 -2
View File
@@ -2,12 +2,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Reactor" Version="2.3.1" /> <PackageReference Include="Reactor" Version="2.3.1" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native" /> <PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native" />
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.9.9" PrivateAssets="all" /> <PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.9.9" PrivateAssets="all" />
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" /> <PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" /> <PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
</ItemGroup> </ItemGroup>
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''"> <Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true" /> <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true" />
</Target> </Target>
+1 -1
View File
@@ -8,7 +8,7 @@
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<VersionPrefix>0.3.1</VersionPrefix> <VersionPrefix>0.3.2</VersionPrefix>
<VersionSuffix>dev</VersionSuffix> <VersionSuffix>dev</VersionSuffix>
<Authors>All Of Us, XtraCube, Angxl</Authors> <Authors>All Of Us, XtraCube, Angxl</Authors>
+21 -4
View File
@@ -1,4 +1,5 @@
using System.Collections; using System;
using System.Collections;
using System.Linq; using System.Linq;
using AmongUs.Data; using AmongUs.Data;
using AmongUs.GameOptions; using AmongUs.GameOptions;
@@ -8,8 +9,10 @@ using MiraAPI.Events;
using MiraAPI.Events.Vanilla.Gameplay; using MiraAPI.Events.Vanilla.Gameplay;
using Reactor.Networking.Attributes; using Reactor.Networking.Attributes;
using Reactor.Networking.Rpc; using Reactor.Networking.Rpc;
using Reactor.Utilities;
using Reactor.Utilities.Extensions; using Reactor.Utilities.Extensions;
using UnityEngine; using UnityEngine;
using Object = UnityEngine.Object;
namespace MiraAPI.Networking; namespace MiraAPI.Networking;
@@ -169,7 +172,14 @@ public static class CustomMurderRpc
if (showKillAnim) if (showKillAnim)
{ {
HudManager.Instance.KillOverlay.ShowKillAnimation(source.Data, data); try
{
HudManager.Instance.KillOverlay.ShowKillAnimation(source.Data, data);
}
catch (Exception e)
{
Logger<MiraApiPlugin>.Error($"Error with kill animation: {e.ToString()}");
}
} }
target.cosmetics.SetNameMask(false); target.cosmetics.SetNameMask(false);
@@ -202,7 +212,7 @@ public static class CustomMurderRpc
bool teleportMurderer = true) bool teleportMurderer = true)
{ {
var cam = Camera.main?.GetComponent<FollowerCamera>(); var cam = Camera.main?.GetComponent<FollowerCamera>();
var isParticipant = PlayerControl.LocalPlayer == source || PlayerControl.LocalPlayer == target; var isParticipant = source.AmOwner || target.AmOwner;
var sourcePhys = source.MyPhysics; var sourcePhys = source.MyPhysics;
if (teleportMurderer) if (teleportMurderer)
@@ -222,7 +232,7 @@ public static class CustomMurderRpc
if (createDeadBody) if (createDeadBody)
{ {
deadBody = Object.Instantiate(GameManager.Instance.deadBodyPrefab[0]); deadBody = Object.Instantiate(GameManager.Instance.GetDeadBody(source.Data.Role));
deadBody.enabled = false; deadBody.enabled = false;
deadBody.ParentId = target.PlayerId; deadBody.ParentId = target.PlayerId;
deadBody.bodyRenderers.ToList().ForEach(target.SetPlayerMaterialColors); deadBody.bodyRenderers.ToList().ForEach(target.SetPlayerMaterialColors);
@@ -233,6 +243,13 @@ public static class CustomMurderRpc
deadBody.transform.position = vector; deadBody.transform.position = vector;
} }
source.Data.Role.KillAnimSpecialSetup(deadBody, source, target);
target.Data.Role.KillAnimSpecialSetup(deadBody, source, target);
// no idea if this causes bugs, but innersloth is brain-dead
// I HATE INNERSCUFF I HATE INNERSCUFF I HATE INNERSCUFF I HATE INNERSCUFF I HATE INNERSCUFF I HATE INNERSCUFF
PlayerControl.LocalPlayer.Data.Role.KillAnimSpecialSetup(deadBody, source, target);
if (isParticipant) if (isParticipant)
{ {
if (cam != null) if (cam != null)
-9
View File
@@ -7,15 +7,6 @@ namespace MiraAPI.Patches.Events;
internal static class EndGamePatches internal static class EndGamePatches
{ {
[HarmonyPatch(typeof(GameManager), nameof(GameManager.Awake))]
public static class GameManagerAwakePatch
{
public static void Postfix(GameManager __instance)
{
__instance.enabled = true;
}
}
[HarmonyPatch(typeof(GameManager), nameof(GameManager.RpcEndGame))] [HarmonyPatch(typeof(GameManager), nameof(GameManager.RpcEndGame))]
public static class GameManagerRpcEndGamePatch public static class GameManagerRpcEndGamePatch
{ {
+13 -9
View File
@@ -73,17 +73,21 @@ public static class HudManagerPatches
gridArrange.Alignment = GridArrange.StartAlign.Right; gridArrange.Alignment = GridArrange.StartAlign.Right;
aspectPosition.Alignment = AspectPosition.EdgeAlignments.LeftBottom; aspectPosition.Alignment = AspectPosition.EdgeAlignments.LeftBottom;
var fakeButton = Object.Instantiate(__instance.AbilityButton, BottomLeft.transform); if (Constants.GetPlatformType() is Platforms.Android or Platforms.IPhone)
foreach (var renderer in fakeButton.GetComponentsInChildren<Renderer>())
{ {
renderer.enabled = false; var fakeButton = Object.Instantiate(__instance.AbilityButton, BottomLeft.transform);
foreach (var renderer in fakeButton.GetComponentsInChildren<Renderer>())
{
renderer.enabled = false;
}
fakeButton.buttonLabelText.Destroy();
fakeButton.cooldownTimerText.Destroy();
fakeButton.usesRemainingText.Destroy();
fakeButton.GetComponent<PassiveButton>().Destroy();
fakeButton.ToggleVisible(true);
fakeButton.Destroy();
} }
fakeButton.buttonLabelText.Destroy();
fakeButton.cooldownTimerText.Destroy();
fakeButton.usesRemainingText.Destroy();
fakeButton.GetComponent<PassiveButton>().Destroy();
fakeButton.ToggleVisible(true);
fakeButton.Destroy();
foreach (var button in CustomButtonManager.CustomButtons) foreach (var button in CustomButtonManager.CustomButtons)
{ {
@@ -344,7 +344,7 @@ public static class LobbyViewPanePatches
} }
viewSettingsInfoPanelRoleVariant.SetInfo( viewSettingsInfoPanelRoleVariant.SetInfo(
roleBehaviour.NiceName, roleBehaviour.GetRoleName(),
numPerGame, numPerGame,
chancePerGame, chancePerGame,
61, 61,
@@ -473,9 +473,7 @@ public static class RoleSettingMenuPatches
RolePositions[GameSettingMenuPatches.SelectedModIdx] = __instance.scrollBar.Inner.localPosition; RolePositions[GameSettingMenuPatches.SelectedModIdx] = __instance.scrollBar.Inner.localPosition;
__instance.roleDescriptionText.text = customRole.RoleLongDescription; __instance.roleDescriptionText.text = customRole.RoleLongDescription;
__instance.roleTitleText.text = TranslationController.Instance.GetString( __instance.roleTitleText.text = role.GetRoleName();
role.StringName,
new Il2CppReferenceArray<Il2CppSystem.Object>(0));
var imgBg = __instance.AdvancedRolesSettings.transform.FindChild("Imagebackground"); var imgBg = __instance.AdvancedRolesSettings.transform.FindChild("Imagebackground");
var labelBg = __instance.AdvancedRolesSettings.transform.FindChild("InfoLabelBackground"); var labelBg = __instance.AdvancedRolesSettings.transform.FindChild("InfoLabelBackground");
@@ -579,6 +577,7 @@ public static class RoleSettingMenuPatches
roleOptionSetting.transform.localPosition = new Vector3(-0.1f, ScrollerNum, -2f); roleOptionSetting.transform.localPosition = new Vector3(-0.1f, ScrollerNum, -2f);
roleOptionSetting.SetRole(GameOptionsManager.Instance.CurrentGameOptions.RoleOptions, role, 20); roleOptionSetting.SetRole(GameOptionsManager.Instance.CurrentGameOptions.RoleOptions, role, 20);
roleOptionSetting.titleText.text = role.GetRoleName();
roleOptionSetting.labelSprite.color = customRole.OptionsMenuColor; roleOptionSetting.labelSprite.color = customRole.OptionsMenuColor;
roleOptionSetting.OnValueChanged = new Action<OptionBehaviour>(ValueChanged); roleOptionSetting.OnValueChanged = new Action<OptionBehaviour>(ValueChanged);
roleOptionSetting.SetClickMask(__instance.ButtonClickMask); roleOptionSetting.SetClickMask(__instance.ButtonClickMask);
+3 -2
View File
@@ -1,11 +1,12 @@
using HarmonyLib; using HarmonyLib;
using MiraAPI.Roles; using MiraAPI.Roles;
using MiraAPI.Utilities;
using UnityEngine; using UnityEngine;
namespace MiraAPI.Patches.Roles; namespace MiraAPI.Patches.Roles;
/// <summary> /// <summary>
/// Patches the haunt menu to show the actual role name rather then team. /// Patches the haunt menu to show the actual role name rather than team.
/// </summary> /// </summary>
[HarmonyPatch(typeof(HauntMenuMinigame), nameof(HauntMenuMinigame.SetHauntTarget))] [HarmonyPatch(typeof(HauntMenuMinigame), nameof(HauntMenuMinigame.SetHauntTarget))]
// SetFilterText was INLINED // SetFilterText was INLINED
@@ -22,7 +23,7 @@ public static class HauntMenuMinigamePatch
var role = __instance.HauntTarget.Data.Role; var role = __instance.HauntTarget.Data.Role;
var color = role is ICustomRole custom ? custom.RoleColor : role.TeamColor; var color = role is ICustomRole custom ? custom.RoleColor : role.TeamColor;
__instance.FilterText.text = role.NiceName; __instance.FilterText.text = role.GetRoleName();
__instance.FilterText.color = color; __instance.FilterText.color = color;
} }
} }
+10
View File
@@ -4,6 +4,7 @@ using System.Linq;
using AmongUs.GameOptions; using AmongUs.GameOptions;
using Il2CppInterop.Runtime; using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MiraAPI.Networking; using MiraAPI.Networking;
using MiraAPI.PluginLoading; using MiraAPI.PluginLoading;
using MiraAPI.Utilities; using MiraAPI.Utilities;
@@ -53,6 +54,9 @@ public static class CustomRoleManager
internal static readonly Dictionary<ushort, RoleBehaviour> CustomRoles = []; internal static readonly Dictionary<ushort, RoleBehaviour> CustomRoles = [];
internal static readonly Dictionary<Type, ushort> RoleIds = []; internal static readonly Dictionary<Type, ushort> RoleIds = [];
private static Il2CppSystem.Collections.Generic.List<BaseGameSetting>? _emptySettings;
private static Il2CppReferenceArray<OverlayKillAnimation>? _emptyKillAnimations;
private static ushort _roleId = 100; private static ushort _roleId = 100;
private static ushort GetNextRoleId() private static ushort GetNextRoleId()
@@ -133,6 +137,12 @@ public static class CustomRoleManager
roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount; roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount;
roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset(); roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset();
_emptySettings ??= new(0);
_emptyKillAnimations ??= new(0);
roleBehaviour.AllGameSettings = _emptySettings;
roleBehaviour.CustomKillAnimations = _emptyKillAnimations;
if (customRole.Configuration.Icon != null) if (customRole.Configuration.Icon != null)
{ {
var asset = customRole.Configuration.Icon.LoadAsset(); var asset = customRole.Configuration.Icon.LoadAsset();
+4 -1
View File
@@ -19,7 +19,10 @@ public static class SpriteTools
/// <exception cref="ArgumentException">Thrown when the resource cannot be found in the specified assembly.</exception> /// <exception cref="ArgumentException">Thrown when the resource cannot be found in the specified assembly.</exception>
public static Texture2D LoadTextureFromResourcePath(string resourcePath, Assembly assembly) public static Texture2D LoadTextureFromResourcePath(string resourcePath, Assembly assembly)
{ {
var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false); var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false)
{
wrapMode = TextureWrapMode.Clamp,
};
var myStream = assembly.GetManifestResourceStream(resourcePath); var myStream = assembly.GetManifestResourceStream(resourcePath);
if (myStream != null) if (myStream != null)
{ {
-1
View File
@@ -6,6 +6,5 @@
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Reactor" value="https://nuget.reactor.gg/v3/index.json" /> <add key="Reactor" value="https://nuget.reactor.gg/v3/index.json" />
<add key="Samboy063" value="https://nuget.samboy.dev/v3/index.json" /> <add key="Samboy063" value="https://nuget.samboy.dev/v3/index.json" />
<add key="Local" value="packages/" />
</packageSources> </packageSources>
</configuration> </configuration>
Binary file not shown.