mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Add crewmate kill tracker
This commit is contained in:
1 parent
b33a66cbd9
commit
ae4b4d872b
5 files changed
+58
-20
No files matched your search
@@ -37,6 +37,11 @@ public abstract class AbstractGameMode : IOptionable
|
||||
/// </summary>
|
||||
public virtual bool GameModeBodyTypeOverride => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the gamemode is based on Hide n Seek.
|
||||
/// </summary>
|
||||
public virtual bool IsHideAndSeek => false;
|
||||
|
||||
/// <summary>
|
||||
/// Called on GameManager.GetBodyType().
|
||||
/// </summary>
|
||||
|
||||
@@ -29,6 +29,7 @@ public class HideAndSeekMode : AbstractGameMode
|
||||
public override bool ShouldShowSabotageMap(MapBehaviour map) => false;
|
||||
public override bool ShowGameModeIntroCutscene => true;
|
||||
public override bool GameModeBodyTypeOverride => true;
|
||||
public override bool IsHideAndSeek => true;
|
||||
|
||||
public override IEnumerator IntroCutscene(IntroCutscene __instance)
|
||||
{
|
||||
@@ -226,6 +227,7 @@ public class HideAndSeekMode : AbstractGameMode
|
||||
public override void OnPlayerDeath(PlayerControl player, bool assignGhostRole)
|
||||
{
|
||||
base.OnPlayerDeath(player, assignGhostRole);
|
||||
HudManager.Instance.NotifyOfDeath();
|
||||
var popup = GameManagerCreator.Instance.HideAndSeekManagerPrefab.DeathPopupPrefab;
|
||||
deadPlayerCount++;
|
||||
var item = UnityEngine.Object.Instantiate(popup, HudManager.Instance.transform.parent);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
[HarmonyPatch(typeof(GameManager))]
|
||||
internal static class GameManagerPatches
|
||||
{
|
||||
[HarmonyPrefix, HarmonyPatch(nameof(GameManager.OnPlayerDeath))]
|
||||
public static bool OnDeathPrefix([HarmonyArgument(0)] PlayerControl player, [HarmonyArgument(1)] bool assignGhostRole)
|
||||
{
|
||||
if (CustomGameModeManager.ActiveMode != null)
|
||||
{
|
||||
CustomGameModeManager.ActiveMode.OnPlayerDeath(player, assignGhostRole);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
[HarmonyPrefix, HarmonyPatch(nameof(GameManager.ShowCrewmatesKilled))]
|
||||
public static bool ShowCrewmatesKilledPrefix(ref bool __result)
|
||||
{
|
||||
if (CustomGameModeManager.ActiveMode != null)
|
||||
{
|
||||
__result = CustomGameModeManager.ActiveMode.IsHideAndSeek;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
[HarmonyPatch(typeof(NormalGameManager))]
|
||||
internal static class NormalGameManagerPatches
|
||||
{
|
||||
[HarmonyPrefix, HarmonyPatch(nameof(NormalGameManager.IsNormal))]
|
||||
public static bool IsNormal(ref bool __result)
|
||||
{
|
||||
if (CustomGameModeManager.ActiveMode != null)
|
||||
{
|
||||
__result = !CustomGameModeManager.ActiveMode.IsHideAndSeek;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameModes;
|
||||
|
||||
namespace MiraAPI.Patches.GameModes;
|
||||
|
||||
[HarmonyPatch(typeof(GameManager))]
|
||||
internal static class OnDeathPatch
|
||||
{
|
||||
[HarmonyPrefix, HarmonyPatch(nameof(GameManager.OnPlayerDeath))]
|
||||
public static bool OnDeathPostfix([HarmonyArgument(0)] PlayerControl player, [HarmonyArgument(1)] bool assignGhostRole)
|
||||
{
|
||||
if (CustomGameModeManager.ActiveMode != null)
|
||||
{
|
||||
CustomGameModeManager.ActiveMode.OnPlayerDeath(player, assignGhostRole);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user