]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
Console: reduce verbosity
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_keyhunt.qc
index 5982cf2085436442543488477e823925958eeb52..e985ee5c0020242f6d9d5fc3f3512e1ce1d3d038 100644 (file)
@@ -8,16 +8,16 @@ void kh_Initialize();
 
 REGISTER_MUTATOR(kh, false)
 {
-       ActivateTeamplay();
-       SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, -1, -1);
-       if (autocvar_g_keyhunt_team_spawns)
-               have_team_spawns = -1; // request team spawns
-
        MUTATOR_ONADD
        {
                if (time > 1) // game loads at time 1
                        error("This is a game type and it cannot be added at runtime.");
                kh_Initialize();
+
+               ActivateTeamplay();
+               SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, -1, -1);
+               if (autocvar_g_keyhunt_team_spawns)
+                       have_team_spawns = -1; // request team spawns
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
@@ -45,7 +45,7 @@ float kh_tracking_enabled;
 .entity kh_next;
 float kh_Key_AllOwnedByWhichTeam();
 
-typedef void(void) kh_Think_t;
+typedef void() kh_Think_t;
 void kh_StartRound();
 void kh_Controller_SetThink(float t, kh_Think_t func);
 
@@ -102,7 +102,7 @@ float kh_no_radar_circles;
 //     bits  5- 9: team of key 2, or 0 for no such key, or 30 for dropped, or 31 for self
 //     bits 10-14: team of key 3, or 0 for no such key, or 30 for dropped, or 31 for self
 //     bits 15-19: team of key 4, or 0 for no such key, or 30 for dropped, or 31 for self
-.float kh_state;
+.float kh_state = _STAT(KH_KEYS);
 .float siren_time;  //  time delay the siren
 //.float stuff_time;  //  time delay to stuffcmd a cvar
 
@@ -793,24 +793,23 @@ void kh_Key_Think()  // runs all the time
        self.nextthink = time + 0.05;
 }
 
-void key_reset()
-{SELFPARAM();
-       kh_Key_AssignTo(self, world);
-       kh_Key_Remove(self);
+void key_reset(entity this)
+{
+       kh_Key_AssignTo(this, world);
+       kh_Key_Remove(this);
 }
 
 const string STR_ITEM_KH_KEY = "item_kh_key";
-void kh_Key_Spawn(entity initial_owner, float angle, float i)  // runs every time a new flag is created, ie after all the keys have been collected
+void kh_Key_Spawn(entity initial_owner, float _angle, float i)  // runs every time a new flag is created, ie after all the keys have been collected
 {
-       entity key;
-       key = spawn();
+       entity key = spawn();
        key.count = i;
        key.classname = STR_ITEM_KH_KEY;
        key.touch = kh_Key_Touch;
        key.think = kh_Key_Think;
        key.nextthink = time;
        key.items = IT_KEY1 | IT_KEY2;
-       key.cnt = angle;
+       key.cnt = _angle;
        key.angles = '0 360 0' * random();
        key.event_damage = kh_Key_Damage;
        key.takedamage = DAMAGE_YES;
@@ -975,9 +974,9 @@ void kh_WaitForPlayers()  // delay start of the round until enough players are p
                }
                else
                {
-                       float missing_teams_mask = (!!p1) + (!!p2) * 2;
-                       if(kh_teams >= 3) missing_teams_mask += (!!p3) * 4;
-                       if(kh_teams >= 4) missing_teams_mask += (!!p4) * 8;
+                       float missing_teams_mask = boolean(p1) + boolean(p2) * 2;
+                       if(kh_teams >= 3) missing_teams_mask += boolean(p3) * 4;
+                       if(kh_teams >= 4) missing_teams_mask += boolean(p4) * 8;
                        if(prev_missing_teams_mask != missing_teams_mask)
                        {
                                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask);
@@ -1096,8 +1095,6 @@ void kh_Initialize()  // sets up th KH environment
        kh_controller.model = "";
        kh_controller.modelindex = 0;
 
-       addstat(STAT_KH_KEYS, AS_INT, kh_state);
-
        kh_ScoreRules(kh_teams);
 }