r4168 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Aug 24 09:27:17 EDT 2008
Author: div0
Date: 2008-08-24 09:27:17 -0400 (Sun, 24 Aug 2008)
New Revision: 4168
Modified:
trunk/data/newhook.cfg
trunk/data/qcsrc/server/g_hook.qc
Log:
hook: new "tarzan" mode that can pull players "symmetrically"
Modified: trunk/data/newhook.cfg
===================================================================
--- trunk/data/newhook.cfg 2008-08-24 12:37:57 UTC (rev 4167)
+++ trunk/data/newhook.cfg 2008-08-24 13:27:17 UTC (rev 4168)
@@ -1,4 +1,4 @@
-set g_grappling_hook_tarzan 1
+set g_grappling_hook_tarzan 2 // 2: can also pull players
set g_balance_grapplehook_speed_fly 1800
set g_balance_grapplehook_speed_pull 2000
set g_balance_grapplehook_force_rubber 2000
Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc 2008-08-24 12:37:57 UTC (rev 4167)
+++ trunk/data/qcsrc/server/g_hook.qc 2008-08-24 13:27:17 UTC (rev 4168)
@@ -92,7 +92,7 @@
void GrapplingHookThink()
{
float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
- vector dir, org, end;
+ vector dir, org, end, v0, dv;
if(self.owner.health <= 0 || self.owner.hook != self) // how did that happen?
{ // well, better fix it anyway
remove(self);
@@ -142,6 +142,7 @@
if(cvar("g_grappling_hook_tarzan"))
{
newlength = self.rope_length;
+ v0 = self.owner.velocity;
// first pull the rope...
newlength = max(newlength - pullspeed * frametime, minlength);
@@ -160,6 +161,17 @@
spd = bound(0, (dist - self.rope_length) / ropestretch, 1);
self.owner.velocity = self.owner.velocity * (1 - frametime * ropeairfriction);
self.owner.velocity = self.owner.velocity + frametime * dir * spd * rubberforce;
+
+ dv = ((self.owner.velocity - v0) * dir) * dir;
+ if(cvar("g_grappling_hook_tarzan") >= 2)
+ {
+ if(self.aiment.movetype == MOVETYPE_WALK || self.aiment.movetype == MOVETYPE_TOSS)
+ {
+ self.owner.velocity = self.owner.velocity - dv * 0.5;
+ self.aiment.velocity = self.aiment.velocity - dv * 0.5;
+ self.aiment.flags = self.aiment.flags - (self.aiment.flags & FL_ONGROUND);
+ }
+ }
}
else
{
More information about the nexuiz-commits
mailing list