Skip to content

Commit

Permalink
Patch OneFactionAlreadyEliminated in HQlessHumansLose
Browse files Browse the repository at this point in the history
- Switches to GetHasAnyCritical() method to determine if Human and Alien factions have any critical units/structures remaining
  • Loading branch information
data-bomb committed May 21, 2024
1 parent df62536 commit dd0a35b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Si_HQlessHumansLose/Si_HQlessHumansLose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You should have received a copy of the GNU General Public License
using System;
using SilicaAdminMod;

[assembly: MelonInfo(typeof(HQlessHumansLose), "HQless Humans Lose", "1.3.4", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(HQlessHumansLose), "HQless Humans Lose", "1.3.5", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -71,18 +71,22 @@ static String GetRootStructureFullName(Team team)

public static bool OneFactionAlreadyEliminated()
{
int TeamsWithMajorStructures = 0;
int TeamsWithCriticalObjects = 0;
for (int i = 0; i < SiConstants.MaxPlayableTeams; i++)
{
Team? thisTeam = Team.Teams[i];
int thisTeamMajorStructures = thisTeam.NumMajorStructures;
if (thisTeamMajorStructures > 0)
if (thisTeam == null)
{
TeamsWithMajorStructures++;
continue;
}

if (thisTeam.GetHasAnyCritical())
{
TeamsWithCriticalObjects++;
}
}

if (TeamsWithMajorStructures < 2)
if (TeamsWithCriticalObjects < 2)
{
MelonLogger.Msg("OneFactionAlreadyEliminated: true");
return true;
Expand Down

0 comments on commit dd0a35b

Please sign in to comment.