Skip to content

Commit

Permalink
Queue some BP when a miner is built
Browse files Browse the repository at this point in the history
  • Loading branch information
slipher committed Aug 31, 2022
1 parent a0831c9 commit c3ddb76
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sgame/sg_buildable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ static Cvar::Cvar<bool> g_indestructibleBuildables(
"g_indestructibleBuildables",
"make buildables impossible to destroy", Cvar::NONE, false);

static Cvar::Range<Cvar::Cvar<float>> g_BPMinerQueueFraction(
"g_buildPointMinerQueueFraction",
"upon miner construction, this fraction of the miner max yield is queued",
Cvar::NONE, 0.5, 0, 1);

/**
* @return Whether the means of death allow for an under-attack warning.
*/
Expand Down Expand Up @@ -2004,6 +2009,13 @@ static gentity_t *SpawnBuildable( gentity_t *builder, buildable_t buildable, con
HealthComponent *healthComponent = built->entity->Get<HealthComponent>();
healthComponent->SetHealth(healthComponent->MaxHealth() * BUILDABLE_START_HEALTH_FRAC);
}

if (buildable == BA_A_LEECH || buildable == BA_H_DRILL) {
// Building a new miner incurs a queued BP penalty to punish teams who repeatedly
// lose and rebuild their miners in the late game.
level.team[G_Team(builder)].queuedBudget +=
g_BPMinerQueueFraction.Get() * g_buildPointBudgetPerMiner.Get();
}
}

// Free existing buildables
Expand Down

0 comments on commit c3ddb76

Please sign in to comment.