]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_keyhunt.qc
Merge branch 'master' into terencehill/music_player
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_keyhunt.qc
index 39c1eb9a2e1cc1c42885b07eb3ad35b57f9f6220..d6413d33fab9d1500219fbd0e934d6357aa27507 100644 (file)
@@ -412,6 +412,13 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, float deatht
 {
        if(self.owner)
                return;
+       if(ITEM_DAMAGE_NEEDKILL(deathtype))
+       {
+               // touching lava, or hurt trigger
+               // what shall we do?
+               // immediately return is bad
+               // maybe start a shorter countdown?
+       }
        if(vlen(force) <= 0)
                return;
        if(time > self.pushltime)
@@ -421,7 +428,7 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, float deatht
 
 void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped key
 {
-       sound(player, CHAN_AUTO, kh_sound_collect, VOL_BASE, ATTN_NORM);
+       sound(player, CH_TRIGGER, kh_sound_collect, VOL_BASE, ATTN_NORM);
 
        if(key.kh_dropperteam != player.team)
        {
@@ -441,6 +448,15 @@ void kh_Key_Touch()  // runs many, many times when a key has been dropped and ca
 
        if(self.owner) // already carried
                return;
+
+       if(ITEM_TOUCH_NEEDKILL())
+       {
+               // touching sky, or nodrop
+               // what shall we do?
+               // immediately return is bad
+               // maybe start a shorter countdown?
+       }
+
        if(other.classname != "player")
                return;
        if(other.deadflag != DEAD_NO)
@@ -529,6 +545,8 @@ void kh_WinnerTeam(float teem)  // runs when a team wins
 
        first = TRUE;
        midpoint = '0 0 0';
+       firstorigin = '0 0 0';
+       lastorigin = '0 0 0';
        FOR_EACH_KH_KEY(key)
        {
                vector thisorigin;
@@ -672,7 +690,7 @@ void kh_Key_Think()  // runs all the time
        {
                if(self.siren_time < time)
                {
-                       sound(self.owner, CHAN_AUTO, kh_sound_alarm, VOL_BASE, ATTN_NORM);  // play a simple alarm
+                       sound(self.owner, CH_TRIGGER, kh_sound_alarm, VOL_BASE, ATTN_NORM);  // play a simple alarm
                        self.siren_time = time + 2.5;  // repeat every 2.5 seconds
                }
 
@@ -807,7 +825,7 @@ void kh_Key_DropOne(entity key)
        key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
        key.kh_dropperteam = key.team;
 
-       sound(player, CHAN_AUTO, kh_sound_drop, VOL_BASE, ATTN_NORM);
+       sound(player, CH_TRIGGER, kh_sound_drop, VOL_BASE, ATTN_NORM);
 }
 
 void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
@@ -833,7 +851,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                        if(suicide)
                                key.kh_dropperteam = player.team;
                }
-               sound(player, CHAN_AUTO, kh_sound_drop, VOL_BASE, ATTN_NORM);
+               sound(player, CH_TRIGGER, kh_sound_drop, VOL_BASE, ATTN_NORM);
        }
 }
 
@@ -878,7 +896,7 @@ void kh_WaitForPlayers()  // delay start of the round until enough players are p
        if(teams_missing == "")
                kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound);
        else
-               kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), 999, kh_WaitForPlayers);
+               kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
 }
 
 void kh_EnableTrackingDevice()  // runs after each round
@@ -907,7 +925,7 @@ void kh_StartRound()  // runs at the start of each round
        teams_missing = kh_CheckEnoughPlayers();
        if(teams_missing != "")
        {
-               kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), 999, kh_WaitForPlayers);
+               kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
                return;
        }
 
@@ -919,7 +937,7 @@ void kh_StartRound()  // runs at the start of each round
        {
                teem = kh_Team_ByID(i);
                players = 0;
-               entity my_player;
+               entity my_player = world;
                FOR_EACH_PLAYER(player)
                        if(player.deadflag == DEAD_NO)
                                if(!player.BUTTON_CHAT)
@@ -933,7 +951,7 @@ void kh_StartRound()  // runs at the start of each round
        }
 
        kh_tracking_enabled = FALSE;
-       kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", 999, kh_EnableTrackingDevice);
+       kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", -1, kh_EnableTrackingDevice);
 }
 
 float kh_HandleFrags(entity attacker, entity targ, float f)  // adds to the player score
@@ -1029,7 +1047,7 @@ MUTATOR_HOOKFUNCTION(kh_PlayerDies)
 {
        if(self == other)
                kh_Key_DropAll(self, TRUE);
-       else if(other.classname == "player" || other.classname == "gib")
+       else if(other.classname == "player")
                kh_Key_DropAll(self, FALSE);
        else
                kh_Key_DropAll(self, TRUE);