mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
up to date with lp-player-refactor
This commit is contained in:
1 parent
1c25fd401b
commit
5f29175235
2 files changed
+8
-14
No files matched your search
@@ -28,8 +28,6 @@ public abstract class CustomActionButton
|
||||
|
||||
protected ActionButton Button;
|
||||
|
||||
protected DeadBody DeadBodyTarget;
|
||||
|
||||
public void CreateButton(Transform parent)
|
||||
{
|
||||
if (Button)
|
||||
@@ -87,14 +85,9 @@ public abstract class CustomActionButton
|
||||
|
||||
public virtual void OnEffectEnd() { }
|
||||
|
||||
private bool CanUseHandler()
|
||||
{
|
||||
return Timer <= 0 && !EffectActive && (!LimitedUses || UsesLeft > 0) && CanUse();
|
||||
}
|
||||
|
||||
public virtual bool CanUse()
|
||||
{
|
||||
return true;
|
||||
return Timer <= 0 && !EffectActive && (!LimitedUses || UsesLeft > 0);
|
||||
}
|
||||
|
||||
public virtual void SetActive(bool visible, RoleBehaviour role)
|
||||
@@ -102,9 +95,9 @@ public abstract class CustomActionButton
|
||||
Button.ToggleVisible(visible && Enabled(role));
|
||||
}
|
||||
|
||||
private void ClickHandler()
|
||||
public virtual void ClickHandler()
|
||||
{
|
||||
if (!CanUseHandler())
|
||||
if (!CanUse())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -142,7 +135,7 @@ public abstract class CustomActionButton
|
||||
}
|
||||
}
|
||||
|
||||
if (CanUseHandler())
|
||||
if (CanUse())
|
||||
{
|
||||
Button.SetEnabled();
|
||||
}
|
||||
@@ -152,7 +145,6 @@ public abstract class CustomActionButton
|
||||
}
|
||||
Button.SetCoolDown(Timer, EffectActive ? EffectDuration : Cooldown);
|
||||
|
||||
playerControl.UpdateBodies(playerControl.Data.Role.TeamColor, ref DeadBodyTarget);
|
||||
FixedUpdate(playerControl);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Roles;
|
||||
|
||||
namespace MiraAPI.Patches.Roles;
|
||||
|
||||
@@ -8,9 +9,10 @@ public static class GameStartupPatch
|
||||
private static bool _runOnce;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for registering roles when the game opens, might be a janky solution but it works
|
||||
/// This is used for registering roles when the game opens, might be a janky solution, but it works
|
||||
/// </summary>
|
||||
[HarmonyPostfix, HarmonyPatch("Start")]
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Start")]
|
||||
public static void StartPostfix()
|
||||
{
|
||||
if (_runOnce)
|
||||
|
||||
Reference in new issue
Block a user