if (CurrentGameMode.ModeCondition != GameModeBase.PrimaryModeCondition.ScoreBased)
return;
changed = false;
for each (team in teams)
{
if (teamScores[team] != CurrentGameMode.TeamScores[team])
{
changed = true;
CurrentGameMode.TeamScores[team] = teamScores[team];
}
}
if (changed)
UpdateAndEmitScore();
The only real reason to do the check would be to prevent emitting the score unnecessarily. If the stuff that happens on the other side of the emit isn't worth preventing, you shouldn't even check if they're different, just update all the scores and emit every time.
In one case the score is updated if it is less than CurrentGameMode.TeamScores[team], in the other it is updated if it is greater. This seems to have very different behavior.
Yeah, but unless I'm misreading the ternary or something, the logic in the OP is if the game mode is score based, only update the score if it is less than, and if it is not score based, then only update the score if it is greater than. Your code always returns early if the mode is not score based, and if it is, it always updates the score if it differs. I mean, for all I know, your version is how it should work, but this would be why I didn't see how != helps.
View all comments
Show parent comment
1
u/simulacrumgames Mar 08 '26 edited Mar 10 '26
The only real reason to do the check would be to prevent emitting the score unnecessarily. If the stuff that happens on the other side of the emit isn't worth preventing, you shouldn't even check if they're different, just update all the scores and emit every time.