]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix gibfountin turrets (health rounding issue)
authorJakob MG <jakob_mg@hotmail.com>
Tue, 28 Jun 2011 21:47:50 +0000 (23:47 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 28 Jun 2011 21:47:50 +0000 (23:47 +0200)
qcsrc/client/tturrets.qc
qcsrc/server/tturrets/system/system_damage.qc
qcsrc/server/tturrets/system/system_main.qc

index 55fcd88bc2b3c593df8d9023d0788d00899b488a..caca8ca04aab2de27e222b9b0a8486fddfc1af3e 100644 (file)
@@ -498,8 +498,9 @@ void ent_turret()
             self.team = _team;
             turret_changeteam();        
         }
+        
+        if(self.health == 0)
+            turret_die();
     } 
     
-    if(self.health == 0)
-        turret_die();
 }
index 88358e771e3c2392fb63a2d5ddd3a023bc74bd7d..8daad2734101a1e53f8ebe5f42bf599effa7e0eb 100644 (file)
@@ -84,7 +84,7 @@ void turret_stdproc_respawn()
 void turret_stdproc_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
 {
     // Enougth allready!
-    if (self.health <= 0)
+    if(self.deadflag == DEAD_DEAD)
         return;
 
     // Inactive turrets take no damage. (hm..)
index 2bc9f929adfdd915daa7ef1a642a745a1d000e2b..de3e06537552308ec721306c96947a2c7bc16853 100644 (file)
@@ -64,12 +64,13 @@ float turret_send(entity to, float sf)
     }
     
     if(sf & TNSF_STATUS)
-    {        
+    {
         WriteByte(MSG_ENTITY, self.team);
+        
         if(self.health <= 0)
             WriteByte(MSG_ENTITY, 0);
         else
-            WriteByte(MSG_ENTITY, rint((self.health / self.tur_health) * 255)); // Send health as 0-255 insted of real value, where 255 = 100%
+            WriteByte(MSG_ENTITY, ceil((self.health / self.tur_health) * 255));
     }
     
        return TRUE;