Add Transfer

This commit is contained in:
Gurge44 committed 2026-08-13 14:18:00 +02:00
1 parent 64b41dc8b7
commit 8a2ea406da
6 files changed
+51 -1

No files matched your search

+1
View File
@@ -632,6 +632,7 @@ public enum CustomRoles
Tiebreaker,
Tired,
Torch,
Transfer,
Truant,
Unbound,
Undead,
+1
View File
@@ -762,6 +762,7 @@ public class Main : BasePlugin
{ CustomRoles.Listener, "#060270" },
{ CustomRoles.Unbound, "#DFC57B" },
{ CustomRoles.AntiTP, "#fcba03" },
{ CustomRoles.Transfer, "#737373" },
{ CustomRoles.Focused, "#A10E49" },
{ CustomRoles.Dizzy, "#de97a7" },
{ CustomRoles.Entombed, "#8c71de" },
+1
View File
@@ -305,6 +305,7 @@ internal static class ChangeRoleSettings
Circumvent.Init();
Committed.Init();
Reroll.Init();
Transfer.Init();
}
catch (Exception ex) { Logger.Exception(ex, "Init Roles"); }
+6 -1
View File
@@ -1768,7 +1768,12 @@ internal static class FixedUpdatePatch
}
bool checkPos = inTask && !ExileController.Instance && !AntiBlackout.SkipTasks && alive && !Pelican.IsEaten(playerId) && Main.IntroDestroyed;
if (checkPos) Asthmatic.OnCheckPlayerPosition(player);
if (checkPos)
{
Asthmatic.OnCheckPlayerPosition(player);
Transfer.OnCheckPlayerPosition(player);
}
foreach (PlayerState state in Main.PlayerStates.Values)
{
+4
View File
@@ -208,6 +208,7 @@
"Prefix.Tiebreaker": "Tiebreaker",
"Prefix.Tired": "Tired",
"Prefix.Torch": "Torch",
"Prefix.Transfer": "Transfer",
"Prefix.Trainee": "Trainee",
"Prefix.Truant": "Truant",
"Prefix.Unbound": "Unbound",
@@ -3981,6 +3982,9 @@
"TorchInfoLong": "(Add-ons):\\nOnly Crewmates will get Torch, who have increased vision and may not be affected by Lights Sabotage.",
"TorchAffectedByLights": "<color=#eee5be>Torch</color>'s vision is affected by Lights Sabotage",
"TorchVision": "<color=#eee5be>Torch</color> Vision",
"Transfer": "Transfer",
"TransferInfo": "Transfer Between Vents",
"TransferInfoLong": "(Add-ons):\\nAs the Transfer, whenever you step on a vent, you teleport to a random vent.",
"Trainee": "Trainee",
"TraineeInfo": "You Can't Vent/Sabotage/SS/Pet/Vanish Round 1",
"TraineeInfoLong": "(Add-ons):\\nYou can't vent, sabotage, shapeshift, or pet on the first round.",
+38
View File
@@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Linq;
using EHR.Modules;
namespace EHR.Roles;
public class Transfer : IAddon
{
public AddonTypes Type => AddonTypes.Mixed;
private static Dictionary<byte, long> LastTP;
private static Vector2[] VentLocations;
public void SetupCustomOption()
{
Options.SetupAdtRoleOptions(659700, CustomRoles.Transfer, canSetNum: true, teamSpawnOptions: true);
}
public static void Init()
{
LastTP = null;
LateTask.New(() => VentLocations = ShipStatus.Instance && CustomRoles.Transfer.RoleExist() ? ShipStatus.Instance.AllVents.Select(x => new Vector2(x.transform.position.x, x.transform.position.y + 0.3636f)).ToArray() : null, 25f);
}
public static void OnCheckPlayerPosition(PlayerControl pc)
{
if (VentLocations == null || !PerSecondUpdateScheduler.ShouldRunUpdate(pc.PlayerId) || !pc.Is(CustomRoles.Transfer)) return;
long now = Utils.TimeStamp;
LastTP ??= [];
if (LastTP.TryGetValue(pc.PlayerId, out long ts) && ts + 3 >= now) return;
if (!FastVector2.TryGetClosestInRange(pc.Pos(), VentLocations, 0.8f, out _)) return;
pc.TPToRandomVent();
LastTP[pc.PlayerId] = now;
}
}