Skip to content

Commit

Permalink
Merge pull request skullernet#222 from actionquake/bots/reduce_item_r…
Browse files Browse the repository at this point in the history
…espawn_timer

Reduced special weapon/item respawn timers if bots are in the game
  • Loading branch information
darkshade9 authored Oct 21, 2024
2 parents 74b47ba + 08151ed commit 64f2dd7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/action/a_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ void SpecThink(edict_t * spec)
G_FreeEdict(spec);
}

// This function determines how long the special item will last until despawned
// The weapon version of this is SpecialWeaponRespawnTimer
static void MakeTouchSpecThink(edict_t * ent)
{
ent->touch = Touch_Item;
Expand All @@ -150,7 +152,12 @@ static void MakeTouchSpecThink(edict_t * ent)
}

if (gameSettings & GS_WEAPONCHOOSE) {
ent->nextthink = eztimer(6);
if (bot_enable->value && bot_connections.total_bots > 0) {
// Reduce time that items stick around if bots are loaded
ent->nextthink = eztimer(2);
} else {
ent->nextthink = eztimer(6);
}
ent->think = G_FreeEdict;
return;
}
Expand Down
9 changes: 7 additions & 2 deletions src/action/p_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,14 @@ void SpecialWeaponRespawnTimer(edict_t* ent)
ent->think = PlaceHolder;
return;
}
// Deathmatch with weapon choose, weapons disappear in 6s
// Deathmatch with weapon choose, weapons disappear in 6s (w/bots, 2 seconds)
if (gameSettings & GS_WEAPONCHOOSE) {
ent->nextthink = eztimer(6);
if (bot_enable->value && bot_connections.total_bots > 0) {
// Reduce time that items stick around if bots are loaded
ent->nextthink = eztimer(2);
} else {
ent->nextthink = eztimer(6);
}
ent->think = ThinkSpecWeap;
return;
}
Expand Down

0 comments on commit 64f2dd7

Please sign in to comment.