]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_nexball.qc
Merge remote-tracking branch 'origin/master' into samual/mutator_ctf
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_nexball.qc
index fd1a8fb591879f5a3152c9de6da99292eb1e343b..1b94746356c85ee15576d809f3e0ce3b57f9c076 100644 (file)
@@ -117,7 +117,7 @@ void GiveBall(entity plyr, entity ball)
        ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
        ball.team = plyr.team;
        plyr.ballcarried = ball;
-       ball.dropperid = plyr.playerid;
+       ball.ctf_dropper = plyr;
 
        plyr.effects |= autocvar_g_nexball_basketball_effects_default;
        ball.effects &~= autocvar_g_nexball_basketball_effects_default;
@@ -139,7 +139,7 @@ void GiveBall(entity plyr, entity ball)
        
     ownr = self;
     self = plyr;    
-    self.weaponentity.weapons = self.weapons;
+    WEPSET_COPY_EE(self.weaponentity, self);
     self.weaponentity.switchweapon = self.weapon;
     WEPSET_COPY_EW(self, WEP_PORTO);
     weapon_action(WEP_PORTO, WR_RESETPLAYER);
@@ -287,7 +287,7 @@ void basketball_touch(void)
                football_touch();
                return;
        }
-       if(!self.cnt && other.classname == "player" && (other.playerid != self.dropperid || time > self.ctf_droptime + autocvar_g_nexball_delay_collect))
+       if(!self.cnt && other.classname == "player" && (other != self.ctf_dropper || time > self.ctf_droptime + autocvar_g_nexball_delay_collect))
        {
                if(other.health <= 0)
                        return;
@@ -323,6 +323,8 @@ void GoalTouch(void)
 
        if(nb_teams == 2)
                otherteam = OtherTeam(ball.team);
+       else
+               otherteam = 0;
 
        if((isclient = ball.pusher.flags & FL_CLIENT))
                pname = ball.pusher.netname;
@@ -416,7 +418,7 @@ void nb_spawnteam(string teamname, float teamcolor)
 
 void nb_spawnteams(void)
 {
-       float t_r, t_b, t_y, t_p;
+       float t_r = 0, t_b = 0, t_y = 0, t_p = 0;
        entity e;
        for(e = world; (e = find(e, classname, "nexball_goal"));)
        {
@@ -921,14 +923,14 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
         }
         else
         {            
-            if(self.weaponentity.weapons)
+            if(!WEPSET_EMPTY_E(self.weaponentity))
             {
-                self.weapons = self.weaponentity.weapons;        
+                WEPSET_COPY_EE(self, self.weaponentity);
                 weapon_action(WEP_PORTO, WR_RESETPLAYER);
                 self.switchweapon = self.weaponentity.switchweapon;
                 W_SwitchWeapon(self.switchweapon);
                 
-                self.weaponentity.weapons = 0;
+               WEPSET_CLEAR_E(self.weaponentity);
             }
         }
         
@@ -938,7 +940,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
 
 MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
 {    
-    self.weaponentity.weapons = 0;
+    WEPSET_CLEAR_E(self.weaponentity);
     
     if(nexball_mode & NBM_BASKETBALL)
         WEPSET_OR_EW(self, WEP_PORTO);
@@ -960,7 +962,6 @@ MUTATOR_DEFINITION(gamemode_nexball)
 
        MUTATOR_ONADD
        {
-           g_nexball = 1;
                g_nexball_meter_period = autocvar_g_nexball_meter_period;
                if(g_nexball_meter_period <= 0)
                        g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users