add check to prevent adding modifiers before a game has started

This commit is contained in:
XtraCube committed 2025-02-25 22:01:52 -05:00
1 parent 7e4a71739c
commit 0e2eeea069
1 file changed
+6
+6
View File
@@ -366,6 +366,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
[HideFromIl2Cpp]
public BaseModifier? AddModifier(BaseModifier modifier)
{
if (!AmongUsClient.Instance.IsGameStarted)
{
Logger<MiraApiPlugin>.Error("Cannot add modifier because the game has not started yet.");
return null;
}
var id = modifier.TypeId;
if (modifier.Unique && Modifiers.Find(x => x.TypeId == id) != null)
{