Skip to content

Commit

Permalink
Merge pull request #146 from tobiasksu/issue142
Browse files Browse the repository at this point in the history
Adjusted NetworkMatch.m_head_to_head calc for observers (Issue #141)
  • Loading branch information
roncli committed Aug 26, 2021
2 parents 17833ec + 741c37b commit 0a9e36a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions GameMod/MPObserver.cs
Expand Up @@ -725,4 +725,23 @@ static bool Prefix(PlayerShip __instance)
return true;
}
}

// Observers shouldn't count against "head to head" calc - short enough method to not bother transpiling
[HarmonyPatch(typeof(NetworkMatch), "SetMode")]
class MPObserver_NetworkMatch_SetMode
{
static bool Prefix(MatchMode mode, ref MatchMode ___m_match_mode)
{
___m_match_mode = mode;
if (mode == MatchMode.ANARCHY)
{
NetworkMatch.m_head_to_head = (NetworkMatch.m_players.Count(x => x.Value.m_name.StartsWith("OBSERVER")) < 3);
}
else
{
NetworkMatch.m_head_to_head = false;
}
return false;
}
}
}

0 comments on commit 0a9e36a

Please sign in to comment.