mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Add Custom Net Object for Tornado & Druid (IT WORKS! THX RABEK!!)
This commit is contained in:
1 parent
6665608c5d
commit
9de147a22c
15 files changed
+136
-77
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
||||
<Description>EHR</Description>
|
||||
<Authors>Gurge44</Authors>
|
||||
<langVersion>preview</langVersion>
|
||||
<AmongUs>E:\Program Files\AmongUs</AmongUs>
|
||||
<AmongUs>D:\Epic Games\AmongUs</AmongUs>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>True</Optimize>
|
||||
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
|
||||
|
||||
+3
-1
@@ -29,4 +29,6 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EHR/@EntryIndexedValue">EHR</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TP/@EntryIndexedValue">TP</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VN/@EntryIndexedValue">VN</s:String></wpf:ResourceDictionary>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VN/@EntryIndexedValue">VN</s:String>
|
||||
<s:Boolean
|
||||
x:Key="/Default/Housekeeping/Layout/SolBuilderDuoView/ShowBuildProgressInToolWindow/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR.Roles.Crewmate;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
@@ -13,7 +14,7 @@ namespace EHR
|
||||
public class CustomNetObject
|
||||
{
|
||||
private static readonly Dictionary<int, CustomNetObject> AllObjects = [];
|
||||
private readonly int Id = Enumerable.Range(0, int.MaxValue).First(id => !AllObjects.ContainsKey(id));
|
||||
protected readonly int Id = Enumerable.Range(0, int.MaxValue).First(id => !AllObjects.ContainsKey(id));
|
||||
private PlayerControl PC;
|
||||
|
||||
protected void RpcChangeSprite(string sprite)
|
||||
@@ -28,7 +29,7 @@ namespace EHR
|
||||
}
|
||||
*/
|
||||
|
||||
protected void Despawn()
|
||||
public void Despawn()
|
||||
{
|
||||
PC.Despawn();
|
||||
AllObjects.Remove(Id);
|
||||
@@ -199,7 +200,7 @@ namespace EHR
|
||||
WaitDuration = waitDuration;
|
||||
State = 0;
|
||||
CreateNetObject($"<size={Size}><font=\"VCR SDF\"><#c7c7c769>●", position);
|
||||
foreach (var pc in Main.AllPlayerControls)
|
||||
foreach (var pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (!visibleList.Contains(pc.PlayerId))
|
||||
Hide(pc);
|
||||
@@ -222,4 +223,41 @@ namespace EHR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TornadoObject : CustomNetObject
|
||||
{
|
||||
private readonly long SpawnTimeStamp;
|
||||
|
||||
public TornadoObject(Vector2 position, List<byte> visibleList)
|
||||
{
|
||||
SpawnTimeStamp = Utils.TimeStamp;
|
||||
CreateNetObject("<size=100%><font=\"VCR SDF\"><line-height=85%><alpha=#00>\u2588<alpha=#00>\u2588<#bababa>\u2588<#bababa>\u2588<#bababa>\u2588<#bababa>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<br><alpha=#00>\u2588<#bababa>\u2588<#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<#bababa>\u2588<alpha=#00>\u2588<br><#bababa>\u2588<#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<#bababa>\u2588<br><#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#636363>\u2588<#636363>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<br><#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#636363>\u2588<#636363>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<br><#bababa>\u2588<#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<#bababa>\u2588<br><alpha=#00>\u2588<#bababa>\u2588<#bababa>\u2588<#8c8c8c>\u2588<#8c8c8c>\u2588<#bababa>\u2588<#bababa>\u2588<alpha=#00>\u2588<br><alpha=#00>\u2588<alpha=#00>\u2588<#bababa>\u2588<#bababa>\u2588<#bababa>\u2588<#bababa>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<br></color></line-height></font></size>", position);
|
||||
foreach (var pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (!visibleList.Contains(pc.PlayerId))
|
||||
Hide(pc);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnFixedUpdate()
|
||||
{
|
||||
if (SpawnTimeStamp + Tornado.TornadoDuration.GetInt() < Utils.TimeStamp)
|
||||
Despawn();
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerDetector : CustomNetObject
|
||||
{
|
||||
public PlayerDetector(Vector2 position, List<byte> visibleList, out int id)
|
||||
{
|
||||
CreateNetObject("<size=100%><font=\"VCR SDF\"><line-height=85%><alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<br><alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<br><#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<br><#33e6b0>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<#000000>\u2588<#000000>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<br><#33e6b0>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<#000000>\u2588<#000000>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<br><#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<br><alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<br><alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<#33e6b0>\u2588<alpha=#00>\u2588<alpha=#00>\u2588<br></color></line-height></font></size>", position);
|
||||
foreach (var pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (!visibleList.Contains(pc.PlayerId))
|
||||
Hide(pc);
|
||||
}
|
||||
|
||||
id = Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ internal static class CustomRoleSelector
|
||||
else Roles[RoleAssignType.Crewmate].Add(info);
|
||||
}
|
||||
|
||||
if (Roles[RoleAssignType.Impostor].Count == 0 && Roles[RoleAssignType.NeutralKilling].Count == 0 && !Main.SetRoles.Values.Any(x => x.IsImpostor() || x.IsNK()))
|
||||
if (Roles[RoleAssignType.Impostor].Count == 0 && optNeutralKillingNum == 0 && optNonNeutralKillingNum == 0 && !Main.SetRoles.Values.Any(x => x.IsImpostor() || x.IsNK()))
|
||||
{
|
||||
Roles[RoleAssignType.Impostor].Add(new(CustomRoles.ImpostorEHR, 100, optImpNum));
|
||||
Logger.Warn("Adding Vanilla Impostor", "CustomRoleSelector");
|
||||
|
||||
@@ -713,7 +713,6 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Refugee => true,
|
||||
CustomRoles.Necromancer => true,
|
||||
CustomRoles.Deathknight => true,
|
||||
CustomRoles.Shifter => true,
|
||||
|
||||
_ => false
|
||||
};
|
||||
|
||||
@@ -452,6 +452,7 @@ class MurderPlayerPatch
|
||||
|
||||
public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target)
|
||||
{
|
||||
if (__instance == null || target == null || __instance.PlayerId == 255 || target.PlayerId == 255) return;
|
||||
if (target.AmOwner) RemoveDisableDevicesPatch.UpdateDisableDevices();
|
||||
if (!target.Data.IsDead || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
@@ -1005,7 +1006,7 @@ class FixedUpdatePatch
|
||||
|
||||
public static async void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null) return;
|
||||
if (__instance == null || __instance.PlayerId == 255) return;
|
||||
if (!GameStates.IsModHost) return;
|
||||
|
||||
byte id = __instance.PlayerId;
|
||||
|
||||
+11
-11
@@ -9,6 +9,16 @@ namespace EHR;
|
||||
|
||||
class RandomSpawn
|
||||
{
|
||||
public static void TP(CustomNetworkTransform nt, Vector2 location)
|
||||
{
|
||||
//if (AmongUsClient.Instance.AmHost) nt.SnapTo(location);
|
||||
//MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(nt.NetId, (byte)RpcCalls.SnapTo, SendOption.None);
|
||||
//NetHelpers.WriteVector2(location, writer);
|
||||
//writer.Write(nt.lastSequenceId);
|
||||
//AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
Utils.TP(nt, location);
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CustomNetworkTransform), nameof(CustomNetworkTransform.SnapTo), typeof(Vector2), typeof(ushort))]
|
||||
public class CustomNetworkTransformPatch
|
||||
{
|
||||
@@ -17,7 +27,7 @@ class RandomSpawn
|
||||
public static void Postfix(CustomNetworkTransform __instance, [HarmonyArgument(0)] Vector2 position)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
if (position == new Vector2(-25f, 40f)) return; //最初の湧き地点ならreturn
|
||||
if (position == new Vector2(-25f, 40f)) return;
|
||||
if (GameStates.IsInTask)
|
||||
{
|
||||
var player = Main.AllPlayerControls.FirstOrDefault(p => p.NetTransform == __instance);
|
||||
@@ -45,16 +55,6 @@ class RandomSpawn
|
||||
}
|
||||
}
|
||||
|
||||
public static void TP(CustomNetworkTransform nt, Vector2 location)
|
||||
{
|
||||
//if (AmongUsClient.Instance.AmHost) nt.SnapTo(location);
|
||||
//MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(nt.NetId, (byte)RpcCalls.SnapTo, SendOption.None);
|
||||
//NetHelpers.WriteVector2(location, writer);
|
||||
//writer.Write(nt.lastSequenceId);
|
||||
//AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
Utils.TP(nt, location);
|
||||
}
|
||||
|
||||
public abstract class SpawnMap
|
||||
{
|
||||
public virtual void RandomTeleport(PlayerControl player)
|
||||
|
||||
@@ -271,7 +271,7 @@ public static class SabotageSystemTypeRepairDamagePatch
|
||||
CustomRoles.Traitor when Traitor.CanSabotage.GetBool() => true,
|
||||
CustomRoles.Parasite when player.IsAlive() => true,
|
||||
CustomRoles.Refugee when player.IsAlive() => true,
|
||||
_ => Main.PlayerStates[player.PlayerId].Role.OnSabotage(player) && Main.PlayerStates[player.PlayerId].Role.CanUseSabotage(player)
|
||||
_ => Main.PlayerStates[player.PlayerId].Role.CanUseSabotage(player) && Main.PlayerStates[player.PlayerId].Role.OnSabotage(player)
|
||||
};
|
||||
if (allow && QuizMaster.On) QuizMaster.Data.NumSabotages++;
|
||||
|
||||
|
||||
@@ -237,8 +237,8 @@ namespace EHR.Roles.Crewmate
|
||||
|
||||
public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
|
||||
{
|
||||
long now = Utils.TimeStamp;
|
||||
if (lowLoad) return;
|
||||
long now = Utils.TimeStamp;
|
||||
|
||||
if (!GameStates.IsInTask)
|
||||
{
|
||||
|
||||
+42
-44
@@ -22,9 +22,11 @@ namespace EHR.Roles.Crewmate
|
||||
public static OptionItem DruidAbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityChargesWhenFinishedTasks;
|
||||
|
||||
private static Dictionary<byte, long> TriggerDelays = [];
|
||||
private static Dictionary<byte, Dictionary<Vector2, string>> Triggers = [];
|
||||
private static long lastUpdate;
|
||||
private PlayerControl DruidPC;
|
||||
private long lastUpdate;
|
||||
private long TriggerDelay;
|
||||
private Dictionary<Vector2, int> TriggerIds = [];
|
||||
private Dictionary<Vector2, string> Triggers = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
@@ -51,7 +53,7 @@ namespace EHR.Roles.Crewmate
|
||||
public override void Init()
|
||||
{
|
||||
playerIdList = [];
|
||||
TriggerDelays = [];
|
||||
TriggerDelay = 0;
|
||||
Triggers = [];
|
||||
lastUpdate = TimeStamp;
|
||||
}
|
||||
@@ -59,8 +61,10 @@ namespace EHR.Roles.Crewmate
|
||||
public override void Add(byte playerId)
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
DruidPC = GetPlayerById(playerId);
|
||||
playerId.SetAbilityUseLimit(UseLimitOpt.GetInt());
|
||||
lastUpdate = TimeStamp;
|
||||
TriggerIds = [];
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
@@ -86,7 +90,7 @@ namespace EHR.Roles.Crewmate
|
||||
bool add = reader.ReadBoolean();
|
||||
byte playerId = reader.ReadByte();
|
||||
|
||||
if (Main.PlayerStates[playerId].Role is not Druid { IsEnable: true }) return;
|
||||
if (Main.PlayerStates[playerId].Role is not Druid { IsEnable: true } di) return;
|
||||
|
||||
float x = reader.ReadSingle();
|
||||
float y = reader.ReadSingle();
|
||||
@@ -97,13 +101,12 @@ namespace EHR.Roles.Crewmate
|
||||
{
|
||||
string roomName = reader.ReadString();
|
||||
|
||||
TriggerDelays.Remove(playerId);
|
||||
if (!Triggers.ContainsKey(playerId)) Triggers.Add(playerId, []);
|
||||
Triggers[playerId].TryAdd(position, roomName);
|
||||
di.TriggerDelay = 0;
|
||||
di.Triggers.TryAdd(position, roomName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Triggers[playerId].Remove(position);
|
||||
di.Triggers.Remove(position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,13 +131,14 @@ namespace EHR.Roles.Crewmate
|
||||
if (isPet)
|
||||
{
|
||||
(Vector2 LOCATION, string ROOM_NAME) = pc.GetPositionInfo();
|
||||
if (!Triggers.ContainsKey(pc.PlayerId)) Triggers.Add(pc.PlayerId, []);
|
||||
Triggers[pc.PlayerId].TryAdd(LOCATION, ROOM_NAME);
|
||||
Triggers.TryAdd(LOCATION, ROOM_NAME);
|
||||
SendRPCAddTrigger(true, pc.PlayerId, LOCATION, ROOM_NAME);
|
||||
_ = new PlayerDetector(LOCATION, [pc.PlayerId], out int id);
|
||||
TriggerIds.TryAdd(LOCATION, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
TriggerDelays.TryAdd(pc.PlayerId, now);
|
||||
TriggerDelay = now;
|
||||
}
|
||||
|
||||
pc.RpcRemoveAbilityUse();
|
||||
@@ -144,42 +148,36 @@ namespace EHR.Roles.Crewmate
|
||||
{
|
||||
if (!GameStates.IsInTask || Triggers.Count <= 0 || playerIdList.Contains(pc.PlayerId)) return;
|
||||
|
||||
foreach (var triggers in Triggers.ToArray()) // Check for all Druids' traps - Most likely just 1 loop
|
||||
foreach (var trigger in Triggers.Where(trigger => Vector2.Distance(trigger.Key, pc.Pos()) <= 1.5f))
|
||||
{
|
||||
foreach (var trigger in triggers.Value.Where(trigger => Vector2.Distance(trigger.Key, pc.Pos()) <= 1.5f)) // Check for all traps of the current Druid - Most likely 0-3 loops
|
||||
{
|
||||
GetPlayerById(triggers.Key).Notify(string.Format(GetString("DruidTriggerTriggered"), GetFormattedRoomName(trigger.Value), GetFormattedVectorText(trigger.Key)));
|
||||
Triggers[triggers.Key].Remove(trigger.Key);
|
||||
SendRPCAddTrigger(false, triggers.Key, trigger.Key);
|
||||
}
|
||||
DruidPC.Notify(string.Format(GetString("DruidTriggerTriggered"), GetFormattedRoomName(trigger.Value), GetFormattedVectorText(trigger.Key)));
|
||||
Triggers.Remove(trigger.Key);
|
||||
SendRPCAddTrigger(false, DruidPC.PlayerId, trigger.Key);
|
||||
CustomNetObject.Get(TriggerIds[trigger.Key])?.Despawn();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnFixedUpdate(PlayerControl _)
|
||||
public override void OnFixedUpdate(PlayerControl pc)
|
||||
{
|
||||
if (!IsEnable || !GameStates.IsInTask || TriggerDelays.Count <= 0) return;
|
||||
if (!IsEnable || !GameStates.IsInTask || TriggerDelay == 0 || pc == null) return;
|
||||
|
||||
long now = TimeStamp;
|
||||
|
||||
foreach ((byte id, long ts) in TriggerDelays)
|
||||
if (TriggerDelay + TriggerPlaceDelay.GetInt() < now)
|
||||
{
|
||||
var pc = GetPlayerById(id);
|
||||
if (pc == null) continue;
|
||||
|
||||
if (ts + TriggerPlaceDelay.GetInt() < now)
|
||||
{
|
||||
TriggerDelays.Remove(id);
|
||||
(Vector2 LOCATION, string ROOM_NAME) = pc.GetPositionInfo();
|
||||
if (!Triggers.ContainsKey(id)) Triggers.Add(id, []);
|
||||
Triggers[id].TryAdd(LOCATION, ROOM_NAME);
|
||||
SendRPCAddTrigger(true, id, LOCATION, ROOM_NAME);
|
||||
continue;
|
||||
}
|
||||
|
||||
var timeLeft = TriggerPlaceDelay.GetInt() - (now - ts);
|
||||
if (lastUpdate < now) pc.Notify(string.Format(GetString("DruidTimeLeft"), timeLeft, 2f));
|
||||
var id = pc.PlayerId;
|
||||
TriggerDelay = 0;
|
||||
(Vector2 LOCATION, string ROOM_NAME) = pc.GetPositionInfo();
|
||||
Triggers.TryAdd(LOCATION, ROOM_NAME);
|
||||
SendRPCAddTrigger(true, id, LOCATION, ROOM_NAME);
|
||||
_ = new PlayerDetector(LOCATION, [pc.PlayerId], out int oid);
|
||||
TriggerIds.TryAdd(LOCATION, oid);
|
||||
return;
|
||||
}
|
||||
|
||||
var timeLeft = TriggerPlaceDelay.GetInt() - (now - TriggerDelay);
|
||||
if (lastUpdate < now) pc.Notify(string.Format(GetString("DruidTimeLeft"), timeLeft, 2f));
|
||||
|
||||
lastUpdate = now;
|
||||
}
|
||||
|
||||
@@ -188,26 +186,26 @@ namespace EHR.Roles.Crewmate
|
||||
if (hud) return GetHUDText(seer);
|
||||
if (seer == null || seer.IsModClient() || seer.PlayerId != target.PlayerId) return string.Empty;
|
||||
|
||||
if (!Triggers.TryGetValue(seer.PlayerId, out var triggers)) return string.Empty;
|
||||
if (Triggers.Count == 0) return string.Empty;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("\n<size=1.7>");
|
||||
|
||||
sb.AppendLine($"<#00ffa5>{triggers.Count}</color> trigger{(triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join(", ", triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
sb.AppendLine($"<#00ffa5>{Triggers.Count}</color> trigger{(Triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join(", ", Triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
|
||||
sb.Append("</size>");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static string GetHUDText(PlayerControl pc)
|
||||
string GetHUDText(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || !Triggers.TryGetValue(pc.PlayerId, out var triggers)) return string.Empty;
|
||||
if (pc == null || Triggers.Count == 0) return string.Empty;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"<#00ffa5>{triggers.Count}</color> trigger{(triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join('\n', triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
sb.AppendLine($"<#00ffa5>{Triggers.Count}</color> trigger{(Triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join('\n', Triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace EHR.Roles.Crewmate
|
||||
private static readonly List<byte> PlayerIdList = [];
|
||||
|
||||
public static OptionItem TornadoCooldown;
|
||||
private static OptionItem TornadoDuration;
|
||||
public static OptionItem TornadoDuration;
|
||||
private static OptionItem TornadoRange;
|
||||
|
||||
private static readonly Dictionary<string, string> ReplacementDict = new() { { "Tornado", ColorString(GetRoleColor(CustomRoles.Tornado), "Tornado") } };
|
||||
@@ -101,7 +101,7 @@ namespace EHR.Roles.Crewmate
|
||||
if (add)
|
||||
{
|
||||
long timestamp = long.Parse(reader.ReadString());
|
||||
Tornados.Add((new(x, y), roomname), timestamp);
|
||||
Tornados.TryAdd((new(x, y), roomname), timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,8 +119,9 @@ namespace EHR.Roles.Crewmate
|
||||
if (pc == null) return;
|
||||
var info = pc.GetPositionInfo();
|
||||
var now = TimeStamp;
|
||||
Tornados.Add(info, now);
|
||||
Tornados.TryAdd(info, now);
|
||||
SendRPCAddTornado(true, info.LOCATION, info.ROOM_NAME, now);
|
||||
_ = new TornadoObject(info.LOCATION, [pc.PlayerId]);
|
||||
}
|
||||
|
||||
public override void OnCheckPlayerPosition(PlayerControl pc)
|
||||
|
||||
@@ -134,9 +134,11 @@ namespace EHR.Neutral
|
||||
Utils.SendRPC(CustomRPC.SyncEvolver, EvolverPC.PlayerId, 3, ChooseTimer);
|
||||
|
||||
if (ChooseTimer == 0) ApplySelectedUpgradeAndReset();
|
||||
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
}
|
||||
|
||||
private void ApplySelectedUpgradeAndReset()
|
||||
void ApplySelectedUpgradeAndReset()
|
||||
{
|
||||
switch (Upgrades[SelectedUpgradeIndex])
|
||||
{
|
||||
|
||||
@@ -80,13 +80,22 @@ namespace EHR.Neutral
|
||||
Count = 0;
|
||||
|
||||
var room = pc.GetPlainShipRoom();
|
||||
if (LastRoom != null && room == LastRoom) return;
|
||||
if ((LastRoom != null && room != null && room == LastRoom) || (LastRoom == null && room == null)) return;
|
||||
LastRoom = room;
|
||||
|
||||
var roomName = Translator.GetString(room.RoomId.ToString());
|
||||
pc.Notify(RoomBoosts.Any(x => x.Value == room)
|
||||
? string.Format(Translator.GetString("PatrollerNotify"), roomName, Translator.GetString($"PatrollerBoost.{RoomBoosts.First(x => x.Value == room).Key}"))
|
||||
: string.Format(Translator.GetString("PatrollerNotifyNoBoost"), roomName), 300f);
|
||||
if (room != null)
|
||||
{
|
||||
var roomName = Translator.GetString(room.RoomId.ToString());
|
||||
pc.Notify(RoomBoosts.Any(x => x.Value == room)
|
||||
? string.Format(Translator.GetString("PatrollerNotify"), roomName, Translator.GetString($"PatrollerBoost.{RoomBoosts.First(x => x.Value == room).Key}"))
|
||||
: string.Format(Translator.GetString("PatrollerNotifyNoBoost"), roomName), 300f);
|
||||
}
|
||||
else
|
||||
{
|
||||
NameNotifyManager.Notice.Remove(pc.PlayerId);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
}
|
||||
|
||||
pc.MarkDirtySettings();
|
||||
|
||||
if (pc.PlayerId == PlayerControl.LocalPlayer.PlayerId)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using EHR.Patches;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace EHR.Neutral
|
||||
@@ -103,5 +104,10 @@ namespace EHR.Neutral
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
OnCheckMurder(pc, ExternalRpcPetPatch.SelectKillButtonTarget(pc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Roles.Neutral;
|
||||
@@ -18,7 +19,7 @@ public class Tremor : RoleBase
|
||||
private static OptionItem TimerStart;
|
||||
private static OptionItem TimerDecrease;
|
||||
private static OptionItem DoomTime;
|
||||
int Count = 0;
|
||||
int Count;
|
||||
int DoomTimer;
|
||||
|
||||
long LastUpdate = Utils.TimeStamp;
|
||||
@@ -118,7 +119,7 @@ public class Tremor : RoleBase
|
||||
Utils.SendRPC(CustomRPC.SyncTremor, killer.PlayerId, Timer);
|
||||
}
|
||||
|
||||
public void ReceiveRPC(Hazel.MessageReader reader)
|
||||
public void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
int value = reader.ReadPackedInt32();
|
||||
if (IsDoom) DoomTimer = value;
|
||||
@@ -129,6 +130,8 @@ public class Tremor : RoleBase
|
||||
{
|
||||
if (seer.PlayerId != target.PlayerId || (seer.IsModClient() && !hud) || meeting) return string.Empty;
|
||||
var color = IsDoom ? Color.yellow : Color.cyan;
|
||||
return Utils.ColorString(color, IsDoom ? DoomTimer.ToString() : Timer.ToString());
|
||||
var text = IsDoom ? DoomTimer.ToString() : Timer.ToString();
|
||||
if (hud) text = $"<size=130%><b>{text}</b></size>";
|
||||
return Utils.ColorString(color, text);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user