mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
temp disable gamemodes
This commit is contained in:
1 parent
742ad44d10
commit
65e533c268
15 files changed
+146
-17
No files matched your search
@@ -45,7 +45,7 @@ public static class CustomGameModeManager
|
||||
/// Register gamemode from type
|
||||
/// </summary>
|
||||
/// <param name="gameModeType">Type of gamemode class, should inherit from <see cref="CustomGameMode"/></param>
|
||||
public static void RegisterGameMode(Type gameModeType)
|
||||
internal static void RegisterGameMode(Type gameModeType)
|
||||
{
|
||||
if (!typeof(CustomGameMode).IsAssignableFrom(gameModeType))
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public class RegisterGameModeAttribute : Attribute
|
||||
{
|
||||
private static readonly HashSet<Assembly> RegisteredAssemblies = [];
|
||||
|
||||
public static void Register(Assembly assembly)
|
||||
internal static void Register(Assembly assembly)
|
||||
{
|
||||
if (!RegisteredAssemblies.Add(assembly)) return;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using InnerNet;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch]
|
||||
public static class ConsolePatches
|
||||
{
|
||||
@@ -73,4 +73,4 @@ public static class ConsolePatches
|
||||
canUse = couldUse = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -0,0 +1,16 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch(typeof(DeadBody))]
|
||||
public static class DeadBodyPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(DeadBody.OnClick))]
|
||||
public static bool OnClickPatch(DeadBody __instance)
|
||||
{
|
||||
return CustomGameModeManager.ActiveMode == null || CustomGameModeManager.ActiveMode.CanReport(__instance);
|
||||
}
|
||||
}*/
|
||||
@@ -3,6 +3,7 @@ using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch]
|
||||
public static class GameLogicPatches
|
||||
{
|
||||
@@ -21,4 +22,4 @@ public static class GameLogicPatches
|
||||
CustomGameModeManager.ActiveMode?.AssignRoles(out runOriginal, __instance);
|
||||
return runOriginal;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -3,6 +3,7 @@ using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Allow Impostors to kill each other if can kill is enabled in gamemode or friendly fire is toggled on
|
||||
/// </summary>
|
||||
@@ -25,4 +26,4 @@ public static class ImpostorTargetPatch
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -3,8 +3,9 @@ using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch(typeof(MapBehaviour))]
|
||||
public class MapBehaviourPatch
|
||||
public static class MapBehaviourPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(MapBehaviour.ShowSabotageMap))]
|
||||
@@ -19,4 +20,4 @@ public class MapBehaviourPatch
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -0,0 +1,16 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch(typeof(KillAnimation))]
|
||||
public static class OnDeathPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(KillAnimation.CoPerformKill))]
|
||||
public static void OnDeathPostfix([HarmonyArgument(0)] PlayerControl source, [HarmonyArgument(1)] PlayerControl target)
|
||||
{
|
||||
CustomGameModeManager.ActiveMode?.OnDeath(target);
|
||||
}
|
||||
}*/
|
||||
@@ -0,0 +1,57 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
/*
|
||||
[HarmonyPatch(typeof(Vent))]
|
||||
public static class VentPatches
|
||||
{
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(Vent.CanUse))]
|
||||
public static bool CanUseVentPatch(Vent __instance, ref float __result, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse)
|
||||
{
|
||||
if (CustomGameModeManager.ActiveMode?.CanVent(__instance, pc) == false)
|
||||
{
|
||||
return couldUse = canUse = false;
|
||||
}
|
||||
|
||||
if (pc.Role is not ICustomRole role)
|
||||
{
|
||||
return couldUse = canUse = true;
|
||||
}
|
||||
|
||||
var num = float.MaxValue;
|
||||
var @object = pc.Object;
|
||||
var customRoleUsable = role.CanUseVent;
|
||||
|
||||
canUse = couldUse = customRoleUsable && !pc.IsDead && (@object.CanMove || @object.inVent);
|
||||
if (canUse)
|
||||
{
|
||||
var center = @object.Collider.bounds.center;
|
||||
var position = __instance.transform.position;
|
||||
num = Vector2.Distance(center, position);
|
||||
canUse &= num <= __instance.UsableDistance && !PhysicsHelpers.AnythingBetween(@object.Collider, center, position, Constants.ShipOnlyMask, false);
|
||||
}
|
||||
__result = num;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(Vent.SetOutline))]
|
||||
public static bool SetOutlinePatch(Vent __instance, [HarmonyArgument(0)] bool on, [HarmonyArgument(1)] bool mainTarget)
|
||||
{
|
||||
var color = PlayerControl.LocalPlayer.Data.Role is ICustomRole role
|
||||
? role.RoleColor : PlayerControl.LocalPlayer.Data.Role.IsImpostor ? Palette.ImpostorRed : Palette.CrewmateBlue;
|
||||
__instance.myRend.material.SetFloat(ShaderID.Outline, on ? 1 : 0);
|
||||
__instance.myRend.material.SetColor(ShaderID.OutlineColor, color);
|
||||
__instance.myRend.material.SetColor(ShaderID.AddColor, mainTarget ? color : Color.clear);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}*/
|
||||
@@ -27,10 +27,11 @@ public static class HudManagerPatches
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//CustomGameModeManager.ActiveMode?.HudUpdate(__instance);
|
||||
|
||||
//CustomGameModeManager.ActiveMode.HudUpdate(__instance);
|
||||
if (local is null || local.Data is null || local.Data.Role is null) return;
|
||||
|
||||
if (local?.Data?.Role is null) return;
|
||||
|
||||
if (local.Data.Role is ICustomRole customRole)
|
||||
{
|
||||
customRole.HudUpdate(__instance);
|
||||
@@ -57,6 +58,7 @@ public static class HudManagerPatches
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Trigger hudstart on current custom gamemode
|
||||
/// </summary>
|
||||
@@ -65,7 +67,7 @@ public static class HudManagerPatches
|
||||
public static void GameStartPatch(HudManager __instance)
|
||||
{
|
||||
CustomGameModeManager.ActiveMode?.HudStart(__instance);
|
||||
}
|
||||
}*/
|
||||
|
||||
/// <summary>
|
||||
/// Create custom buttons parent
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace MiraAPI.Patches;
|
||||
[HarmonyPatch(typeof(IntroCutscene))]
|
||||
public static class IntroCutscenePatches
|
||||
{
|
||||
/*
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(IntroCutscene.BeginImpostor))]
|
||||
public static void BeginImpostorPatch(IntroCutscene __instance)
|
||||
@@ -18,7 +19,7 @@ public static class IntroCutscenePatches
|
||||
var mode = CustomGameModeManager.ActiveMode;
|
||||
__instance.TeamTitle.text = $"<size=70%>{mode.Name}</size>\n<size=20%>{mode.Description}</size>";
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(IntroCutscene.BeginCrewmate))]
|
||||
@@ -48,10 +49,11 @@ public static class IntroCutscenePatches
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(IntroCutscene.OnDestroy))]
|
||||
public static void GameBeginPatch()
|
||||
{
|
||||
CustomGameModeManager.ActiveMode?.Initialize();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -139,7 +139,10 @@ public static class RoleSettingMenuPatches
|
||||
__instance.advancedSettingChildren.Clear();
|
||||
|
||||
float num = -0.872f;
|
||||
foreach (var option in GameSettingMenuPatches.SelectedMod.Options)
|
||||
|
||||
var filteredOptions = GameSettingMenuPatches.SelectedMod.Options.Where(x => x.AdvancedRole == role.GetType());
|
||||
|
||||
foreach (var option in filteredOptions)
|
||||
{
|
||||
if (option.AdvancedRole is not null && option.AdvancedRole != role.GetType()) continue;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Hud;
|
||||
using MiraAPI.Roles;
|
||||
|
||||
namespace MiraAPI.Patches;
|
||||
|
||||
@@ -13,6 +14,11 @@ public static class PlayerControlPatches
|
||||
{
|
||||
if (!__instance.AmOwner) return;
|
||||
|
||||
if (__instance.Data?.Role is ICustomRole customRole)
|
||||
{
|
||||
customRole.PlayerControlFixedUpdate(__instance);
|
||||
}
|
||||
|
||||
foreach (var button in CustomButtonManager.CustomButtons)
|
||||
{
|
||||
if (!button.Enabled(__instance.Data.Role))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Roles;
|
||||
|
||||
namespace MiraAPI.Patches.Roles;
|
||||
|
||||
[HarmonyPatch(typeof(ExileController))]
|
||||
public static class EjectionPatches
|
||||
{
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(ExileController.Begin))]
|
||||
public static void Begin(ExileController __instance)
|
||||
{
|
||||
if (!__instance.exiled?.Role || __instance.exiled.Role is not ICustomRole role)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (role.GetCustomEjectionMessage(__instance.exiled) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.completeString = role.GetCustomEjectionMessage(__instance.exiled);
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,6 @@ public interface ICustomRole
|
||||
|
||||
MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this);
|
||||
|
||||
void CreateOptions() { }
|
||||
|
||||
void PlayerControlFixedUpdate(PlayerControl playerControl) { }
|
||||
|
||||
void HudUpdate(HudManager hudManager) { }
|
||||
|
||||
Reference in new issue
Block a user