Skip to content

Commit

Permalink
Updated Janitor
Browse files Browse the repository at this point in the history
  • Loading branch information
yanpla committed Oct 9, 2024
1 parent 605457b commit 7017b0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
33 changes: 29 additions & 4 deletions Buttons/Janitor/CleanButton.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using MiraAPI.GameOptions;
using MiraAPI.Hud;
using MiraAPI.Utilities;
using MiraAPI.Utilities.Assets;
using UnityEngine;
using yanplaRoles.Options.Roles;
using yanplaRoles.rpc;

namespace yanplaRoles.Buttons.Janitor;
Expand All @@ -12,11 +10,38 @@ namespace yanplaRoles.Buttons.Janitor;
public class CleanButton : CustomActionButton<DeadBody>
{
public override string Name => "";
public override float Cooldown => OptionGroupSingleton<JanitorOptions>.Instance.CleanCooldown;
public override float Cooldown => 30f;
public override float EffectDuration => 0f;
public override int MaxUses => (int)OptionGroupSingleton<JanitorOptions>.Instance.CleanUses;
public override int MaxUses => 0;
public override LoadableAsset<Sprite> Sprite => Assets.CleanButton;

public override void FixedUpdateHandler(PlayerControl playerControl)
{
if (Timer >= 0)
{
Timer = PlayerControl.LocalPlayer.killTimer;
}
else if (HasEffect && EffectActive)
{
EffectActive = false;
Timer = Cooldown;
OnEffectEnd();
}

if (CanUse())
{
Button?.SetEnabled();
}
else
{
Button?.SetDisabled();
}

Button?.SetCoolDown(Timer, EffectActive ? EffectDuration : Cooldown);

FixedUpdate(playerControl);
}

protected override void OnClick()
{
if (Target != null)
Expand Down
2 changes: 1 addition & 1 deletion Buttons/Janitor/Coroutine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public IEnumerator CleanBodyCoroutine(Byte target)
var body = Helpers.GetBodyById(target);
SpriteRenderer rend = body.bodyRenderers[0];
Color initialColor = rend.color;
float duration = 5f;
float duration = 2.5f;
float elapsed = 0f;

while (elapsed < duration)
Expand Down
19 changes: 0 additions & 19 deletions Patches/JanitorResetCooldownPatch.cs

This file was deleted.

7 changes: 0 additions & 7 deletions Roles/Impostor/Janitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,4 @@ public class Janitor : ImpostorRole, ICustomRole
CanUseVent = OptionGroupSingleton<JanitorOptions>.Instance.JanitorCanVent.Value,
OptionsScreenshot = Assets.JanitorBanner,
};

public override void SpawnTaskHeader(PlayerControl playerControl)
{
// remove existing task header.
}


}

0 comments on commit 7017b0c

Please sign in to comment.