From: Jakob MG Date: Tue, 28 Jun 2011 21:47:50 +0000 (+0200) Subject: Fix gibfountin turrets (health rounding issue) X-Git-Tag: xonotic-v0.5.0~159^2~15^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=76d3d75c835297c90a732027756fbacdfe6e66ff;p=xonotic%2Fxonotic-data.pk3dir.git Fix gibfountin turrets (health rounding issue) --- diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index 55fcd88bc..caca8ca04 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -498,8 +498,9 @@ void ent_turret() self.team = _team; turret_changeteam(); } + + if(self.health == 0) + turret_die(); } - if(self.health == 0) - turret_die(); } diff --git a/qcsrc/server/tturrets/system/system_damage.qc b/qcsrc/server/tturrets/system/system_damage.qc index 88358e771..8daad2734 100644 --- a/qcsrc/server/tturrets/system/system_damage.qc +++ b/qcsrc/server/tturrets/system/system_damage.qc @@ -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..) diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc index 2bc9f929a..de3e06537 100644 --- a/qcsrc/server/tturrets/system/system_main.qc +++ b/qcsrc/server/tturrets/system/system_main.qc @@ -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;