Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ on:
branches:
- main
- dev
- au-2025.3.25
pull_request:
branches:
- main
- dev
- au-2025.3.25
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -49,6 +47,9 @@ jobs:
- name: Build NewMod (Debug)
run: dotnet build NewMod/NewMod.csproj --configuration Debug --no-restore

- name: Build NewMod Android (Debug)
run: dotnet build NewMod/NewMod.csproj --configuration ANDROID --no-restore

- name: Upload NewMod DLL (Release)
uses: actions/upload-artifact@v4
with:
Expand All @@ -61,6 +62,13 @@ jobs:
name: NewMod-Debug
path: NewMod/bin/Debug/net6.0/NewMod.dll

- name: Upload NewMod DLL (Android)
uses: actions/upload-artifact@v4
with:
name: NewMod-Android
path: NewMod/bin/ANDROID/net6.0/NewMod.dll


release:
needs: build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bin/
obj/
libs/*
References/
NewMod/Components
/packages/
riderModule.iml
.idea
Expand Down
3 changes: 3 additions & 0 deletions NewMod/Buttons/EnergyThief/DrainButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public override bool Enabled(RoleBehaviour role)
/// </summary>
protected override void OnClick()
{
var clip = NewModAsset.DrainSound.LoadAsset();

PendingEffectManager.AddPendingEffect(Target);
SoundManager.Instance.PlaySound(clip, false, 1f, null);

Utils.RecordDrainCount(PlayerControl.LocalPlayer);

Expand Down
90 changes: 90 additions & 0 deletions NewMod/Buttons/Injector/InjectButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using MiraAPI.GameOptions;
using MiraAPI.Hud;
using MiraAPI.Utilities.Assets;
using UnityEngine;
using NewMod.Roles.NeutralRoles;
using NewMod.Options.Roles.InjectorOptions;
using MiraAPI.Utilities;
using System;
using static NewMod.Utilities.Utils;

namespace NewMod.Buttons.Injector
{
/// <summary>
/// Represents the serum injection button for the Injector role.
/// Allows injecting a random serum into nearby players.
/// </summary>
public class InjectButton : CustomActionButton<PlayerControl>
{
/// <summary>
/// The name displayed on the button (if any).
/// </summary>
public override string Name => "Inject";

/// <summary>
/// Cooldown time between uses, configured via <see cref="InjectorOptions"/>.
/// </summary>
public override float Cooldown => OptionGroupSingleton<InjectorOptions>.Instance.SerumCooldown;

/// <summary>
/// Maximum allowed injections, configured via <see cref="InjectorOptions"/>.
/// </summary>
public override int MaxUses => OptionGroupSingleton<InjectorOptions>.Instance.MaxSerumUses;

/// <summary>
/// Effect duration — unused here since injection is instant.
/// </summary>
public override float EffectDuration => 0f;

/// <summary>
/// Screen location of the button on the HUD.
/// </summary>
public override ButtonLocation Location => ButtonLocation.BottomLeft;

/// <summary>
/// Sprite/icon displayed on the button.
/// </summary>
public override LoadableAsset<Sprite> Sprite => MiraAssets.Empty;

/// <summary>
/// Returns the closest valid player target within range,
/// used by the Injector to determine who can be injected.
/// </summary>
/// <returns>The nearest PlayerControl instance, or null if none is in range.</returns>
public override PlayerControl GetTarget()
{
return PlayerControl.LocalPlayer.GetClosestPlayer(true, Distance, false);
}

/// <summary>
/// Sets an outline around the target player to visually indicate interaction,
/// such as highlighting a valid injection target for the Injector role.
/// </summary>
/// <param name="active">True to show the outline; false to hide it.</param>
public override void SetOutline(bool active)
{
Target?.cosmetics.SetOutline(active, new Il2CppSystem.Nullable<Color>(Palette.AcceptedGreen));
}

/// <summary>
/// Determines whether this button is available for the current role.
/// </summary>
/// <param name="role">The current player's role.</param>
/// <returns>True only for the Injector role.</returns>
public override bool Enabled(RoleBehaviour role)
{
return role is InjectorRole;
}

/// <summary>
/// Called when the button is clicked. Applies a serum to the closest valid target.
/// </summary>
protected override void OnClick()
{
var serumValues = Enum.GetValues(typeof(SerumType));
SerumType randomSerum = (SerumType)serumValues.GetValue(UnityEngine.Random.Range(0, serumValues.Length));

RpcApplySerum(PlayerControl.LocalPlayer, Target, randomSerum);
}
}
}
5 changes: 1 addition & 4 deletions NewMod/CustomGameModes/RevivalRoyale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ public override void HudUpdate(HudManager instance)
ReviveCounter.text = $"Revive Count: {ReviveCount}";
if (ReviveCount >= 6)
{
#if PC

GameManager.Instance.RpcEndGame(GameOverReason.ImpostorsByKill, true);
#else
GameManager.Instance.RpcEndGame(GameOverReason.ImpostorByKill, true);
#endif
break;
}
}
Expand Down
4 changes: 3 additions & 1 deletion NewMod/CustomRPC.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace NewMod;

public enum CustomRPC
{
Revive,
Drain,
FakeBody,
AssignMission,
MissionSuccess,
MissionFails
MissionFails,
ApplySerum
}
2 changes: 1 addition & 1 deletion NewMod/ModCompatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void DisableRole(string roleName, string pluginGuid)
var plugin = MiraPluginManager.GetPluginByGuid(pluginGuid);
if (plugin == null) return;

foreach (var kv in plugin.GetRoles())
foreach (var kv in plugin.Roles)
{
var role = kv.Value;

Expand Down
2 changes: 1 addition & 1 deletion NewMod/NewMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace NewMod;
public partial class NewMod : BasePlugin, IMiraPlugin
{
public const string Id = "com.callofcreator.newmod";
public const string ModVersion = "1.2.0";
public const string ModVersion = "1.2.1";
public Harmony Harmony { get; } = new Harmony(Id);
public static BasePlugin Instance;
public static Minigame minigame;
Expand Down
6 changes: 3 additions & 3 deletions NewMod/NewMod.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>1.2.0</VersionPrefix>
<VersionPrefix>1.2.1</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<Description>NewMod is a mod for Among Us that introduces a variety of new roles, unique abilities</Description>
<Authors>CallofCreator</Authors>
Expand All @@ -21,9 +21,9 @@

<ItemGroup>
<PackageReference Include="Reactor" Version="2.3.1" />
<PackageReference Include="AllOfUs.MiraAPI" Version="0.2.0-ci.571"/>
<PackageReference Include="AllOfUs.MiraAPI" Version="0.2.0"/>
<PackageReference Condition="'$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Release' " Include="AmongUs.GameLibs.Steam" Version="2025.4.15" PrivateAssets="all" />
<PackageReference Condition="'$(Configuration)' == 'ANDROID' " Include="AmongUs.GameLibs.Android" Version="2024.10.29" PrivateAssets="all" />
<PackageReference Condition="'$(Configuration)' == 'ANDROID' " Include="AmongUs.GameLibs.Android" Version="2025.6.10" 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.Unity.IL2CPP" Version="6.0.0-be.735" />
Expand Down
15 changes: 12 additions & 3 deletions NewMod/NewModAsset.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
using MiraAPI.Utilities.Assets;

namespace NewMod;

public static class NewModAsset
{
// Miscellaneous
public static LoadableResourceAsset Banner { get; } = new("NewMod.Resources.optionImage.png");
public static LoadableResourceAsset DeadBodySprite { get; } = new("NewMod.Resources.deadbody.png");
public static LoadableResourceAsset NecromancerButton { get; } = new("NewMod.Resources.Revive2.png");
public static LoadableResourceAsset Arrow { get; } = new("NewMod.Resources.Arrow.png");
public static LoadableResourceAsset ModLogo { get; } = new("NewMod.Resources.Logo.png");
public static LoadableResourceAsset Camera { get; } = new("NewMod.Resources.cam.png");

// Button icons
public static LoadableResourceAsset SpecialAgentButton { get; } = new("NewMod.Resources.givemission.png");
public static LoadableResourceAsset ShowScreenshotButton { get; } = new("NewMod.Resources.showscreenshot.png");
public static LoadableResourceAsset DoomAwakeningButton { get; } = new("NewMod.Resources.doomawakening.png");
public static LoadableResourceAsset NecromancerButton { get; } = new("NewMod.Resources.Revive2.png");
public static LoadableResourceAsset DeadBodySprite { get; } = new("NewMod.Resources.deadbody.png");
public static LoadableResourceAsset Camera { get; } = new("NewMod.Resources.cam.png");

// SFX
public static LoadableAudioResourceAsset ReviveSound { get; } = new("NewMod.Resources.Sounds.revive.wav");
public static LoadableAudioResourceAsset DoomAwakeningSound { get; } = new("NewMod.Resources.Sounds.gloomy_aura.wav");
public static LoadableAudioResourceAsset DoomAwakeningEndSound { get; } = new("NewMod.Resources.Sounds.evil_laugh.wav");
public static LoadableAudioResourceAsset DrainSound { get; } = new("NewMod.Resources.Sounds.drain_sound.wav");
public static LoadableAudioResourceAsset FeignDeathSound { get; } = new("NewMod.Resources.Sounds.feign_death.wav");
public static LoadableAudioResourceAsset VisionarySound { get; } = new("NewMod.Resources.Sounds.visionary_sound.wav");
}
3 changes: 2 additions & 1 deletion NewMod/NewModEndReasons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum NewModEndReasons
SpecialAgentWin = 113,
TheVisionaryWin = 114,
OverloadWin = 115,
EgoistWin = 116
EgoistWin = 116,
InjectorWin = 117
}
}
60 changes: 60 additions & 0 deletions NewMod/Options/Roles/InjectorOptions/InjectorOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using MiraAPI.GameOptions;
using MiraAPI.GameOptions.Attributes;
using MiraAPI.GameOptions.OptionTypes;
using MiraAPI.Utilities;
using NewMod.Roles.NeutralRoles;
using UnityEngine;

namespace NewMod.Options.Roles.InjectorOptions;

public class InjectorOptions : AbstractOptionGroup<InjectorRole>
{
public override string GroupName => "Injector Settings";

[ModdedNumberOption("Serum Cooldown", min: 5, max: 60, suffixType: MiraNumberSuffixes.Seconds)]
public float SerumCooldown { get; set; } = 20f;

[ModdedNumberOption("Max Serum Uses", min: 1, max: 10)]
public int MaxSerumUses { get; set; } = 3;

[ModdedNumberOption("Injections Required to Win", min: 1, max: 10)]
public int RequiredInjectCount { get; set; } = 3;

[ModdedNumberOption("Adrenaline Effect (+% Speed)", min: 10, max: 200, increment: 5, suffixType: MiraNumberSuffixes.Percent)]
public float AdrenalineSpeedBoost { get; set; } = 10f;

[ModdedNumberOption("Immobilize Duration", min: 1, max: 10, suffixType: MiraNumberSuffixes.Seconds)]
public float ParalysisDuration { get; set; } = 4f;

[ModdedNumberOption("Bounce Force (Horizontal)", min: 0f, max: 2f, increment: 0.1f)]
public float BounceForceHorizontal { get; set; } = 0.5f;

[ModdedNumberOption("Bounce Force (Vertical)", min: 0f, max: 2f, increment: 0.1f)]
public float BounceForceVertical { get; set; } = 0.5f;

[ModdedToggleOption("Enable Random Bounce Effects")]
public bool EnableBounceVariants { get; set; } = true;

[ModdedNumberOption("Bounce Duration", min: 1, max: 10, suffixType: MiraNumberSuffixes.Seconds)]
public float BounceDuration { get; set; } = 10f;

public ModdedNumberOption BounceRotateEffect { get; } = new("Bounce Rotate Effect", 180f, min: 0f, max: 180f, increment: 10f, suffixType: MiraNumberSuffixes.None)
{
Visible = () => OptionGroupSingleton<InjectorOptions>.Instance.EnableBounceVariants
};
public ModdedNumberOption BounceStretchScale { get; } = new("Bounce Stretch Scale", 1.5f, min: 1f, max: 1.5f, increment: 0.01f, suffixType: MiraNumberSuffixes.Multiplier)
{
Visible = () => OptionGroupSingleton<InjectorOptions>.Instance.EnableBounceVariants
};

[ModdedNumberOption("Repel Duration", min: 1, max: 10, suffixType: MiraNumberSuffixes.Seconds)]
public float RepelDuration { get; set; } = 10f;

[ModdedNumberOption("Repel Range", min: 0.5f, max: 4f, increment: 0.1f)]
public float RepelRange { get; set; } = 2f;

[ModdedNumberOption("Repel Force", min: 0.1f, max: 2f, increment: 0.1f, suffixType: MiraNumberSuffixes.Multiplier)]
public float RepelForce { get; set; } = 0.3f;
}


9 changes: 8 additions & 1 deletion NewMod/Patches/EndGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using NewMod.Options.Roles.SpecialAgentOptions;
using MiraAPI.GameOptions;
using MiraAPI.Events;
using NewMod.Options.Roles.InjectorOptions;

namespace NewMod.Patches
{
Expand Down Expand Up @@ -177,7 +178,7 @@ private static Color GetRoleColor(RoleTypes roleType)
}
}

[HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))]
[HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))]
public static class CheckGameEndPatch
{
public static bool Prefix(ShipStatus __instance)
Expand Down Expand Up @@ -219,6 +220,12 @@ public static bool CheckEndGameForRole<T>(ShipStatus __instance, GameOverReason
int netScore = missionSuccessCount - missionFailureCount;
shouldEndGame = netScore >= OptionGroupSingleton<SpecialAgentOptions>.Instance.RequiredMissionsToWin;
}
if (typeof(T) == typeof(InjectorRole))
{
int injectedCount = Utils.GetInjectedCount();
int required = OptionGroupSingleton<InjectorOptions>.Instance.RequiredInjectCount;
shouldEndGame = injectedCount >= required;
}
if (shouldEndGame)
{
GameManager.Instance.RpcEndGame(winReason, false);
Expand Down
1 change: 1 addition & 0 deletions NewMod/Patches/Roles/EnergyThief/OnGameEnd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] EndGam
Utils.ResetDrainCount();
Utils.ResetMissionSuccessCount();
Utils.ResetMissionFailureCount();
Utils.ClearInjections();
PranksterUtilities.ResetReportCount();
VisionaryUtilities.DeleteAllScreenshots();
Revenant.HasUsedFeignDeath = false;
Expand Down
1 change: 1 addition & 0 deletions NewMod/Patches/Roles/Visionary/VisionaryPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static void OnEnterVent(EnterVentEvent evt)
{
PlayerControl player = evt.Player;
var chancePercentage = (int)(0.2f * 100);

if (Helpers.CheckChance(chancePercentage))
{
string timestamp = System.DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss");
Expand Down
Loading
Loading