From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Mon, 18 Jul 2011 12:51:59 +0000 (+0300)
Subject: Get the gravity system to work properly
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=316058afa5483a58be58ed6313f7f3c0e02d32f4;p=voretournament%2Fvoretournament.git

Get the gravity system to work properly
---

diff --git a/data/balanceVT.cfg b/data/balanceVT.cfg
index bcfe3491..bafb2691 100644
--- a/data/balanceVT.cfg
+++ b/data/balanceVT.cfg
@@ -186,7 +186,7 @@ set g_balance_grabber_reload_time 2
 
 // {{{ stomach
 set g_balance_vore_load_pred_capacity 100 "capacity percent a player's stomach has, influenced by player size"
-set g_balance_vore_load_pred_weight 0.01 "you get this heavier the more you eat, at 1 each meal makes you two times heavier"
+set g_balance_vore_load_pred_weight 1 "you get this heavier the more you eat, at 1 each meal makes you two times heavier"
 set g_balance_vore_load_pred_speed 0.0015 "you get this slower the more you eat, at 0.5 each meal makes you two times slower"
 set g_balance_vore_load_pred_speedcap 34 "when a predator is going faster than this, their prey is squeezed out of them, multiplied by stomach load"
 set g_balance_vore_load_prey_mass 30 "prey mass, influenced by player size"
diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc
index 548e19b6..968f3711 100644
--- a/data/qcsrc/server/vore.qc
+++ b/data/qcsrc/server/vore.qc
@@ -1,7 +1,7 @@
 .float regurgitate_prepare;
 .float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time;
 .float complain_vore;
-.float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;
+.float vore_oldmovetype, vore_oldsolid;
 
 const float system_delay_time = 0.1;
 const float complain_delay_time = 1;
@@ -40,7 +40,7 @@ float Swallow_condition_check(entity prey)
 	if(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach
 	if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves
 	if(!self.BUTTON_REGURGITATE && time > self.action_delay)
-	if not(vlen(self.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))
+	if not(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))
 	{
 		string swallow_complain;
 		if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))
@@ -190,22 +190,21 @@ void Vore_StomachLoad_Apply()
 		{
 			vore_mass = cvar("g_balance_vore_load_prey_mass");
 			if(cvar("g_healthsize"))
-				vore_mass *= self.scale;
+				vore_mass *= e.scale;
 			self.stomach_load += floor(vore_mass);
 		}
 	}
 
-	if(self.stomach_load != self.vore_oldstomachload)
-		self.gravity += 1 + (self.stomach_load / self.stomach_maxload * cvar("g_balance_vore_load_pred_weight") - self.vore_oldstomachload);
-	if(self.gravity == 0)
-		self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity
-	self.vore_oldstomachload = self.stomach_load;
-
 	// apply the stomach capacity of the predator
 	self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity");
 	if(cvar("g_healthsize"))
 		self.stomach_maxload *= self.scale;
 	self.stomach_maxload = floor(self.stomach_maxload);
+
+	// apply weight
+	self.gravity = 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight");
+	if(!self.gravity && self.stomach_load)
+		self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity
 }
 
 void Vore_AutoDigest(entity e)
@@ -885,7 +884,7 @@ void Vore()
 
 	if(self.predator.deadflag != DEAD_NO)
 		Vore_Regurgitate(self);
-	else if(vlen(self.predator.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))
+	else if(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.predator.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))
 		Vore_Regurgitate(self);
 
 	// apply delayed regurgitating if it was scheduled