Skip to content

Commit 1b8f920

Browse files
authored
Implement a new ai_profiles.tbl field that allows the maximum number of allies allowed to be rearming to be modified (#7065)
1 parent ea1a370 commit 1b8f920

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

code/ai/ai_profiles.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ void parse_ai_profiles_tbl(const char *filename)
477477

478478
set_flag(profile, "$support don't add primaries:", AI::Profile_Flags::Support_dont_add_primaries);
479479

480+
if (optional_string("$max allies rearming threshold:"))
481+
stuff_int(&profile->max_allies_rearming_threshold);
482+
480483
set_flag(profile, "$firing requires exact los:", AI::Profile_Flags::Require_exact_los);
481484

482485
if (optional_string("$exact los minimum detection radius:")) {
@@ -831,6 +834,7 @@ void ai_profile_t::reset()
831834
ai_range_aware_secondary_select_mode = AI_RANGE_AWARE_SEC_SEL_MODE_RETAIL;
832835
turret_target_recheck_time = 2000.0f;
833836
rot_fac_multiplier_ply_collisions = 0.0f;
837+
max_allies_rearming_threshold = 2;
834838

835839
better_collision_avoid_aggression_combat = 3.5f;
836840
better_collision_avoid_aggression_guard = 3.5f;

code/ai/ai_profiles.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ class ai_profile_t {
101101

102102
float detail_distance_mult[MAX_DETAIL_VALUE + 1]; //MAX_DETAIL_VALUE really needs to be 4
103103

104+
// max number of allies allowed to be rearming at the same time
105+
int max_allies_rearming_threshold;
106+
104107
// minimum radius for the line-of-sight (los) detection --wookieejedi
105108
float los_min_detection_radius;
106109

code/ai/aicode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14385,7 +14385,7 @@ int maybe_request_support(object *objp)
1438514385
try_to_rearm = true;
1438614386
} else if (ai_bad_time_to_rearm(objp)) {
1438714387
try_to_rearm = false;
14388-
} else if (num_allies_rearming(objp) < 2) {
14388+
} else if (num_allies_rearming(objp) < The_mission.ai_profile->max_allies_rearming_threshold) {
1438914389
if (desire >= 8) { // guarantees disabled will cause repair request
1439014390
try_to_rearm = true;
1439114391
} else if (desire >= 3) { // >= 3 means having a single subsystem fully blown will cause repair.

code/def_files/ai_profiles.tbl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ $Max Player Attackers: 2, 3, 4, 5, 99
6565

6666
;; maximum number of active (i.e. 'thrown') asteroids that can be
6767
;; heading toward a friendly ship at any given time
68-
$Max Incoming Asteroids: 3, 4, 5, 7, 10
68+
$Max Incoming Asteroids: 3, 4, 5, 7, 10
6969

7070
;; factor applied to damage suffered by the player
7171
$Player Damage Factor: 0.25, 0.5, 0.65, 0.85, 1
@@ -181,9 +181,8 @@ $Player Autoaim FOV: 0, 0, 0, 0, 0
181181
$Detail Distance Multiplier: 0.125, 0.25, 1.0, 4.0, 8.0
182182

183183
;; General AI-related flags. These were previously all lumped together
184-
;; under the New AI mission flag.
185-
186-
184+
;; under the New AI mission flag.
185+
187186
;; if set, big ships can attack a beam turret that's firing on them
188187
;; from a ship that they don't currently have targeted.
189188
$big ships can attack beam turrets on untargeted ships: NO
@@ -354,6 +353,10 @@ $no warp camera: NO
354353

355354
;; If set, this flag overrides the retail behavior whereby a ship
356355
;; assigned to guard a ship in a wing will instead guard the entire wing
357-
$ai guards specific ship in wing: NO
356+
$ai guards specific ship in wing: NO
357+
358+
;; maximum number of allies allowed to be rearming at the same time
359+
;; before the AI will hold off on requesting support
360+
$max allies rearming threshold: 2
358361

359362
#End

0 commit comments

Comments
 (0)