Skip to content

Commit e571466

Browse files
committed
Finally fixed the ShadowCrawl effect, used Android game libraries from NuGet, renamed DistortionWave to DistortionWaveEffect, made improvements to the Neutral Amount system, and added the Deploy Shadow Zone button sprite. Updated to v17.0.1 and MiraAPI v0.3.3
1 parent f26e6bd commit e571466

File tree

24 files changed

+424
-276
lines changed

24 files changed

+424
-276
lines changed

NewMod/Buttons/Shade/DeployShadow.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using MiraAPI.Hud;
33
using MiraAPI.Keybinds;
44
using MiraAPI.Utilities.Assets;
5-
using NewMod.Roles.NeutralRoles;
6-
using NewMod.Utilities;
75
using UnityEngine;
86
using NewMod.Components;
97
using SH = NewMod.Roles.NeutralRoles.Shade;
@@ -45,7 +43,7 @@ public class ShadeButton : CustomActionButton
4543
/// <summary>
4644
/// Button icon.
4745
/// </summary>
48-
public override LoadableAsset<Sprite> Sprite => MiraAssets.Empty;
46+
public override LoadableAsset<Sprite> Sprite => NewModAsset.DeployZone;
4947

5048
/// <summary>
5149
/// Button enabled only for the Shade role.
@@ -64,7 +62,7 @@ protected override void OnClick()
6462
float radius = OptionGroupSingleton<ShadeOptions>.Instance.Radius;
6563
float dur = OptionGroupSingleton<ShadeOptions>.Instance.Duration;
6664

67-
ShadowZone.Create(player.PlayerId, pos, radius, dur);
65+
ShadowZone.RpcDeployZone(player, pos, radius, dur);
6866
}
6967
}
7068
}
File renamed without changes.

