Skip to content

Commit

Permalink
Adjusted messaging criteria, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
darkshade9 committed Oct 23, 2024
1 parent c7cf76e commit 8212216
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
6 changes: 3 additions & 3 deletions doc/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ Flag locations and CTF player spawns should be specified in tng/mapname.ctf file
- Server settings:
- `ctf [0/1]` - This will turn CTF on (1) or off (0). It will automatically turn Teamplay on (1).
- `capturelimit [#]` - The maximum number of captures before a map will change. Set to 0 to ignore that.
- `ctf_respawn [#]` - The time in seconds before a player will respawn after having died. Overrides respawn timers in .ctf files
- `ctf_respawn [#]` - The time in seconds before a player will respawn after having died. Will not override respawn timers from .ctf files.
- `ctf_dropflag [0/1]` - Allow clients to drop the flag or not.
- `uvtime [#]` - The number of seconds *10 of the duration of the 'shield' effect. (for example 40 is 4 secs)
- `ctf_dyn_respawn [0/1]` - Default 0, this will reduce the respawn timer for a losing team periodically. Will self-correct as that team mounts a comeback.
- `ctf_dyn_respawn [0/1]` - Default 0, if enabled, this will reduce the respawn timer for a losing team periodically. Will self-correct as that team mounts a comeback. The score discrepancy gets evaluated when a flag is captured on either team.
- Client settings:
- `drop flag` - Drop the flag if you're holding it

Expand Down Expand Up @@ -251,7 +251,7 @@ The voice command allows clients to play taunts for other players to hear. (as l

#### Commands
- Server settings:
- `use_voice [0/1]` - When on (1), it will allow the use of voice commands.
- `use_voice [0/1]` - When on (1), it will allow the use of voice commands. Requires a populated sndlist.ini file on the server end.
- Client settings:
- `voice "sound.wav"` - this will play sound.wav for all players to hear. (as long as the others have sound.wav) This command requires the .wav extension. (client side)

Expand Down
39 changes: 25 additions & 14 deletions src/action/a_ctf.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,27 +261,36 @@ void CTFSetTeamSpawns(int team, char *str)
#define MIN_RESPAWN_TIME 1

static void AdjustRespawnTime(int* spawn_time, int time_reduction, int team) {
*spawn_time = max(MIN_RESPAWN_TIME, *spawn_time - time_reduction);
if (team == TEAM1) {
ctfgame.spawn_red = *spawn_time;
} else if (team == TEAM2) {
ctfgame.spawn_blue = *spawn_time;
} else {
return; // invalid team passed
}
CenterPrintTeam(team, va("Dynamically adjusting respawn rates, your team is now respawning every %d seconds\n", *spawn_time));
gi.dprintf("%s: Respawn time for team %d adjusted to %d\n", __func__, team, *spawn_time);
int new_spawn_time = max(MIN_RESPAWN_TIME, *spawn_time - time_reduction);

// Only update and print if the respawn time has actually changed
if (*spawn_time != new_spawn_time) {
*spawn_time = new_spawn_time;
if (team == TEAM1) {
ctfgame.spawn_red = *spawn_time;
} else if (team == TEAM2) {
ctfgame.spawn_blue = *spawn_time;
} else {
return; // invalid team passed
}
CenterPrintTeam(team, va("Dynamically adjusting respawn rates, your team is now respawning every %d seconds\n", *spawn_time));
gi.dprintf("%s: Respawn time for team %d adjusted to %d\n", __func__, team, *spawn_time);
}
}

static void ResetRespawnTime(int team) {
if (team == TEAM1) {
if (ctfgame.spawn_red != ctfgame.spawn_red_default) {
CenterPrintTeam(team, va("Respawn rates reset, your team is now respawning every %d seconds\n", ctfgame.spawn_red_default));
gi.dprintf("%s: Respawn time for team %d reset to %d\n", __func__, team, ctfgame.spawn_red_default);
}
ctfgame.spawn_red = ctfgame.spawn_red_default;
CenterPrintTeam(team, va("Respawn rates reset, your team is now respawning every %d seconds\n", ctfgame.spawn_red_default));
gi.dprintf("%s: Respawn time for team %d reset to %d\n", __func__, team, ctfgame.spawn_red_default);
} else if (team == TEAM2) {
if (ctfgame.spawn_blue != ctfgame.spawn_blue_default) {
CenterPrintTeam(team, va("Respawn rates reset, your team is now respawning every %d seconds\n", ctfgame.spawn_blue_default));
gi.dprintf("%s: Respawn time for team %d reset to %d\n", __func__, team, ctfgame.spawn_blue_default);
}
ctfgame.spawn_blue = ctfgame.spawn_blue_default;
CenterPrintTeam(team, va("Respawn rates reset, your team is now respawning every %d seconds\n", ctfgame.spawn_blue_default));
gi.dprintf("%s: Respawn time for team %d reset to %d\n", __func__, team, ctfgame.spawn_blue_default);
}
}

Expand Down Expand Up @@ -331,6 +340,8 @@ qboolean HasFlag(edict_t * ent)
return false;
if (ent->client->inventory[items[FLAG_T1_NUM].index] || ent->client->inventory[items[FLAG_T2_NUM].index])
return true;
if (ent->client->ctf_hasflag)
return true;
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion src/action/botlib/botlib_ctf.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ void BOTLIB_CTF_Goals(edict_t* self)

if (n == INVALID && ctf_goal_node_warning == false){
ctf_goal_node_warning = true;
gi.dprintf("%s: Warning: Flag location is at an INVALID node.\n", __func__);
if (bot_debug->value)
gi.dprintf("%s: Warning: Flag location is at an INVALID node.\n", __func__);
return;
}

Expand Down

0 comments on commit 8212216

Please sign in to comment.