Skip to content

Commit

Permalink
Update auto difficulty
Browse files Browse the repository at this point in the history
- Start at 0 /base difficulty/ rather than 1 and increment by 1 for every additional player.
  • Loading branch information
Alienmario committed Jan 13, 2025
1 parent cc7a41c commit d557c8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripting/srccoop_addon_difficulty.sp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public void OnPluginStart()
InitSourceCoopAddon();

g_pConvarDifficulty = CreateConVar("sourcecoop_difficulty", "0", "Sets the difficulty - from 0 (base difficulty) and up.", _, true, 0.0);
g_pConvarDifficultyAuto = CreateConVar("sourcecoop_difficulty_auto", "2", "Sets automatic difficulty mode. -1 disables. 0 balances difficulty between min and max convars. Values above 0 set the difficulty increment per player, ignoring the min and max cvars.", _, true, -1.0);
g_pConvarDifficultyAutoMin = CreateConVar("sourcecoop_difficulty_auto_min", "1", "When automatic difficulty mode is set to 0, this is the difficulty at 1 player.", _, true, 0.0);
g_pConvarDifficultyAuto = CreateConVar("sourcecoop_difficulty_auto", "1", "Sets automatic difficulty mode. -1 disables. 0 balances difficulty between min and max convars. Values above 0 set the difficulty increment per player, ignoring the min and max cvars.", _, true, -1.0);
g_pConvarDifficultyAutoMin = CreateConVar("sourcecoop_difficulty_auto_min", "0", "When automatic difficulty mode is set to 0, this is the difficulty at 1 player.", _, true, 0.0);
g_pConvarDifficultyAutoMax = CreateConVar("sourcecoop_difficulty_auto_max", "20", "When automatic difficulty mode is set to 0, this is the difficulty at max players.", _, true, 0.0);
g_pConvarDifficultyAnnounce = CreateConVar("sourcecoop_difficulty_announce", "1", "Toggles announcing changes in difficulty.", _, true, 0.0, true, 1.0);
g_pConvarDifficultyIgnoreDamageTo = CreateConVar("sourcecoop_difficulty_ignoredmgto", "npc_headcrab;npc_barnacle;npc_puffballfungus", "List of classnames where player->npc damage is exempt from difficulty scaling. Separated by semicolon.");
Expand Down Expand Up @@ -118,7 +118,7 @@ public void Frame_PlayerChangeTeamPost()

void UpdateAutoDifficulty()
{
if (g_pConvarDifficultyAuto.FloatValue == 0)
if (g_pConvarDifficultyAuto.FloatValue == 0.0)
{
int min = g_pConvarDifficultyAutoMin.IntValue;
int max = g_pConvarDifficultyAutoMax.IntValue;
Expand All @@ -134,7 +134,7 @@ void UpdateAutoDifficulty()
}
else if (g_pConvarDifficultyAuto.FloatValue > 0.0)
{
g_pConvarDifficulty.IntValue = RoundFloat(g_pConvarDifficultyAuto.FloatValue * GetRealClientCount(true, false, true));
g_pConvarDifficulty.IntValue = RoundFloat(g_pConvarDifficultyAuto.FloatValue * (GetRealClientCount(true, false, true) - 1));
}
}

Expand Down

0 comments on commit d557c8d

Please sign in to comment.