All pastes #1084528 Raw Edit

Zeug

public text v1 · immutable
#1084528 ·published 2008-07-27 20:07 UTC
rendered paste body
Index: src/server/gem.cpp
===================================================================
--- src/server/gem.cpp	(Revision 1944)
+++ src/server/gem.cpp	(Arbeitskopie)
@@ -2765,6 +2765,9 @@
 
 void gemActor::ApplyStaminaCalculations(const csVector3& v, float times)
 {
+    csVector3 thisV = lastV;
+    lastV=v;
+
     // Script
     static MathScript* script = psserver->GetMathScriptEngine()->FindScript("StaminaMove");
     if (!script)
@@ -2816,17 +2819,17 @@
         double Speed; ///< magnitude of the velocity vector
         double Angle; ///< angle between velocity vector and X-Z plane
 
-        double XZvel = csQsqrt(v.x*v.x + v.z*v.z);
-        if (v.y > EPSILON)
+        double XZvel = csQsqrt(thisV.x*thisV.x + thisV.z*thisV.z);
+        if (thisV.y > EPSILON)
         {
             if (XZvel > EPSILON)
             {
-                Speed = csQsqrt(v.y*v.y + XZvel*XZvel);
-                Angle = atan(v.y / XZvel);
+                Speed = csQsqrt(thisV.y*thisV.y + XZvel*XZvel);
+                Angle = atan(thisV.y / XZvel);
             }
             else // straight up
             {
-                Speed = v.y;
+                Speed = thisV.y;
                 Angle = HALF_PI;
             }
         }
Index: src/server/gem.h
===================================================================
--- src/server/gem.h	(Revision 1944)
+++ src/server/gem.h	(Arbeitskopie)
@@ -564,6 +564,7 @@
 
     uint8_t DRcounter;  /// increments in loop to prevent out of order packet overwrites of better data
     csTicks lastDR;
+    csVector3 lastV;
 
     /** Production Start Pos is used to record the place where people started digging. */
     csVector3 productionStartPos;
Index: src/server/database/mysql/math_scripts.sql
===================================================================
--- src/server/database/mysql/math_scripts.sql	(Revision 1944)
+++ src/server/database/mysql/math_scripts.sql	(Arbeitskopie)
@@ -186,7 +186,7 @@
 
 INSERT INTO math_scripts VALUES( "StaminaMove",
 "
-        Drain = (Speed/10) + ((Weight/MaxWeight)/10);
+        Drain = (Speed/3) * (Weight/MaxWeight);
 ");
 
 INSERT INTO math_scripts VALUES( "StaminaCombat",