mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Detour ability uses
This commit is contained in:
1 parent
64eec0037c
commit
42e9d5d081
3 files changed
+18
-6
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user