Detour ability uses

This commit is contained in:
Gurge44 committed 2026-03-11 08:58:27 +01:00
1 parent 64eec0037c
commit 42e9d5d081
3 files changed
+18 -6

No files matched your search

+4 -3
View File
@@ -191,12 +191,13 @@ internal static class ExternalRpcPetPatch
{
PlayerControl target = FastVector2.TryGetClosestPlayerInRangeTo(pc, 3.5f, out PlayerControl closest) ? closest : null;
if (target != null)
if (target)
{
if (target.Is(CustomRoles.Detour))
if (target.Is(CustomRoles.Detour) && target.GetAbilityUseLimit() >= 1f)
{
target.RpcRemoveAbilityUse();
PlayerControl tempTarget = target;
FastVector2.TryGetClosestPlayerTo(target, out target, x => x.PlayerId != pc.PlayerId);
FastVector2.TryGetClosestPlayerTo(tempTarget, out target, x => x.PlayerId != pc.PlayerId);
Logger.Info($"Target was {tempTarget.GetNameWithRole()}, new target is {target.GetNameWithRole()}", "Detour");
if (tempTarget.AmOwner)
+2 -1
View File
@@ -127,8 +127,9 @@ internal static class CheckMurderPatch
return false;
}
if (target.Is(CustomRoles.Detour))
if (target.Is(CustomRoles.Detour) && target.GetAbilityUseLimit() >= 1f)
{
target.RpcRemoveAbilityUse();
PlayerControl tempTarget = target;
FastVector2.TryGetClosestPlayerTo(tempTarget, out target, x => x.PlayerId != killer.PlayerId);
Logger.Info($"Target was {tempTarget.GetNameWithRole()}, new target is {target.GetNameWithRole()}", "Detour");
+12 -2
View File
@@ -5,9 +5,16 @@ internal class Detour : RoleBase
public static int TotalRedirections;
public override bool IsEnable => false;
private static OptionItem AbilityUseLimit;
private static OptionItem AbilityUseGainWithEachTaskCompleted;
private static OptionItem AbilityChargesWhenFinishedTasks;
public override void SetupCustomOption()
{
Options.SetupRoleOptions(5590, TabGroup.CrewmateRoles, CustomRoles.Detour);
StartSetup(5590)
.AutoSetupOption(ref AbilityUseLimit, 0f, new FloatValueRule(0, 20, 0.05f), OptionFormat.Times)
.AutoSetupOption(ref AbilityUseGainWithEachTaskCompleted, 0.4f, new FloatValueRule(0f, 5f, 0.05f), OptionFormat.Times)
.AutoSetupOption(ref AbilityChargesWhenFinishedTasks, 0.2f, new FloatValueRule(0f, 5f, 0.05f), OptionFormat.Times);
}
public override void Init()
@@ -15,5 +22,8 @@ internal class Detour : RoleBase
TotalRedirections = 0;
}
public override void Add(byte playerId) { }
public override void Add(byte playerId)
{
playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat());
}
}