Merge branch 'master' into terencehill/bot_item_rating
authorterencehill <piuntn@gmail.com>
Fri, 20 Jan 2017 15:50:01 +0000 (16:50 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 20 Jan 2017 15:50:01 +0000 (16:50 +0100)
.gitlab-ci.yml
notifications.cfg
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/notifications/all.inc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/race.qc

index 1488aef..9e42b44 100644 (file)
@@ -30,7 +30,7 @@ test_sv_game:
     - wget -O data/maps/g-23.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.cache
     - wget -O data/maps/g-23.waypoints.hardwired https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.hardwired
     - make
-    - EXPECT=49ace70f31418e5580127461d853fcef
+    - EXPECT=86720b1d38512b4e92183d30662bab41
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 3e6b009..feb9b87 100644 (file)
@@ -102,7 +102,7 @@ seta notification_ANNCE_VOTE_ACCEPT "2" "0 = disabled, 1 = enabled if gentle mod
 seta notification_ANNCE_VOTE_CALL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
 seta notification_ANNCE_VOTE_FAIL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
 
-// MSG_INFO notifications (count = 328):
+// MSG_INFO notifications (count = 329):
 seta notification_INFO_CA_JOIN_LATE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_CA_LEAVE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_CHAT_NOSPECTATORS "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
@@ -269,6 +269,7 @@ seta notification_INFO_RACE_FAIL_UNRANKED "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_RACE_FINISHED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_RACE_NEW_BROKEN "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_RACE_NEW_IMPROVED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_RACE_NEW_MISSING_NAME "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_RACE_NEW_MISSING_UID "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_RACE_NEW_SET "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_ROUND_OVER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
@@ -743,4 +744,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa
 seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
 seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
 
-// Notification counts (total = 833): MSG_ANNCE = 89, MSG_INFO = 328, MSG_CENTER = 235, MSG_MULTI = 153, MSG_CHOICE = 28
+// Notification counts (total = 834): MSG_ANNCE = 89, MSG_INFO = 329, MSG_CENTER = 235, MSG_MULTI = 153, MSG_CHOICE = 28
index 4fad2c7..52d04bd 100644 (file)
@@ -210,12 +210,11 @@ void HUD_HealthArmor()
                                DrawNumIcon(pos + health_offset, mySize, health, "health", is_vertical, health_iconalign, HUD_Get_Num_Color(health, maxhealth), 1);
                }
 
-               if(armor)
+               //if(armor)
                {
+                       float p_armor = armor;
                        if(autocvar_hud_panel_healtharmor_progressbar)
                        {
-                               float p_armor;
-                               p_armor = armor;
                                if (autocvar_hud_panel_healtharmor_progressbar_gfx)
                                {
                                        if (autocvar_hud_panel_healtharmor_progressbar_gfx_smooth > 0)
@@ -250,8 +249,10 @@ void HUD_HealthArmor()
                                        }
                                        prev_armor = armor;
                                }
-                               HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, p_armor/maxarmor, is_vertical, armor_baralign, autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(p_armor)
+                                       HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, p_armor/maxarmor, is_vertical, armor_baralign, autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
+                       if(!autocvar_hud_panel_healtharmor_progressbar || p_armor)
                        if(autocvar_hud_panel_healtharmor_text)
                                DrawNumIcon(pos + armor_offset, mySize, armor, "armor", is_vertical, armor_iconalign, HUD_Get_Num_Color(armor, maxarmor), 1);
                }
index 4df4240..edd9701 100644 (file)
@@ -343,7 +343,7 @@ void buff_Init(entity this)
 
        entity buff = buff_FirstFromFlags(this.buffs);
 
-       if(!this.buffs || buff_Available(buff))
+       if(!this.buffs || !buff_Available(buff))
                buff_NewType(this, 0);
 
        this.classname = "item_buff";
index c25c194..fa7112e 100644 (file)
     MSG_INFO_NOTIF(RACE_NEW_BROKEN,                         1,  2, 3, "s1 s2 race_col f1ord race_col f2race_time race_diff",  "s1 f2race_time",     "race_newrankyellow",       _("^BG%s^BG broke %s^BG's %s%s^BG place record with %s%s %s"), "")
     MSG_INFO_NOTIF(RACE_NEW_IMPROVED,                       1,  1, 3, "s1 race_col f1ord race_col f2race_time race_diff", "s1 f2race_time",         "race_newtime",             _("^BG%s^BG improved their %s%s^BG place record with %s%s %s"), "")
     MSG_INFO_NOTIF(RACE_NEW_MISSING_UID,                    1,  1, 1, "s1 f1race_time", "s1 f1race_time",                                           "race_newfail",             _("^BG%s^BG scored a new record with ^F2%s^BG, but unfortunately lacks a UID and will be lost."), "")
