]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_nexball.qc
Merge remote branch 'origin/master' into tzork/gm_nexball
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_nexball.qc
index 6faf5851a08d7e3b968f96407ae63ceff9e750b5..8554a12238f08c2aea42b1bec64e5017de5f2492 100644 (file)
@@ -141,7 +141,7 @@ void GiveBall(entity plyr, entity ball)
     self = plyr;    
     self.weaponentity.weapons = self.weapons;
     self.weaponentity.switchweapon = self.weapon;
-    self.weapons = W_WeaponBit(WEP_PORTO);            
+    self.weapons = W_WeaponBit(WEP_PORTO);      
     weapon_action(WEP_PORTO, WR_RESETPLAYER);
     self.switchweapon = WEP_PORTO;
     W_SwitchWeapon(WEP_PORTO);
@@ -649,13 +649,14 @@ void spawnfunc_ball_bound(void)
 
 void W_Nexball_Think()
 {
-    dprint("W_Nexball_Think\n");
+    //dprint("W_Nexball_Think\n");
     //vector new_dir = steerlib_arrive(self.enemy.origin, 2500);
-    vector new_dir = steerlib_pull(self.enemy.origin);
+    vector new_dir = normalize(self.enemy.origin - self.origin);
     vector old_dir = normalize(self.velocity);     
-    float _speed = vlen(self.velocity);
+    float _speed = vlen(self.velocity);    
+    vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
+    //vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
     
-    vector new_vel = (old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
     self.velocity = new_vel;
     
     self.nextthink = time;
@@ -732,9 +733,11 @@ void W_Nexball_Attack2(void)
 {
        if(self.ballcarried.enemy)
        {
-        self.ballcarried.think = W_Nexball_Think;
-        self.ballcarried.nextthink = time;
-           DropBall(self.ballcarried, w_shotorg, trigger_push_calculatevelocity(self.ballcarried.origin, self.ballcarried.enemy, 32));
+           entity _ball = self.ballcarried;
+        W_SetupShot(self, FALSE, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
+           DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
+        _ball.think = W_Nexball_Think;
+        _ball.nextthink = time;
            return;
        }
     
@@ -933,18 +936,15 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
     return FALSE;
 }
 
-
 MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
 {    
     self.weaponentity.weapons = 0;
     
     if(nexball_mode & NBM_BASKETBALL)
-        return FALSE;
-    
-    if(autocvar_g_weapon_stay)
-        return FALSE;
+        self.weapons |= W_WeaponBit(WEP_PORTO);
+    else
+        self.weapons = 0; //    W_WeaponBit(WEP_PORTO);
 
-    self.weapons = 0;
     return FALSE;
 }