]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix scoreboard showing incorrect monster count in TD
authorMario <mario.mario@y7mail.com>
Tue, 19 Mar 2013 05:28:52 +0000 (16:28 +1100)
committerMario <mario.mario@y7mail.com>
Tue, 19 Mar 2013 05:28:52 +0000 (16:28 +1100)
qcsrc/server/accuracy.qc
qcsrc/server/mutators/gamemode_towerdefense.qc

index f7a01d572293ca6c48cf7f500e253567fbfb5e87..c5f3bc740f0123f4bb68986182c86b41cd02a269 100644 (file)
@@ -110,7 +110,7 @@ void accuracy_add(entity e, float w, float fired, float hit)
 float accuracy_isgooddamage(entity attacker, entity targ)
 {
        if(!inWarmupStage)
-       if(targ.flags & FL_CLIENT)
+       if((g_td && targ.flags & FL_MONSTER) || (!g_td && targ.flags & FL_CLIENT))
        if(!(attacker.flags & FL_MONSTER)) // no accuracy for monsters
        if(targ.deadflag == DEAD_NO)
        if(IsDifferentTeam(attacker, targ))
index 0d8238ab2203bd21b621d8e2b0b09cae6ea5902f..d971d9e59b5175ca2698d098a8440d3e57123030 100644 (file)
@@ -528,13 +528,13 @@ void combat_phase_announce() // TODO: clean up these fail nextthinks...
 void build_phase()
 {
        entity head;
-       float n_players = 0, gen_washealed = FALSE, player_washealed = FALSE;
+       float n_players = 0, gen_washealed = FALSE, mcount, mskill;
        
        current_phase = PHASE_BUILD;
        
        for(head = world;(head = find(head, classname, "td_generator")); )
        {
-               if(head.health <= 5 && head.max_health > 10)
+               if(head.health <= 15 && head.max_health > 100)
                        Announce("lastsecond");
                        
                if(head.health < head.max_health)
@@ -548,28 +548,24 @@ void build_phase()
        
        FOR_EACH_PLAYER(head)
        {
-               if(head.health < 100)
-               {
-                       player_washealed = TRUE;
-                       break; // we found 1, so no need to check the others
-               }
+               if(head.health < 100) head.health = 100;
+               if(gen_washealed) PlayerScore_Add(head, SP_TD_SCORE, -autocvar_g_td_generator_damaged_points);
+                       
+        n_players += 1;
        }
+       
+       mcount = autocvar_g_td_monster_count_increment * wave_count;
+       mskill = n_players * 0.02;
                
-       totalmonsters += autocvar_g_td_monster_count_increment * wave_count;
+       totalmonsters += mcount;
        monster_skill += autocvar_g_td_monsters_skill_increment;
+       monster_skill += mskill;
        
+       if(monster_skill < 1) monster_skill = 1;
+       if(totalmonsters < 1) totalmonsters = ((autocvar_g_td_monster_count > 0) ? autocvar_g_td_monster_count : 10);
        if(wave_count < 1) wave_count = 1;
        
        Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_TD_PHASE_BUILD, wave_count, totalmonsters, autocvar_g_td_buildphase_time);
-       
-       FOR_EACH_PLAYER(head) 
-    {
-               if(head.health < 100) head.health = 100;
-                       
-               if(gen_washealed) PlayerScore_Add(head, SP_TD_SCORE, -autocvar_g_td_generator_damaged_points);
-                       
-        n_players += 1;
-    }
     
     FOR_EACH_MONSTER(head)
     {
@@ -582,16 +578,6 @@ void build_phase()
         remove(head);
     }
        
-       if(n_players >= 2)
-       {
-               totalmonsters += n_players;
-               monster_skill += n_players * 0.05;
-       }
-       
-       if(monster_skill < 1) monster_skill = 1;
-               
-       if(totalmonsters < 1) totalmonsters = ((autocvar_g_td_monster_count > 0) ? autocvar_g_td_monster_count : 10);
-       
        monsters_total = totalmonsters;
        monsters_killed = 0;