Skip to content

Commit ae7243c

Browse files
committed
You can no longer use !limit during a round.
1 parent a7e9f34 commit ae7243c

4 files changed

Lines changed: 21 additions & 16 deletions

File tree

src/AleLuduMod/Components/MeetingHudBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace AleLuduMod.Components;
1010
[RegisterInIl2Cpp]
1111
public class MeetingHudBehaviour : MonoBehaviour
1212
{
13-
public MeetingHudBehaviour(IntPtr ptr) : base(ptr) {}
13+
public MeetingHudBehaviour(IntPtr ptr) : base(ptr) { }
1414
internal MeetingHud meetingHud = null!;
1515

1616
[HideFromIl2Cpp]

src/AleLuduMod/Components/ShapeshifterMenuBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace AleLuduMod.Components;
1010
[RegisterInIl2Cpp]
1111
public class ShapeshifterBehaviour : MonoBehaviour
1212
{
13-
public ShapeshifterBehaviour(IntPtr ptr) : base(ptr){}
13+
public ShapeshifterBehaviour(IntPtr ptr) : base(ptr) { }
1414
internal ShapeshifterMinigame shapeshifterMinigame = null!;
1515

1616
[HideFromIl2Cpp]

src/AleLuduMod/Components/VitalsHudBehaviour.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace AleLuduMod.Components;
1010
[RegisterInIl2Cpp]
1111
public class VitalsHudBehaviour : MonoBehaviour
1212
{
13-
public VitalsHudBehaviour(IntPtr ptr) : base(ptr) {}
13+
public VitalsHudBehaviour(IntPtr ptr) : base(ptr) { }
1414
internal VitalsMinigame vitalsMinigame = null!;
1515

1616
[HideFromIl2Cpp]
@@ -28,10 +28,10 @@ public void Start()
2828
var panelTransform = panel.transform;
2929
panelTransform.localScale *= 0.75f;
3030
panelTransform.localPosition = new Vector3(
31-
vitalsMinigame.XStart + vitalsMinigame.XOffset * (col * 0.75f - 0.25f),
32-
vitalsMinigame.YStart + vitalsMinigame.YOffset * row * 0.75f,
33-
panelTransform.localPosition.z
34-
);
31+
vitalsMinigame.XStart + vitalsMinigame.XOffset * (col * 0.75f - 0.25f),
32+
vitalsMinigame.YStart + vitalsMinigame.YOffset * row * 0.75f,
33+
panelTransform.localPosition.z
34+
);
3535
i++;
3636
}
3737
}

src/AleLuduMod/Patches/ChatCommands.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] Player
1919
// After entering the command, when you try to join the lobby it will show "X/15". Only after the game is over will there be a larger lobby.
2020
if (chatText.StartsWith("!limit "))
2121
{
22-
if (GameData.Instance.GetHost() == sourcePlayer.Data)
22+
if ((AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started || AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay) && sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
23+
{
24+
if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
25+
{
26+
chatText = "You cannot use this command during the game!";
27+
error = true;
28+
}
29+
return sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId;
30+
}
31+
if (GameData.Instance.GetHost() == sourcePlayer.Data && sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
2332
{
2433
string[] args = chatText.Split(' ');
2534
if (args.Length > 1 && int.TryParse(args[1], out int newLimit))
@@ -31,41 +40,37 @@ public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] Player
3140
GameOptionsManager.Instance.CurrentGameOptions.SetInt(Int32OptionNames.MaxPlayers, newLimit);
3241
if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
3342
{
43+
chatText = $"Player limit has been set for: <color=#D91919FF><b>{newLimit}</b></color>";
3444
system = true;
35-
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"A player limit has been set for: <color=#D91919FF>{newLimit}</color>");
3645
}
37-
return false;
3846
}
3947
catch { }
4048
}
4149
else
4250
{
4351
if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
4452
{
53+
chatText = "The !limit command has a range of 4 - 35!";
4554
error = true;
46-
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, "The limit must be between 4 and 35.");
4755
}
48-
return false;
4956
}
5057
}
5158
else
5259
{
5360
if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
5461
{
62+
chatText = "Use !limit [number]. Example: !limit 20";
5563
error = true;
56-
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, "Use !limit [number]. Example: !limit 20");
5764
}
58-
return false;
5965
}
6066
}
6167
else if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
6268
{
6369
if (sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
6470
{
6571
noaccess = true;
66-
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, "You don't have access to this command!");
72+
chatText = "You don't have access to this command!";
6773
}
68-
return false;
6974
}
7075
return sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId;
7176
}

0 commit comments

Comments
 (0)