NewMod/Components/ScreenEffects/ShadowCrawlHorrorEffect.cs renamed to NewMod/Components/ScreenEffects/ShadowFluxEffect.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
namespace NewMod.Components.ScreenEffects
66
{
77
[RegisterInIl2Cpp]
8-
public class ShadowCrawlEffect(IntPtr ptr) : MonoBehaviour(ptr)
8+
public class ShadowFluxEffect(IntPtr ptr) : MonoBehaviour(ptr)
99
{
10+
public Texture2D texture = NewModAsset.NoiseTex.LoadAsset();
1011
public float noiseScale = 2f;
1112
public float speed = 0.3f;
1213
public float edgeWidth = 0.25f;
1314
public float threshold = 0.55f;
1415
public float opacity = 0.75f;
1516
public float darkness = 0.8f;
1617
public Color tint = Color.white;
17-
private static readonly Shader _shader = NewModAsset.ShadowCrawlHorrorShader.LoadAsset();
18-
public Material _mat;
18+
public static Shader _shader = NewModAsset.ShadowFluxShader.LoadAsset();
19+
private Material _mat;
1920

2021
public void OnEnable()
2122
{
2223
_mat = new Material(_shader) { hideFlags = HideFlags.DontSave };
24+
_mat.SetTexture("_NoiseTex", texture);
2325
}
24-
2526
public void OnDisable()
2627
{
2728
Destroy(_mat);
2829
}
29-
3030
public void OnRenderImage(RenderTexture src, RenderTexture dst)
3131
{
3232
_mat.SetFloat("_NoiseScale", noiseScale);

NewMod/Components/ShadowZone.cs

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using MiraAPI.GameOptions;
55
using NewMod.Components.ScreenEffects;
66
using NewMod.Options.Roles.ShadeOptions;
7+
using NewMod.Roles.NeutralRoles;
8+
using NewMod.Utilities;
9+
using Reactor.Networking.Attributes;
10+
using Reactor.Utilities;
711
using Reactor.Utilities.Attributes;
812
using UnityEngine;
913

@@ -15,67 +19,95 @@ public class ShadowZone(IntPtr ptr) : MonoBehaviour(ptr)
1519
public byte shadeId;
1620
public float radius;
1721
public float duration;
18-
public float _t;
19-
public bool _on;
20-
public static List<ShadowZone> zones = new();
22+
private float timer;
23+
private bool active;
24+
public static readonly List<ShadowZone> zones = new();
2125

2226
public void Awake()
2327
{
24-
if (!zones.Contains(this)) zones.Add(this);
28+
if (!zones.Contains(this))
29+
zones.Add(this);
2530
}
2631

2732
public void OnDestroy()
2833
{
2934
zones.Remove(this);
3035
}
3136

32-
public bool Contains(Vector2 pos)
37+
private bool Contains(Vector2 pos)
3338
{
3439
return Vector2.Distance(pos, (Vector2)transform.position) <= radius;
3540
}
3641

3742
public void Update()
3843
{
39-
_t += Time.deltaTime;
40-
if (_t >= duration)
44+
timer += Time.deltaTime;
45+
if (timer >= duration)
4146
{
47+
Coroutines.Start(CoroutinesHelper.RemoveCameraEffect(Camera.main, 0f));
48+
active = false;
4249
Destroy(gameObject);
4350
return;
4451
}
4552

4653
var lp = PlayerControl.LocalPlayer;
47-
if (!lp || lp.PlayerId == shadeId) return;
54+
var hud = HudManager.Instance;
55+
var killButton = hud.KillButton;
4856

4957
bool inside = Contains(lp.GetTruePosition());
50-
var cam = Camera.main;
51-
var fx = cam.GetComponent<ShadowCrawlEffect>();
52-
5358
var mode = OptionGroupSingleton<ShadeOptions>.Instance.Behavior;
59+
var cam = Camera.main;
5460

55-
if (inside && !_on)
61+
if (inside && !active)
5662
{
57-
if (cam && fx == null) cam.gameObject.AddComponent<ShadowCrawlEffect>();
58-
59-
if (mode is ShadeOptions.ShadowMode.Invisible or ShadeOptions.ShadowMode.Both)
63+
cam.gameObject.AddComponent<ShadowFluxEffect>();
64+
if (lp.PlayerId == shadeId && lp.Data.Role is Shade)
6065
{
61-
lp.SetInvisibility(true);
66+
if (mode is ShadeOptions.ShadowMode.Invisible or ShadeOptions.ShadowMode.Both)
67+
{
68+
lp.cosmetics.SetPhantomRoleAlpha(0);
69+
lp.cosmetics.nameText.gameObject.SetActive(false);
70+
}
71+
72+
killButton.gameObject.SetActive(true);
73+
killButton.currentTarget = null;
6274
}
75+
active = true;
76+
}
6377

78+
if (inside && active && lp.PlayerId == shadeId && lp.Data.Role is Shade)
79+
{
6480
if (mode is ShadeOptions.ShadowMode.KillEnabled or ShadeOptions.ShadowMode.Both)
6581
{
66-
lp.Data.Role.CanUseKillButton = true;
67-
}
82+
var list = new Il2CppSystem.Collections.Generic.List<PlayerControl>();
83+
lp.Data.Role.GetPlayersInAbilityRangeSorted(list);
84+
var players = list.ToArray().Where(p => p.PlayerId != lp.PlayerId && !p.Data.IsDead).ToList();
85+
var closest = players.Count > 0 ? players[0] : null;
86+
87+
if (killButton.currentTarget && killButton.currentTarget != closest)
88+
killButton.currentTarget.ToggleHighlight(false, RoleTeamTypes.Impostor);
6889

69-
_on = true;
90+
killButton.currentTarget = closest;
91+
if (closest != null)
92+
closest.ToggleHighlight(true, RoleTeamTypes.Impostor);
93+
}
7094
}
71-
else if (!inside && _on)
95+
else if (!inside && active)
7296
{
73-
if (fx) Destroy(fx);
74-
75-
lp.SetInvisibility(false);
76-
lp.Data.Role.CanUseKillButton = false;
97+
Coroutines.Start(CoroutinesHelper.RemoveCameraEffect(cam, 0f));
98+
if (lp.PlayerId == shadeId)
99+
{
100+
lp.cosmetics.SetPhantomRoleAlpha(1);
101+
lp.cosmetics.nameText.gameObject.SetActive(true);
77102

78-
_on = false;
103+
if (killButton.currentTarget)
104+
{
105+
killButton.currentTarget.ToggleHighlight(false, RoleTeamTypes.Impostor);
106+
killButton.currentTarget = null;
107+
}
108+
killButton.gameObject.SetActive(false);
109+
}
110+
active = false;
79111
}
80112
}
81113

@@ -89,9 +121,16 @@ public static ShadowZone Create(byte id, Vector2 pos, float r, float dur)
89121
go.transform.position = pos;
90122
return z;
91123
}
124+
125+
[MethodRpc((uint)CustomRPC.DeployZone)]
126+
public static void RpcDeployZone(PlayerControl source, Vector2 pos, float radius, float duration)
127+
{
128+
Create(source.PlayerId, pos, radius, duration);
129+
}
130+
92131
public static bool IsInsideAny(Vector2 pos)
93132
{
94-
return zones.Any(a => a && a.Contains(pos));
133+
return zones.Any(z => z && z.Contains(pos));
95134
}
96135
}
97136
}

