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
3 files changed
+12
-18
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)
|
||||
@@ -65,10 +63,10 @@ public abstract class CustomActionButton
|
||||
{
|
||||
OnEffectEnd();
|
||||
}
|
||||
|
||||
|
||||
EffectActive = false;
|
||||
}
|
||||
|
||||
|
||||
public void OverrideSprite(Sprite sprite)
|
||||
{
|
||||
Button.graphic.sprite = sprite;
|
||||
@@ -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,10 +145,9 @@ public abstract class CustomActionButton
|
||||
}
|
||||
Button.SetCoolDown(Timer, EffectActive ? EffectDuration : Cooldown);
|
||||
|
||||
playerControl.UpdateBodies(playerControl.Data.Role.TeamColor, ref DeadBodyTarget);
|
||||
FixedUpdate(playerControl);
|
||||
}
|
||||
|
||||
|
||||
private void EffectEndHandler()
|
||||
{
|
||||
EffectActive = false;
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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