+    MSG_INFO_NOTIF(RACE_NEW_MISSING_NAME,                   1,  1, 1, "s1 f1race_time", "s1 f1race_time",                                           "race_newfail",             _("^BG%s^BG scored a new record with ^F2%s^BG, but is anonymous and will be lost."), "")
     MSG_INFO_NOTIF(RACE_NEW_SET,                            1,  1, 2, "s1 race_col f1ord race_col f2race_time", "s1 f2race_time",                   "race_newrecordserver",     _("^BG%s^BG set the %s%s^BG place record with %s%s"), "")
 
     MULTIICON_INFO(MINIGAME_INVITE,                         1,  2, 0, "s2 minigame1_name s1", "s2", "minigame1_d", "minigames/%s/icon_notif",   _("^F4You have been invited by ^BG%s^F4 to join their game of ^F2%s^F4 (^F1%s^F4)"), "")
index 536c8b2..f57a18f 100644 (file)
@@ -21,10 +21,9 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
        IL_EACH(g_items, it.bot_pickup,
        {
-               o = (it.absmin + it.absmax) * 0.5;
-               friend_distance = 10000; enemy_distance = 10000;
                rating = 0;
 
+               o = (it.absmin + it.absmax) * 0.5;
                if(!it.solid || vdist(o - org, >, sradius) || (it == this.ignoregoal && time < this.ignoregoaltime) )
                        continue;
 
@@ -36,8 +35,11 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
                        d = pointcontents(trace_endpos + '0 0 1');
                        if(d == CONTENT_WATER || d == CONTENT_SLIME || d == CONTENT_LAVA)
                                continue;
-                       if(tracebox_hits_trigger_hurt(it.origin, it.mins, it.maxs, trace_endpos))
-                               continue;
+                       // this tracebox_hits_trigger_hurt call isn't needed:
+                       // dropped weapons are removed as soon as they fall on a trigger_hurt
+                       // and can't be rated while they are in the air
+                       //if(tracebox_hits_trigger_hurt(it.origin, it.mins, it.maxs, trace_endpos))
+                       //      continue;
                }
                else
                {
@@ -49,6 +51,7 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
                if(teamplay)
                {
+                       friend_distance = 10000; enemy_distance = 10000;
                        discard = false;
 
                        entity picker = it;
@@ -65,33 +68,18 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
                                                continue;
 
                                        friend_distance = d;
-
                                        discard = true;
 
-                                       if( picker.health && it.health > this.health )
-                                               continue;
+                                       if (picker.health && it.health > this.health) continue;
+                                       if (picker.armorvalue && it.armorvalue > this.armorvalue) continue;
 
-                                       if( picker.armorvalue && it.armorvalue > this.armorvalue)
-                                               continue;
+                                       if (picker.weapons && (picker.weapons & ~it.weapons)) continue;
 
-                                       if( picker.weapons )
-                                       if( picker.weapons & ~it.weapons )
-                                               continue;
-
-                                       if (picker.ammo_shells && it.ammo_shells > this.ammo_shells)
-                                               continue;
-
-                                       if (picker.ammo_nails && it.ammo_nails > this.ammo_nails)
-                                               continue;
-
-                                       if (picker.ammo_rockets && it.ammo_rockets > this.ammo_rockets)
-                                               continue;
-
-                                       if (picker.ammo_cells && it.ammo_cells > this.ammo_cells)
-                                               continue;
-
-                                       if (picker.ammo_plasma && it.ammo_plasma > this.ammo_plasma)
-                                               continue;
+                                       if (picker.ammo_shells && it.ammo_shells > this.ammo_shells) continue;
+                                       if (picker.ammo_nails && it.ammo_nails > this.ammo_nails) continue;
+                                       if (picker.ammo_rockets && it.ammo_rockets > this.ammo_rockets) continue;
+                                       if (picker.ammo_cells && it.ammo_cells > this.ammo_cells) continue;
+                                       if (picker.ammo_plasma && it.ammo_plasma > this.ammo_plasma) continue;
 
                                        discard = false;
                                }
@@ -108,7 +96,6 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
                        if ( (enemy_distance < friend_distance && vdist(o - org, <, enemy_distance)) ||
                                (friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ) || !discard )
                                rating = it.bot_pickupevalfunc(this, it);
-
                }
                else
                        rating = it.bot_pickupevalfunc(this, it);
index a3cbc68..a90ef8f 100644 (file)
@@ -285,6 +285,12 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e)
                return;
        }
 
+       if(uid2name(myuid) == "^1Unregistered Player")
+       {
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_RACE_NEW_MISSING_NAME, mynetname, t);
+               return;
+       }
+
        oldrec = race_readTime(GetMapname(), newpos);
        oldrec_holder = race_readName(GetMapname(), newpos);