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
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: NewMod CI

on:
push:
branches:
- main
- dev
branches: [main, dev]
tags:
- 'v*'
pull_request:
branches:
- main
- dev
branches: [main, dev]
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -68,22 +66,24 @@ jobs:
name: NewMod-Android
path: NewMod/bin/ANDROID/net6.0/NewMod.dll


release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
permissions:
contents: write

steps:
- name: Download Release DLL
uses: actions/download-artifact@v4
with:
name: NewMod
path: ./release_artifacts

- name: Publish GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v1.2.${{ github.run_number }}
files: NewMod/bin/Release/net6.0/NewMod.dll
tag_name: ${{ github.ref_name }}
files: ./release_artifacts/**/NewMod.dll
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions NewMod/Buttons/Aegis/AegisButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using MiraAPI.GameOptions;
using MiraAPI.Hud;
using MiraAPI.Utilities.Assets;
using NewMod.Options.Roles.AegisOptions;
using UnityEngine;
using AG = NewMod.Roles.CrewmateRoles.Aegis;
using NewMod.Utilities;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Aegis
{
/// <summary>
/// Custom action button for the Aegis role. Places a configurable shield zone.
/// </summary>
public class AegisButton : CustomActionButton
{
/// <summary>
/// Gets the display name for this button.
/// </summary>
public override string Name => "Sentinel Ward";

/// <summary>
/// Cooldown is driven by AegisOptions.
/// </summary>
public override float Cooldown => OptionGroupSingleton<AegisOptions>.Instance.AegisCooldown;

/// <summary>
/// Maximum number of uses is driven by AegisOptions.
/// </summary>
public override int MaxUses => (int)OptionGroupSingleton<AegisOptions>.Instance.MaxCharges;

/// <summary>
/// Button location on HUD.
/// </summary>
public override ButtonLocation Location => ButtonLocation.BottomLeft;

/// <summary>
/// Default keybind for Aegis.
/// </summary>
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// No “hold” effect, instant cast.
/// </summary>
public override float EffectDuration => 0f;

/// <summary>
/// Icon for the button (replace with your actual asset).
/// </summary>
public override LoadableAsset<Sprite> Sprite => NewModAsset.Shield;

/// <summary>
/// Enabled only for the Aegis role.
/// </summary>
public override bool Enabled(RoleBehaviour role) => role is AG;

/// <summary>
/// On click, place the Aegis shield at the player's current position using the configured settings.
/// </summary>
protected override void OnClick()
{
var player = PlayerControl.LocalPlayer;

AegisUtilities.ActivateShield(player, (Vector2)player.transform.position);
}
}
}
92 changes: 92 additions & 0 deletions NewMod/Buttons/Edgeveil/ArcButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using MiraAPI.GameOptions;
using MiraAPI.Hud;
using MiraAPI.Utilities.Assets;
using NewMod.Options.Roles.EdgeveilOptions;
using EV = NewMod.Roles.ImpostorRoles.Edgeveil;
using Rewired;
using UnityEngine;
using NewMod.Components.ScreenEffects;
using NewMod.Utilities;
using Reactor.Utilities;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Edgeveil
{
/// <summary>
/// Defines a custom action button for Edgeviel's Arc ability.
/// </summary>
public class ArcButton : CustomActionButton
{
/// <summary>
/// The name displayed on the button.
/// </summary>
public override string Name => "Arc";

/// <summary>
/// Gets the cooldown time for this button, based on <see cref="EdgeveilOptions"/>.
/// </summary>
public override float Cooldown => OptionGroupSingleton<EdgeveilOptions>.Instance.SlashCooldown;

/// <summary>
/// Gets the maximum number of uses for this button (0 = infinite).
/// </summary>
public override int MaxUses => (int)OptionGroupSingleton<EdgeveilOptions>.Instance.SlashMaxUses;

/// <summary>
/// Determines how long the effect lasts. For Arc, none.
/// </summary>
public override float EffectDuration => 0f;

/// <summary>
/// Default keybind for Edgeveil's Arc ability.
/// </summary>
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// Defines where on the screen this button should appear.
/// </summary>
public override ButtonLocation Location => ButtonLocation.BottomLeft;

/// <summary>
/// The visual icon for this button, set to the Edgeveil Arc sprite asset.
/// </summary>
public override LoadableAsset<Sprite> Sprite => NewModAsset.SlashIcon;

/// <summary>
/// Invoked when the Arc button is clicked.
/// </summary>
protected override void OnClick()
{
var player = PlayerControl.LocalPlayer;

bool flipLeft = player.cosmetics.currentBodySprite.BodySprite.flipX;
Vector2 dir = flipLeft ? Vector2.left : Vector2.right;

float spawnOffset = 0.55f;
var spawnPos = player.GetTruePosition() + dir * spawnOffset;

var tray = SlashTray.CreateTray();
tray.transform.SetParent(ShipStatus.Instance.transform, worldPositionStays: true);
tray.transform.SetPositionAndRotation(
new Vector3(spawnPos.x, spawnPos.y, player.transform.position.z),
Quaternion.FromToRotation(Vector3.right, new Vector3(dir.x, dir.y, 0f))
);

tray.Owner = player;
tray.SetMotion(dir, OptionGroupSingleton<EdgeveilOptions>.Instance.SlashSpeed);

float effectDuration = OptionGroupSingleton<EdgeveilOptions>.Instance.EffectDuration;

HudManager.Instance.PlayerCam.ShakeScreen(effectDuration, 2f);
}
/// <summary>
/// Determines whether this button is enabled for the role, returning true if the role is <see cref="EdgevielRole"/>.
/// </summary>
/// <param name="role">The current player's role.</param>
/// <returns>True if the role is Edgeveil; otherwise false.</returns>
public override bool Enabled(RoleBehaviour role)
{
return role is EV;
}
}
}
6 changes: 3 additions & 3 deletions NewMod/Buttons/EnergyThief/DrainButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ET = NewMod.Roles.NeutralRoles.EnergyThief;
using UnityEngine;
using NewMod.Utilities;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.EnergyThief
{
Expand Down Expand Up @@ -34,11 +34,11 @@ public class DrainButton : CustomActionButton<PlayerControl>
/// The on-screen position of this button.
/// </summary>
public override ButtonLocation Location => ButtonLocation.BottomRight;

/// <summary>
/// Default keybind for EnergyThief's Drain ability.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.F;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// The duration of the effect applied by this button; in this case, zero.
Expand Down
4 changes: 2 additions & 2 deletions NewMod/Buttons/Injector/InjectButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using MiraAPI.Utilities;
using System;
using static NewMod.Utilities.Utils;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Injector
{
Expand Down Expand Up @@ -45,7 +45,7 @@ public class InjectButton : CustomActionButton<PlayerControl>
/// <summary>
/// Default keybind for Injector's Inject ability.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.C;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// Sprite/icon displayed on the button.
Expand Down
4 changes: 2 additions & 2 deletions NewMod/Buttons/Necromancer/ReviveButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using NewMod.Roles.ImpostorRoles;
using UnityEngine;
using NewMod.Utilities;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Necromancer
{
Expand Down Expand Up @@ -37,7 +37,7 @@ public class ReviveButton : CustomActionButton
/// <summary>
/// Default keybind for Necromancer's Revive ability.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.V;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// Defines where on the screen this button should appear.
Expand Down
3 changes: 2 additions & 1 deletion NewMod/Buttons/Overload/FinalButton.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using MiraAPI.GameOptions;
using MiraAPI.Hud;
using MiraAPI.Keybinds;
using MiraAPI.Utilities.Assets;
using NewMod.Options.Roles.OverloadOptions;
using NewMod.Roles.NeutralRoles;
Expand Down Expand Up @@ -32,7 +33,7 @@ public class FinalAbilityButton : CustomActionButton
/// <summary>
/// Default keybind for the Final Ability button.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.B;
public override MiraKeybind Keybind => MiraGlobalKeybinds.SecondaryAbility;

/// <summary>
/// No duration effect.
Expand Down
8 changes: 4 additions & 4 deletions NewMod/Buttons/Overload/OverloadButton.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using MiraAPI.Hud;
using MiraAPI.Keybinds;
using MiraAPI.Utilities.Assets;
using NewMod.Roles.NeutralRoles;
using Rewired;
using UnityEngine;

namespace NewMod.Buttons.Overload
Expand Down Expand Up @@ -47,7 +47,7 @@ public class OverloadButton : CustomActionButton
/// Stores the default key assigned to the absorbed button's action.
/// Mirrors the keybind of the original absorbed button.
/// </summary>
public KeyboardKeyCode absorbedKeybind;
public MiraKeybind absorbedKeybind;

/// <summary>
/// The name displayed on the button.
Expand All @@ -67,7 +67,7 @@ public class OverloadButton : CustomActionButton
/// <summary>
/// Default keybind for Overload's Overload ability.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => absorbedKeybind;
public override MiraKeybind Keybind => absorbedKeybind;

/// <summary>
/// Determines how long the effect from clicking the button lasts. In this case, no duration is set.
Expand Down Expand Up @@ -96,7 +96,7 @@ public void Absorb(CustomActionButton target)
absorbedCooldown = target.Cooldown;
absorbedMaxUses = target.MaxUses;
absorbedSprite = target.Sprite;
absorbedKeybind = target.Defaultkeybind;
absorbedKeybind = target.Keybind;
absorbedOnClick = () => target.GetType().GetMethod("OnClick", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
?.Invoke(target, null);

Expand Down
3 changes: 2 additions & 1 deletion NewMod/Buttons/Prankster/FakeBodyButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using UnityEngine;
using NewMod.Utilities;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Prankster
{
Expand Down Expand Up @@ -38,7 +39,7 @@ public class FakeBodyButton : CustomActionButton
/// <summary>
/// Default keybind for Prankster's Fake Body ability.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.Z;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// The duration of any effect caused by this button press; in this case, no effect duration is used.
Expand Down
5 changes: 2 additions & 3 deletions NewMod/Buttons/PulseBlade/StrikeButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using NewMod.Utilities;
using Reactor.Networking.Attributes;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Pulseblade
{
Expand Down Expand Up @@ -48,10 +49,8 @@ public class StrikeButton : CustomActionButton

/// <summary>
/// Default keybind for Pulseblade's Strike ability.
/// Requires Shift as a modifier to prevent accidental use.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.G;
public override ModifierKey Modifier1 => ModifierKey.Shift;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;
/// <summary>
/// Sprite used for the button — set to empty;
/// </summary>
Expand Down
8 changes: 3 additions & 5 deletions NewMod/Buttons/Revenant/DoomAwakening.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
using NewMod.Utilities;
using Reactor.Utilities;
using UnityEngine;
using TMPro;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Revenant
{
Expand Down Expand Up @@ -41,10 +40,9 @@ public class DoomAwakening : CustomActionButton

/// <summary>
/// Default keybind for Doom's Awakening ability.
/// Requires Alt as a modifier to prevent accidental use.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.B;
public override ModifierKey Modifier1 => ModifierKey.Alt;
public override MiraKeybind Keybind => MiraGlobalKeybinds.SecondaryAbility;

/// <summary>
/// Determines how long the effect lasts. Configured in <see cref="RevenantOptions"/>.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions NewMod/Buttons/Revenant/FeignDeathButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using NewMod.Utilities;
using Reactor.Utilities;
using UnityEngine;
using Rewired;
using MiraAPI.Keybinds;

namespace NewMod.Buttons.Revenant
{
Expand Down Expand Up @@ -37,10 +37,8 @@ public class FeignDeathButton : CustomActionButton

/// <summary>
/// Default keybind for Revenant's Feign Death ability.
/// Requires Ctrl as a modifier to prevent accidental use.
/// </summary>
public override KeyboardKeyCode Defaultkeybind => KeyboardKeyCode.T;
public override ModifierKey Modifier1 => ModifierKey.Control;
public override MiraKeybind Keybind => MiraGlobalKeybinds.PrimaryAbility;

/// <summary>
/// The duration of any effect from this button. In this case, zero.
Expand Down
Loading