NewMod/CustomRPC.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ public enum CustomRPC
1414
SuppressionDome,
1515
WitnessTrap,
1616
NotifyChampion,
17-
SummonNPC
17+
SummonNPC,
18+
BeaconPulse,
19+
DeployZone
1820
}

NewMod/DebugWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ private static bool AllowDebug()
102102
{
103103
Camera.main.gameObject.AddComponent<DistorationWaveEffect>();
104104
}
105-
if (GUILayout.Button("Apply ShadowCrawlHorror Effect to Main Camera") && allow)
105+
if (GUILayout.Button("Apply ShadowFlux Effect to Main Camera") && allow)
106106
{
107-
Camera.main.gameObject.AddComponent<ShadowCrawlEffect>();
107+
Camera.main.gameObject.AddComponent<ShadowFluxEffect>();
108108
}
109109
if (GUILayout.Button("Reset Camera Effects") && allow)
110110
{
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Hazel;
2+
using NewMod.Components.ScreenEffects;
3+
using NewMod.Roles.CrewmateRoles;
4+
using NewMod.Utilities;
5+
using Reactor.Networking.Attributes;
6+
using Reactor.Networking.Rpc;
7+
using Reactor.Utilities;
8+
using UnityEngine;
9+
10+
namespace NewMod.Networking
11+
{
12+
[RegisterCustomRpc((uint)CustomRPC.BeaconPulse)]
13+
public class BeaconPulseRpc : PlayerCustomRpc<NewMod, BeaconPulseRpc.Data>
14+
{
15+
public BeaconPulseRpc(NewMod plugin, uint id) : base(plugin, id) { }
16+
17+
public readonly record struct Data(float Duration);
18+
19+
public override RpcLocalHandling LocalHandling => RpcLocalHandling.After;
20+
21+
public override void Write(MessageWriter writer, Data data)
22+
{
23+
writer.Write(data.Duration);
24+
}
25+
26+
public override Data Read(MessageReader reader)
27+
{
28+
return new Data(reader.ReadSingle());
29+
}
30+
31+
public override void Handle(PlayerControl sender, Data data)
32+
{
33+
var cam = Camera.main;
34+
if (cam && !cam.GetComponent<DistorationWaveEffect>())
35+
{
36+
cam.gameObject.AddComponent<DistorationWaveEffect>();
37+
}
38+
Beacon.pulseUntil = Time.time + data.Duration;
39+
40+
Logger<NewMod>.Instance.LogMessage($"Beacon pulse triggered by {sender.Data.PlayerName} for {data.Duration}s");
41+
}
42+
}
43+
}

NewMod/NewMod.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class NewMod : BasePlugin, IMiraPlugin
4141
public Harmony Harmony { get; } = new Harmony(Id);
4242
public static BasePlugin Instance;
4343
public static Minigame minigame;
44-
public const string SupportedAmongUsVersion = "2025.9.9";
44+
public const string SupportedAmongUsVersion = "2025.10.14";
4545
public static ConfigEntry<bool> ShouldEnableBepInExConsole { get; set; }
4646
public ConfigFile GetConfigFile() => Config;
4747
public string OptionsTitleText => "NewMod";
@@ -62,6 +62,16 @@ public override void Load()
6262
ShouldEnableBepInExConsole = Config.Bind("NewMod", "Console", true, "Whether to enable BepInEx Console for debugging");
6363
if (!ShouldEnableBepInExConsole.Value) ConsoleManager.DetachConsole();
6464

65+
var bundle = NewModAsset.Bundle;
66+
var assetNames = bundle.GetAllAssetNames();
67+
68+
Instance.Log.LogMessage($"AssetBundle '{bundle.name}' contains {assetNames.Length} assets");
69+
70+
foreach (var name in assetNames)
71+
{
72+
Instance.Log.LogMessage($"{name}");
73+
}
74+
6575
Instance.Log.LogMessage($"Loaded Successfully NewMod v{ModVersion} With MiraAPI Version : {MiraApiPlugin.Version}");
6676
}
6777
public static void CheckVersionCompatibility()

