Add Device Positions for LevelImpostor Maps (Experimental) (#680)

* add devices estimation for LI

* final touches
This commit is contained in:
Newchan authored and GitHub committed 2026-08-23 09:44:10 +02:00
1 parent 782093ede0
commit 21d403ac04
7 files changed
+59 -7

No files matched your search

-2
View File
@@ -108,8 +108,6 @@ internal static class CustomRoleSelector
switch (role)
{
case CustomRoles.Bargainer when Main.LIMap:
case CustomRoles.AntiAdminer when Main.LIMap:
case CustomRoles.CameraMan when Main.LIMap:
case CustomRoles.Weatherman when Main.LIMap || GameStates.CurrentServerType == GameStates.ServerType.Vanilla:
case CustomRoles.Doctor when Options.EveryoneSeesDeathReasons.GetBool():
+25
View File
@@ -39,6 +39,29 @@ internal static class DisableDevice
["SubmergedCamera"] = new(-3.41f, -34.56f)
};
public static void AddCustomDevicesPos()
{
var keysToRemove = DevicePos.Keys
.Where(k => k.StartsWith("LI", StringComparison.OrdinalIgnoreCase))
.ToList();
foreach (var key in keysToRemove)
DevicePos.Remove(key);
int adminId = 0;
int cameraId = 0;
int vitalId = 0;
foreach (var admin in Object.FindObjectsOfType<MapConsole>(true))
DevicePos[$"LIAdmin{adminId++}"] = admin.transform.position;
foreach (var console in Object.FindObjectsOfType<SystemConsole>(true))
{
if (console.name == "Surv_Panel") DevicePos[$"LICamera{cameraId++}"] = console.transform.position;
else if (console.name.Contains("Vital")) DevicePos[$"LIVital{vitalId++}"] = console.transform.position;
}
}
private static bool DoDisable => Options.DisableDevices.GetBool();
public static float UsableDistance => Main.CurrentMap switch
@@ -166,6 +189,8 @@ public class RemoveDisableDevicesPatch
{
public static void Postfix()
{
if (Main.LIMap) DisableDevice.AddCustomDevicesPos();
bool rogueForce = Rogue.On && Main.PlayerStates.Values.Any(x => x.Role is Rogue { DisableDevices: true });
if (!Options.DisableDevices.GetBool() && !rogueForce) return;
+2 -2
View File
@@ -3927,10 +3927,10 @@ public static class Utils
nums[Options.GameStateInfo.MadmateCount]++;
else if (pc.IsNeutralKiller())
nums[Options.GameStateInfo.NKCount]++;
else if (pc.IsCrewmate())
nums[Options.GameStateInfo.CrewCount]++;
else if (pc.Is(Team.Impostor))
nums[Options.GameStateInfo.ImpCount]++;
else if (pc.Is(Team.Crewmate))
nums[Options.GameStateInfo.CrewCount]++;
else if (pc.Is(Team.Neutral))
nums[Options.GameStateInfo.NNKCount]++;
else if (pc.Is(Team.Coven))