From: MirceaKitsune Date: Fri, 18 Nov 2011 23:53:10 +0000 (+0200) Subject: Fix the worst cases of divisions by zero X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cef2b7e9202c55fae6da08298f9d57e1b3759530;p=voretournament%2Fvoretournament.git Fix the worst cases of divisions by zero --- diff --git a/data/qcsrc/server/bot/havocbot/vore_ai.qc b/data/qcsrc/server/bot/havocbot/vore_ai.qc index c308e27a..729bd3c0 100644 --- a/data/qcsrc/server/bot/havocbot/vore_ai.qc +++ b/data/qcsrc/server/bot/havocbot/vore_ai.qc @@ -138,7 +138,7 @@ void Vore_AI() if(self.status_teamhealing > 1) // if we are teamhealing, there's nothing to do from here on return; - if(!cvar("g_vore_reversescoring")) // when reverse scoring is on, it's in the interest of the prey to get eaten, so the predator has nothing to fear + if(prey.classname == "player" && !cvar("g_vore_reversescoring")) // when reverse scoring is on, it's in the interest of the prey to get eaten, so the predator has nothing to fear { if(skill >= 3) // make bots aware of this from skill 3 and up fear *= 1 + self.stomach_load / self.stomach_maxload; // the bigger our stomach, the less we want to put someone else in there diff --git a/data/qcsrc/server/cl_physics.qc b/data/qcsrc/server/cl_physics.qc index 5f3ebe4c..7f25bb20 100644 --- a/data/qcsrc/server/cl_physics.qc +++ b/data/qcsrc/server/cl_physics.qc @@ -507,14 +507,17 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce if(speedclamp) accelqw = -accelqw; - if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight - wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed"); - if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster - wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; - if(self.swallow_progress_prey) // cut speed based on swallow progress for prey - wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey")); - if(self.swallow_progress_pred) // cut speed based on swallow progress for preds - wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred")); + if(self.classname == "player") + { + if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight + wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed"); + if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster + wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; + if(self.swallow_progress_prey) // cut speed based on swallow progress for prey + wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey")); + if(self.swallow_progress_pred) // cut speed based on swallow progress for preds + wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred")); + } if(cvar("sv_gameplayfix_q2airaccelerate")) wishspeed0 = wishspeed; diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 57d78ac2..1688588e 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -155,6 +155,8 @@ void Vore_StomachLoad_Apply() { // apply stomach weight that makes you heavier and larger the more you eat // slowing the player is done in cl_physics.qc + if(self.classname != "player") + return; entity e; float prey_mass;