]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh
LMS: refactor LMS code to avoid forcing players to join on connection
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / lms / sv_lms.qh
1 #pragma once
2
3 #include <common/mutators/base.qh>
4 #include <common/scores.qh>
5
6 // 1 when player presses F3 to spectate for the first time (he only gets a warning)
7 // 2 when player goes spectator (presses F3 to spectate for the second time)
8 // 3 when player disconnects
9 .int lms_spectate_warning;
10 .int lmsplayer;
11
12 int lms_quitters = 0;
13
14 #define autocvar_g_lms_lives_override cvar("g_lms_lives_override")
15 string autocvar_g_lms_weaponarena = "most_available";
16
17 void lms_Initialize();
18
19 REGISTER_MUTATOR(lms, false)
20 {
21     MUTATOR_STATIC();
22         MUTATOR_ONADD
23         {
24         GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override));
25         GameRules_limit_lead(0);
26         GameRules_score_enabled(false);
27         GameRules_scoring(0, 0, 0, {
28             field(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY);
29             field(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
30         });
31
32                 lms_Initialize();
33         }
34         return 0;
35 }
36
37 // lives related defs
38 int lms_lowest_lives;
39 int LMS_NewPlayerLives();