mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
some fixes
This commit is contained in:
1 parent
e25fc239ac
commit
7eecc3d529
8 files changed
+53
-9
No files matched your search
@@ -327,12 +327,12 @@ public static class RoomRush
|
||||
MapNames.Airship => SystemTypes.MainHall,
|
||||
MapNames.Fungle => SystemTypes.Dropship,
|
||||
(MapNames)6 => (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperCentral,
|
||||
_ => throw new ArgumentOutOfRangeException(map.ToString(), "Invalid map")
|
||||
_ => AllRooms.RandomElement()
|
||||
};
|
||||
|
||||
DonePlayers.Clear();
|
||||
RoomGoal = AllRooms.Without(previous).RandomElement();
|
||||
Vector2 goalPos = Map.Positions.GetValueOrDefault(RoomGoal, RoomGoal.GetRoomClass().transform.position);
|
||||
Vector2 goalPos = RoomGoal.GetRoomClass().transform.position;
|
||||
float speed = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
int time;
|
||||
|
||||
@@ -579,7 +579,7 @@ public static class RoomRush
|
||||
|
||||
if (WinByPointsInsteadOfDeaths.GetBool())
|
||||
{
|
||||
Vector2 location = everyoneDies ? Map.Positions.GetValueOrDefault(RoomGoal, RoomGoal.GetRoomClass().transform.position) : DonePlayers.RandomElement().GetPlayer().Pos();
|
||||
Vector2 location = everyoneDies && !Main.LIMap ? Map.Positions.GetValueOrDefault(RoomGoal, RoomGoal.GetRoomClass().transform.position) : DonePlayers.RandomElement().GetPlayer().Pos();
|
||||
playersOutsideRoom.MassTP(location);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -279,7 +279,7 @@ public class Main : BasePlugin
|
||||
|
||||
public static MapNames CurrentMap => (MapNames)NormalOptions.MapId;
|
||||
|
||||
public static bool LIMap => NormalOptions?.MapId == 7;
|
||||
public static bool LIMap => NormalOptions is { MapId: 7 };
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
@@ -237,7 +237,7 @@ public static class CollectionExtensions
|
||||
/// <typeparam name="T">The type of the elements in the collection</typeparam>
|
||||
/// <returns><c>true</c> if the collection contains any elements that satisfy the predicate, <c>false</c> otherwise</returns>
|
||||
[Annotations.CollectionAccess(Annotations.CollectionAccessType.Read)]
|
||||
public static bool FindFirst<T>(this IEnumerable<T> collection, Func<T, bool> predicate, out T element)
|
||||
public static bool FindFirst<T>(this IEnumerable<T> collection, [Annotations.InstantHandle] Func<T, bool> predicate, out T element)
|
||||
{
|
||||
if (collection is List<T> list)
|
||||
{
|
||||
|
||||
@@ -167,6 +167,7 @@ public enum CustomRPC
|
||||
SyncCamouflage,
|
||||
SetChatVisible,
|
||||
Exclusionary,
|
||||
Deadlined,
|
||||
|
||||
// Game Modes
|
||||
RoomRushDataSync,
|
||||
|
||||
+11
-1
@@ -3000,7 +3000,17 @@ public static class Utils
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard) goto BeforeEnd;
|
||||
|
||||
if (guesserIsForMeeting || forMeeting || (seerRole == CustomRoles.Nemesis && !seer.IsAlive() && Options.NemesisCanKillNum.GetInt() >= 1))
|
||||
targetPlayerName = $"{ColorString(GetRoleColor(seerRole), target.PlayerId.ToString())} {targetPlayerName}";
|
||||
{
|
||||
byte id = target.PlayerId;
|
||||
|
||||
if (Doppelganger.SwappedIDs.FindFirst(x => x.Item1 == id || x.Item2 == id, out var pair))
|
||||
{
|
||||
if (pair.Item1 == id) id = pair.Item2;
|
||||
else if (pair.Item2 == id) id = pair.Item1;
|
||||
}
|
||||
|
||||
targetPlayerName = $"{ColorString(GetRoleColor(seerRole), id.ToString())} {targetPlayerName}";
|
||||
}
|
||||
|
||||
switch (seerRole)
|
||||
{
|
||||
|
||||
@@ -956,6 +956,14 @@ internal static class MeetingHudStartPatch
|
||||
Transform child = deathReasonTextMeeting.transform.FindChild("RoleTextMeeting");
|
||||
if (child != null) Object.Destroy(child.gameObject);
|
||||
|
||||
byte id = pva.TargetPlayerId;
|
||||
|
||||
if (Doppelganger.SwappedIDs.FindFirst(x => x.Item1 == id || x.Item2 == id, out var pair))
|
||||
{
|
||||
if (pair.Item1 == id) id = pair.Item2;
|
||||
else if (pair.Item2 == id) id = pair.Item1;
|
||||
}
|
||||
|
||||
// Thanks BAU (By D1GQ) - are you happy now?
|
||||
Transform playerLevel = pva.transform.Find("PlayerLevel");
|
||||
Transform levelDisplay = Object.Instantiate(playerLevel, pva.transform);
|
||||
@@ -967,7 +975,7 @@ internal static class MeetingHudStartPatch
|
||||
Transform idNumber = levelDisplay.transform.Find("LevelNumber");
|
||||
Object.Destroy(idLabel.GetComponent<TextTranslatorTMP>());
|
||||
idLabel.GetComponent<TextMeshPro>().text = "ID";
|
||||
idNumber.GetComponent<TextMeshPro>().text = pva.TargetPlayerId.ToString();
|
||||
idNumber.GetComponent<TextMeshPro>().text = id.ToString();
|
||||
idLabel.name = "IdLabel";
|
||||
idNumber.name = "IdNumber";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
namespace EHR.Roles;
|
||||
|
||||
public class Deadlined : IAddon
|
||||
@@ -21,12 +24,14 @@ public class Deadlined : IAddon
|
||||
{
|
||||
DidTask.Add(pc.PlayerId);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
Utils.SendRPC(CustomRPC.Deadlined, 1, pc.PlayerId);
|
||||
}
|
||||
|
||||
public static void AfterMeetingTasks()
|
||||
{
|
||||
DidTask = [];
|
||||
MeetingEndTS = Utils.TimeStamp;
|
||||
Utils.SendRPC(CustomRPC.Deadlined, 2);
|
||||
|
||||
foreach (PlayerControl pc in Main.AllPlayerControls)
|
||||
{
|
||||
@@ -40,13 +45,28 @@ public class Deadlined : IAddon
|
||||
{
|
||||
if (MeetingStates.FirstMeeting) return;
|
||||
|
||||
if (MeetingEndTS + InactiveTime.GetInt() > Utils.TimeStamp) return;
|
||||
if (MeetingEndTS + InactiveTime.GetInt() >= Utils.TimeStamp) return;
|
||||
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (!pc.Is(CustomRoles.Deadlined)) continue;
|
||||
|
||||
if (!DidTask.Contains(pc.PlayerId)) pc.Suicide();
|
||||
if (!DidTask.Contains(pc.PlayerId))
|
||||
pc.Suicide();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
switch (reader.ReadPackedInt32())
|
||||
{
|
||||
case 1:
|
||||
DidTask.Add(reader.ReadByte());
|
||||
break;
|
||||
case 2:
|
||||
DidTask = [];
|
||||
MeetingEndTS = Utils.TimeStamp - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Doppelganger : RoleBase
|
||||
|
||||
public static int LocalPlayerChangeSkinTimes;
|
||||
|
||||
public static HashSet<(byte, byte)> SwappedIDs = [];
|
||||
public static Dictionary<byte, string> DoppelVictim = [];
|
||||
public static Dictionary<byte, NetworkedPlayerInfo.PlayerOutfit> DoppelPresentSkin = [];
|
||||
private static Dictionary<byte, int> TotalSteals = [];
|
||||
@@ -68,6 +69,7 @@ public class Doppelganger : RoleBase
|
||||
public override void Init()
|
||||
{
|
||||
PlayerIdList = [];
|
||||
SwappedIDs = [];
|
||||
DoppelVictim = [];
|
||||
TotalSteals = [];
|
||||
DoppelPresentSkin = [];
|
||||
@@ -255,6 +257,9 @@ public class Doppelganger : RoleBase
|
||||
|
||||
DoppelVictim[target.PlayerId] = tname;
|
||||
|
||||
SwappedIDs.RemoveWhere(x => x.Item1 == killer.PlayerId || x.Item2 == killer.PlayerId);
|
||||
SwappedIDs.Add((killer.PlayerId, target.PlayerId));
|
||||
|
||||
|
||||
RpcChangeSkin(target, killerSkin);
|
||||
Logger.Info("Changed target skin", "Doppelganger");
|
||||
|
||||
Reference in new issue
Block a user