Skip to content

Commit

Permalink
Version 4.0.1 - 2024.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MatuxGG committed Sep 25, 2024
1 parent 5258a27 commit b7d2b85
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 36 deletions.
4 changes: 2 additions & 2 deletions GLMod/Class/VanillaEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public static void startGameVanilla()
GLMod.StartGame("******", GLMod.gameMap, false);
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
{
string role = p.Data.Role.TeamType == RoleTeamTypes.Crewmate ? "Crewmate" : "Impostor";
GLMod.AddPlayer(p.Data.PlayerName, p.Data.Role.Role.ToString(), role);
string role = p?.Data?.Role?.TeamType == RoleTeamTypes.Crewmate ? "Crewmate" : "Impostor";
GLMod.AddPlayer(p?.Data?.PlayerName, p?.Data?.Role?.Role.ToString(), role);
}
GLMod.SendGame();
GLMod.AddMyPlayer();
Expand Down
40 changes: 19 additions & 21 deletions GLMod/EventPatch/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,38 +141,36 @@ public static void Postfix(PlayerControl __instance)

try
{
if (AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Started)
if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started)
{
if (gameStarted) return;

gameStarted = false;
return;
}

if (gameStarted) return;

int nbImp = GameOptionsManager.Instance.CurrentGameOptions.NumImpostors;
int realImp = 0;
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
int nbImp = GameOptionsManager.Instance.CurrentGameOptions.NumImpostors;
int realImp = 0;
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
{
if (p?.Data?.Role?.IsImpostor == true)
{
if (p.Data.Role.IsImpostor)
{
realImp++;
}
realImp++;
}
}

if (nbImp != realImp) return;

// Start game
GLMod.gameMap = GLMod.getMapName();
if (nbImp != realImp) return;

VanillaEvents.startGameVanilla();
gameStarted = true;
}
else
{
gameStarted = false;
}
// Start game
GLMod.gameMap = GLMod.getMapName();

VanillaEvents.startGameVanilla();
gameStarted = true;
}
catch (Exception e)
{
GLMod.logError("[VanillaFixedUpdate] Catch exception " + e.Message);
GLMod.logError("[VanillaFixedUpdate] Catch exception " + e.Message + " / stack = " + e.StackTrace);
}


Expand Down
24 changes: 12 additions & 12 deletions GLMod/GLMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -758,23 +758,23 @@ public static string getMapName()
{
try
{
//if (PlayerControl.GameOptions.MapId == 0)
// return "The Skeld";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Skeld)
return "The Skeld";

//if (PlayerControl.GameOptions.MapId == 1)
// return "MiraHQ";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Mira)
return "MiraHQ";

//if (PlayerControl.GameOptions.MapId == 2)
// return "Polus";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Polus)
return "Polus";

//if (PlayerControl.GameOptions.MapId == 3)
// return "dlekSehT";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Dleks)
return "dlekSehT";

//if (PlayerControl.GameOptions.MapId == 4)
// return "Airship";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Airship)
return "Airship";

//if (PlayerControl.GameOptions.MapId == 5)
// return "Submerged";
if (GameOptionsManager.Instance.currentGameOptions.MapId == (byte)MapNames.Fungle)
return "The Fungle";

return "Unknown";
} catch (Exception e)
Expand Down
2 changes: 1 addition & 1 deletion GLMod/GLMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>4.0.0</Version>
<GameVersion>v2024.6.18s</GameVersion>
<GameVersion>v2024.9.4s</GameVersion>

<Description>GLMod</Description>
<Authors>Matux</Authors>
Expand Down

0 comments on commit b7d2b85

Please sign in to comment.