]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Change dropperid/pickupid to just reference the entity of the players directly instea...
authorSamual <samual@xonotic.org>
Sat, 31 Mar 2012 18:05:16 +0000 (14:05 -0400)
committerSamual <samual@xonotic.org>
Sat, 31 Mar 2012 18:05:16 +0000 (14:05 -0400)
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh
qcsrc/server/mutators/gamemode_nexball.qc

index ae2ed1cc7ebad79740d14a4f6ff9c6751cf60286..707b205ba40ef8eeb7c3eb49ec5c70aeb8a627c6 100644 (file)
@@ -140,7 +140,7 @@ void ctf_Handle_Pass(entity player, entity reciever)
        // transfer flag to reciever
        flag.owner = reciever;
        flag.owner.flagcarried = flag;
-       flag.ctf_pickupid = reciever.playerid;
+       flag.ctf_pickupper = reciever;
        setattachment(flag, reciever, "");
        setorigin(flag, FLAG_CARRY_OFFSET);
 
@@ -203,7 +203,7 @@ void ctf_Handle_Drop(entity player, float droptype)
        }
        
        flag.ctf_droptime = time;
-       flag.ctf_dropperid = player.playerid;
+       flag.ctf_dropper = player;
        flag.ctf_status = FLAG_DROPPED;
 
        // messages and sounds
@@ -245,7 +245,7 @@ void ctf_Handle_Dropped_Capture(entity flag, entity enemy_flag)
        float cap_time, cap_record, success;
        string cap_message, refername;
        
-       entity player = enemy_flag.dropperid;
+       entity player = enemy_flag.ctf_dropper;
 
        // records
        if((autocvar_g_ctf_captimerecord_always) || (player_count - currentbots)) {
@@ -359,11 +359,11 @@ void ctf_Handle_Return(entity flag, entity player)
        ctf_EventLog("return", flag.team, player);
 
        // scoring
-       PlayerTeamScore_AddScore(player, ctf_ReadScore(strcat("score_return", ((player.playerid == flag.playerid) ? "_by_killer" : "")))); // reward for return
+       PlayerTeamScore_AddScore(player, ctf_ReadScore("score_return")); // reward for return
        PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
 
        TeamScore_AddToTeam(((flag.team == COLOR_TEAM1) ? COLOR_TEAM2 : COLOR_TEAM1), ST_SCORE, -ctf_ReadScore("penalty_returned")); // punish the team who was last carrying it
-       FOR_EACH_PLAYER(player) if(player.playerid == flag.ctf_dropperid) // punish the player who dropped the flag
+       FOR_EACH_PLAYER(player) if(player == flag.ctf_dropper) // punish the player who dropped the flag
        {
                PlayerScore_Add(player, SP_SCORE, -ctf_ReadScore("penalty_returned"));
                ctf_CaptureShield_Update(player, 0); // shield only
@@ -390,7 +390,7 @@ void ctf_Handle_Pickup_Base(entity flag, entity player)
        flag.solid = SOLID_NOT;
        flag.angles = '0 0 0';
        flag.ctf_pickuptime = time; // used for timing runs
-       flag.ctf_pickupid = player.playerid;
+       flag.ctf_pickupper = player;
        flag.ctf_status = FLAG_CARRY;
        
        // messages and sounds
@@ -449,7 +449,7 @@ void ctf_Handle_Pickup_Dropped(entity flag, entity player)
        flag.solid = SOLID_NOT;
        flag.angles = '0 0 0';
        //flag.ctf_pickuptime = time; // don't update pickuptime since this isn't a real steal. 
-       flag.ctf_pickupid = player.playerid;
+       flag.ctf_pickupper = player;
        flag.ctf_status = FLAG_CARRY;
 
        // messages and sounds
@@ -627,7 +627,7 @@ void ctf_FlagTouch()
                {
                        if(other.team == self.team)
                                ctf_Handle_Return(self, other); // other just returned his own flag
-                       else if((!other.flagcarried) && ((other.playerid != self.ctf_dropperid) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
+                       else if((!other.flagcarried) && ((other != self.ctf_dropper) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
                                ctf_Handle_Pickup_Dropped(self, other); // other just picked up a dropped enemy flag
                        break;
                }
index c089b999af801fc180a8bf1c97f3f2cc7e144466..9818eda1b4af63fc304f63342aeffdf4b5610a27 100644 (file)
@@ -64,11 +64,11 @@ entity ctf_worldflaglist;
 #define ctf_spawnorigin dropped_origin
 float ctf_captimerecord; // record time for capturing the flag
 .float ctf_pickuptime;
-.float ctf_pickupid;
-.float ctf_dropperid; // don't allow spam of dropping the flag
 .float ctf_droptime;
 .float ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
 .float max_flag_health;
+.entity ctf_pickupper;
+.entity ctf_dropper; // don't allow spam of dropping the flag
 
 // CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
 .float ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
index da3fd75f1dced90a2b8edee2a77757b2b6d56920..c27c466a6a69057cc607eb9dc413deb36eb2aa04 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.ctf_dropperid = plyr.playerid;
+       ball.ctf_dropper = plyr;
 
        plyr.effects |= autocvar_g_nexball_basketball_effects_default;
        ball.effects &~= autocvar_g_nexball_basketball_effects_default;
@@ -287,7 +287,7 @@ void basketball_touch(void)
                football_touch();
                return;
        }
-       if(!self.cnt && other.classname == "player" && (other.playerid != self.ctf_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;