NewMod/NewMod.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<VersionPrefix>1.2.7</VersionPrefix>
3+
<VersionPrefix>1.2.8</VersionPrefix>
44
<VersionSuffix>dev</VersionSuffix>
55
<Description>NewMod is a mod for Among Us that introduces a variety of new roles, unique abilities</Description>
66
<Authors>CallofCreator</Authors>
@@ -15,15 +15,14 @@
1515
</PropertyGroup>
1616

1717
<PropertyGroup Condition=" '$(Configuration)' == 'ANDROID' And '$(BuildingInsideCI)' != 'true' ">
18-
<RestoreSources>$(RestoreSources);$(MSBuildProjectDirectory)\..\libs\Android</RestoreSources>
1918
<DefineConstants>TRACE;ANDROID_BUILD</DefineConstants>
2019
</PropertyGroup>
2120

2221
<ItemGroup>
2322
<PackageReference Include="Reactor" Version="2.3.1" />
24-
<PackageReference Include="AllOfUs.MiraAPI" Version="0.3.1" />
25-
<PackageReference Condition="'$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Release' " Include="AmongUs.GameLibs.Steam" Version="2025.9.9" PrivateAssets="all" />
26-
<PackageReference Condition="'$(Configuration)' == 'ANDROID' " Include="AmongUs.GameLibs.Android" Version="2025.9.9" PrivateAssets="all" />
23+
<PackageReference Include="AllOfUs.MiraAPI" Version="0.3.3" />
24+
<PackageReference Condition="'$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Release' " Include="AmongUs.GameLibs.Steam" Version="2025.10.14" PrivateAssets="all" />
25+
<PackageReference Condition="'$(Configuration)' == 'ANDROID' " Include="AmongUs.GameLibs.Android" Version="2025.10.14" PrivateAssets="all" />
2726
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
2827
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
2928
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" />

NewMod/NewModAsset.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static class NewModAsset
4141
public static LoadableResourceAsset CallWraith { get; } = new("NewMod.Resources.callwraith.png");
4242
public static LoadableResourceAsset Shield { get; } = new("NewMod.Resources.Shield.png");
4343
public static LoadableResourceAsset Slash { get; } = new("NewMod.Resources.Slash.png");
44+
public static LoadableResourceAsset DeployZone { get; } = new("NewMod.Resources.deployzone.png");
4445

4546
// SFX
4647
public static LoadableAudioResourceAsset ReviveSound { get; } = new("NewMod.Resources.Sounds.revive.wav");
@@ -61,6 +62,7 @@ public static class NewModAsset
6162
public static LoadableResourceAsset ShieldIcon { get; } = new("NewMod.Resources.RoleIcons.ShieldIcon.png");
6263
public static LoadableResourceAsset RadarIcon { get; } = new("NewMod.Resources.RoleIcons.RadarIcon.png");
6364
public static LoadableResourceAsset SlashIcon { get; } = new("NewMod.Resources.RoleIcons.SlashIcon.png");
65+
public static LoadableResourceAsset DeployZoneIcon { get; } = new("NewMod.Resources.RoleIcons.DeployzoneIcon.png");
6466

6567
// Notif Icons
6668
public static LoadableResourceAsset VisionDebuff { get; } = new("NewMod.Resources.NotifIcons.vision_debuff.png");
@@ -72,5 +74,8 @@ public static class NewModAsset
7274
public static LoadableAsset<Shader> EarthquakeShader { get; } = new LoadableBundleAsset<Shader>("EarthquakeFullScreen.shader", Bundle);
7375
public static LoadableAsset<Shader> SlowPulseHueShader { get; } = new LoadableBundleAsset<Shader>("SlowPulseHue.shader", Bundle);
7476
public static LoadableAsset<Shader> DistorationWaveShader { get; } = new LoadableBundleAsset<Shader>("DistorationWave.shader", Bundle);
75-
public static LoadableAsset<Shader> ShadowCrawlHorrorShader { get; } = new LoadableBundleAsset<Shader>("ShadowCrawlHorror.shader", Bundle);
77+
public static LoadableAsset<Shader> ShadowFluxShader { get; } = new LoadableBundleAsset<Shader>("ShadowFlux.shader", Bundle);
78+
79+
// Textures
80+
public static LoadableAsset<Texture2D> NoiseTex { get; } = new LoadableBundleAsset<Texture2D>("noise.png", Bundle);
7681
}

0 commit comments

Comments
 (0)