Some fixes

This commit is contained in:
Gurge44 committed 2024-10-03 18:26:52 +02:00
1 parent b4ba5c0f4b
commit da0f15b1b2
4 files changed
+51 -12

No files matched your search

+2 -2
View File
@@ -44,7 +44,7 @@ namespace EHR
int id = 69_216_001;
Color color = Utils.GetRoleColor(CustomRoles.NDPlayer);
const CustomGameMode gameMode = CustomGameMode.NaturalDisasters;
DisasterFrequency = new IntegerOptionItem(id++, "ND_DisasterFrequency", new(1, 20, 1), 2, TabGroup.GameSettings)
.SetHeader(true)
.SetGameMode(gameMode)
@@ -469,7 +469,7 @@ namespace EHR
this.NetObject.RpcChangeSprite(newSprite);
}
var range = Range - ((Phases - Phase) * 0.05f);
var range = Range - ((Phases - Phase) * 0.4f);
KillNearbyPlayers(PlayerState.DeathReason.Lava, range);
}
}
+5 -6
View File
@@ -257,13 +257,12 @@ static class ExtendedPlayerControl
if (seer == null || player == null) return;
var clientId = seer.GetClientId();
if (clientId == -1) return;
var sender = CustomRpcSender.Create(name: "SetNamePrivate");
sender.AutoStartRpc(player.NetId, (byte)RpcCalls.SetName, clientId)
.Write(seer.Data.NetId)
.Write(name)
.EndRpc();
sender.SendMessage();
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SetName, SendOption.Reliable, clientId);
writer.Write(seer.Data.NetId);
writer.Write(name);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
public static void RpcSetRoleDesync(this PlayerControl player, RoleTypes role, int clientId)
+39
View File
@@ -22,6 +22,7 @@ using Hazel;
using Il2CppInterop.Runtime.InteropTypes;
using InnerNet;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using static EHR.Translator;
@@ -2907,6 +2908,44 @@ public static class Utils
return (draw, all);
}
// Will be used for displaying achievement completions later
/// <summary>
/// Displays a chat bubble with a message and a title during the round for the local player.
/// </summary>
/// <param name="message">The message to display in the chat bubble.</param>
/// <param name="title">The title of the chat bubble.</param>
public static void ShowChatBubbleInRound(string message, string title)
{
var chat = DestroyableSingleton<HudManager>.Instance.Chat;
var data = PlayerControl.LocalPlayer.Data;
var bubble = chat.GetPooledBubble();
try
{
bubble.transform.SetParent(chat.scroller.Inner);
bubble.transform.localScale = Vector3.one;
bubble.SetCosmetics(data);
bubble.gameObject.transform.Find("PoolablePlayer").gameObject.SetActive(false);
bubble.ColorBlindName.gameObject.SetActive(false);
bubble.SetLeft();
bubble.gameObject.transform.Find("NameText (TMP)").transform.localPosition += new Vector3(-0.7f, 0f);
bubble.gameObject.transform.Find("ChatText (TMP)").transform.localPosition += new Vector3(-0.7f, 0f);
chat.SetChatBubbleName(bubble, data, data.IsDead, false, PlayerNameColor.Get(data));
bubble.SetText(message);
bubble.AlignChildren();
chat.AlignAllBubbles();
bubble.NameText.text = title;
bubble.transform.Find("ChatText (TMP)").GetComponent<TextMeshPro>().color = new(1f, 1f, 1f, 1f);
bubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new(0.05f, 0.05f, 0.05f, 1f);
var xMark = bubble.transform.Find("PoolablePlayer/xMark");
if (xMark && xMark.GetComponent<SpriteRenderer>().enabled) bubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new(0.05f, 0.05f, 0.05f, 0.5f);
}
catch (Exception e)
{
chat.chatBubblePool.Reclaim(bubble);
ThrowException(e);
}
}
public static string SummaryTexts(byte id, bool disableColor = true, bool check = false)
{
//var RolePos = TranslationController.Instance.currentLanguage.languageID is SupportedLangs.English or SupportedLangs.Russian ? 37 : 34;
+5 -4
View File
@@ -1218,12 +1218,13 @@ static class FixedUpdatePatch
}
}
if (Options.DontUpdateDeadPlayers.GetBool() && !__instance.IsAlive() && (!Altruist.On || !CustomRoles.Altruist.RoleExist() || Main.PlayerStates[id].Role is not Altruist at || at.ReviveStartTS == 0))
if (Options.DontUpdateDeadPlayers.GetBool() && !__instance.IsAlive() && (!Altruist.On || Main.PlayerStates[id].Role is not Altruist at || at.ReviveStartTS == 0))
{
DeadBufferTime.TryAdd(id, 30);
var buffer = Options.DeepLowLoad.GetBool() ? 30 : 10;
DeadBufferTime.TryAdd(id, buffer);
DeadBufferTime[id]--;
if (DeadBufferTime[id] > 0) return;
DeadBufferTime[id] = 30;
DeadBufferTime[id] = buffer;
}
if (Options.LowLoadMode.GetBool())
@@ -1261,7 +1262,7 @@ static class FixedUpdatePatch
if (Options.LowLoadMode.GetBool())
{
if (BufferTime[playerId] > 0) lowLoad = true;
else BufferTime[playerId] = 10;
else BufferTime[playerId] = Options.DeepLowLoad.GetBool() ? 30 : 10;
}
if (localPlayer)