up to date with lp-player-refactor

This commit is contained in:
XtraCube committed 2024-05-14 17:43:43 -04:00
1 parent 1c25fd401b
commit 5f29175235
3 files changed
+9 -15

No files matched your search

+4 -12
View File
@@ -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 -1
View File
@@ -98,7 +98,7 @@ public static class ToHudStringPatch
var groupsWithoutRoles = CustomOptionsManager.CustomGroups.Where(group => group.AdvancedRole == null);
var suffix = CustomGameModeManager.ActiveMode.CanAccessSettingsTab() ? "\nPress <b>Tab</b> to view Normal Options" :
$"\n<b>You can not access Normal Options on {Cus tomGameModeManager.ActiveMode.Name} mode.</b>";
$"\n<b>You can not access Normal Options on {CustomGameModeManager.ActiveMode.Name} mode.</b>";
AddOptions(sb,
CustomOptionsManager.CustomNumberOptions.Where(option => option.Group == null && !option.Hidden()),
+4 -2
View File
@@ -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)