]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
Merge branch 'master' into martin-t/linkexplode
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / keyhunt / sv_keyhunt.qc
index c73b4952ad3e718c411b198020349ac541717df4..1240ee4975596e185a0759ba24f1bc72316499af 100644 (file)
@@ -23,6 +23,7 @@ float autocvar_g_balance_keyhunt_throwvelocity;
 int autocvar_g_keyhunt_teams_override;
 
 // #define KH_PLAYER_USE_ATTACHMENT
+// TODO? no model exists for this
 // #define KH_PLAYER_USE_CARRIEDMODEL
 
 #ifdef KH_PLAYER_USE_ATTACHMENT
@@ -52,12 +53,6 @@ bool kh_no_radar_circles;
 .float siren_time;  //  time delay the siren
 //.float stuff_time;  //  time delay to stuffcmd a cvar
 
-int kh_keystatus[17];
-//kh_keystatus[0] = status of dropped keys, kh_keystatus[1 - 16] = player #
-//replace 17 with cvar("maxplayers") or similar !!!!!!!!!
-//for(i = 0; i < maxplayers; ++i)
-//     kh_keystatus[i] = "0";
-
 int kh_Team_ByID(int t)
 {
        if(t == 0) return NUM_TEAM_1;
@@ -67,8 +62,6 @@ int kh_Team_ByID(int t)
        return 0;
 }
 
-//entity kh_worldkeylist;
-.entity kh_worldkeynext;
 entity kh_controller;
 //bool kh_tracking_enabled;
 int kh_teams;
@@ -297,7 +290,7 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs
        key.takedamage = DAMAGE_YES;
        // let key.team stay
        key.modelindex = kh_key_dropped;
-       navigation_dynamicgoal_set(key);
+       navigation_dynamicgoal_set(key, key.owner);
        key.kh_previous_owner = key.owner;
        key.kh_previous_owner_playerid = key.owner.playerid;
 }
@@ -340,18 +333,6 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
                if(key.kh_next)
                        key.kh_next.kh_prev = key;
 
-               float i;
-               i = kh_keystatus[key.owner.playerid];
-                       if(key.netname == "^1red key")
-                               i += 1;
-                       if(key.netname == "^4blue key")
-                               i += 2;
-                       if(key.netname == "^3yellow key")
-                               i += 4;
-                       if(key.netname == "^6pink key")
-                               i += 8;
-               kh_keystatus[key.owner.playerid] = i;
-
                kh_Key_Attach(key);
 
                if(key.kh_next == NULL)
@@ -704,10 +685,12 @@ LABEL(not_winning)
                kh_interferemsg_time = 0;
                FOREACH_CLIENT(IS_PLAYER(it), {
                        if(it.team == kh_interferemsg_team)
+                       {
                                if(it.kh_next)
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
                                else
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
+                       }
                        else
                                Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
                });
@@ -1054,7 +1037,7 @@ void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingsca
                        navigation_routerating(this, head.owner, ratingscale_enemy * 10000, 100000);
        }
 
-       havocbot_goalrating_items(this, 1, this.origin, 10000);
+       havocbot_goalrating_items(this, 80000, this.origin, 10000);
 }
 
 void havocbot_role_kh_carrier(entity this)
@@ -1075,9 +1058,9 @@ void havocbot_role_kh_carrier(entity this)
                navigation_goalrating_start(this);
 
                if(kh_Key_AllOwnedByWhichTeam() == this.team)
-                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // bring home
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.05); // bring home
                else
-                       havocbot_goalrating_kh(this, 4, 4, 1); // play defensively
+                       havocbot_goalrating_kh(this, 4, 4, 0.5); // play defensively
 
                navigation_goalrating_end(this);
 
@@ -1115,11 +1098,11 @@ void havocbot_role_kh_defense(entity this)
 
                key_owner_team = kh_Key_AllOwnedByWhichTeam();
                if(key_owner_team == this.team)
-                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend key carriers
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend key carriers
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(this, 4, 1, 0.1); // play defensively
+                       havocbot_goalrating_kh(this, 4, 1, 0.05); // play defensively
                else
-                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
 
                navigation_goalrating_end(this);
 
@@ -1158,11 +1141,11 @@ void havocbot_role_kh_offense(entity this)
 
                key_owner_team = kh_Key_AllOwnedByWhichTeam();
                if(key_owner_team == this.team)
-                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(this, 0.1, 1, 4); // play offensively
+                       havocbot_goalrating_kh(this, 0.1, 1, 2); // play offensively
                else
-                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK! EMERGENCY!
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK! EMERGENCY!
 
                navigation_goalrating_end(this);
 
@@ -1207,11 +1190,11 @@ void havocbot_role_kh_freelancer(entity this)
 
                int key_owner_team = kh_Key_AllOwnedByWhichTeam();
                if(key_owner_team == this.team)
-                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(this, 1, 10, 4); // prefer dropped keys
+                       havocbot_goalrating_kh(this, 1, 10, 2); // prefer dropped keys
                else
-                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
 
                navigation_goalrating_end(this);
 
@@ -1309,6 +1292,13 @@ MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(kh, LogDeath_AppendItemCodes)
+{
+       entity player = M_ARGV(0, entity);
+       if(player.kh_next)
+               M_ARGV(1, string) = strcat(M_ARGV(1, string), "K"); // item codes
+}
+
 MUTATOR_HOOKFUNCTION(kh, DropSpecialItems)
 {
        entity frag_target = M_ARGV(0, entity);