Skip to content

Commit

Permalink
Merge pull request #377 from osm/fquery-match-start-end
Browse files Browse the repository at this point in the history
Query f_{modified,ruleset,version} on match {start,end}
  • Loading branch information
tcsabina authored Dec 12, 2024
2 parents f8d7cb1 + 66d6e7d commit f319f7e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void EndMatch(float skip_log)
char *tmp;
float f1;
qbool is_real_match_end = !isHoonyModeAny() || HM_is_game_over();
qbool f_modified_done = false, f_ruleset_done = false, f_version_done = false;

if (match_over || !match_in_progress)
{
Expand Down Expand Up @@ -399,6 +400,22 @@ void EndMatch(float skip_log)
for (p = world; (p = find_plr(p));)
{
p->ready = 0; // force players be not ready after match is end.

if (cvar("k_on_end_f_modified") && !f_modified_done)
{
stuffcmd(p, "say f_modified\n");
f_modified_done = true;
}
if (cvar("k_on_end_f_ruleset") && !f_ruleset_done)
{
stuffcmd(p, "say f_ruleset\n");
f_ruleset_done = true;
}
if (cvar("k_on_end_f_version") && !f_version_done)
{
stuffcmd(p, "say f_version\n");
f_version_done = true;
}
}
}

Expand Down Expand Up @@ -2784,6 +2801,21 @@ void PlayerReady(qbool startIdlebot)
G_bprint(2, "All players ready\n");
}

if (cvar("k_on_start_f_modified"))
{
stuffcmd(self, "say f_modified\n");
}

if (cvar("k_on_start_f_ruleset"))
{
stuffcmd(self, "say f_ruleset\n");
}

if (cvar("k_on_start_f_version"))
{
stuffcmd(self, "say f_version\n");
}

G_bprint(2, "Timer started\n");
}

Expand Down
6 changes: 6 additions & 0 deletions src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,12 @@ void FirstFrame(void)
RegisterCvar("k_lock_hdp");
RegisterCvar("k_disallow_weapons");
RegisterCvar("k_force_mapcycle"); // will use mapcycle even when /deathmatch 0
RegisterCvarEx("k_on_start_f_modified", "1");
RegisterCvarEx("k_on_start_f_ruleset", "1");
RegisterCvarEx("k_on_start_f_version", "1");
RegisterCvarEx("k_on_end_f_modified", "1");
RegisterCvarEx("k_on_end_f_ruleset", "1");
RegisterCvarEx("k_on_end_f_version", "1");

RegisterCvar("k_pow");
RegisterCvarEx("k_pow_q", "1"); // quad
Expand Down

0 comments on commit f319f7e

Please sign in to comment.