]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_ctf.qc
Merge branch 'master' into Mario/vehicles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_ctf.qc
index b8419624ffbafaf3ad6ea33a068f1808ea0fd27e..e1cf56b8695f462f8b8c010456acbd3c530a9ad9 100644 (file)
@@ -257,8 +257,17 @@ void ctf_Handle_Retrieve(entity flag, entity player)
        flag.owner.flagcarried = flag;
 
        // reset flag
-       setattachment(flag, player, "");
-       setorigin(flag, FLAG_CARRY_OFFSET);
+       if(player.vehicle)
+       {
+               setattachment(flag, player.vehicle, "");
+               setorigin(flag, VEHICLE_FLAG_OFFSET);
+               flag.scale = VEHICLE_FLAG_SCALE;
+       }
+       else
+       {
+               setattachment(flag, player, "");
+               setorigin(flag, FLAG_CARRY_OFFSET);
+       }
        flag.movetype = MOVETYPE_NONE;
        flag.takedamage = DAMAGE_NO;
        flag.solid = SOLID_NOT;
@@ -388,6 +397,8 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
 
        if (!player) { return; } // without someone to give the reward to, we can't possibly cap
 
+       nades_GiveBonus(player, autocvar_g_nades_bonus_score_high );
+
        // messages and sounds
        Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(enemy_flag, CENTER_CTF_CAPTURE_));
        ctf_CaptureRecord(enemy_flag, player);
@@ -448,6 +459,8 @@ void ctf_Handle_Return(entity flag, entity player)
        {
                PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_return); // reward for return
                PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
+
+               nades_GiveBonus(player,autocvar_g_nades_bonus_score_medium);
        }
 
        TeamScore_AddToTeam(flag.team, ST_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the team who was last carrying it
@@ -471,8 +484,17 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype)
        // attach the flag to the player
        flag.owner = player;
        player.flagcarried = flag;
-       setattachment(flag, player, "");
-       setorigin(flag, FLAG_CARRY_OFFSET);
+       if(player.vehicle)
+       {
+               setattachment(flag, player.vehicle, "");
+               setorigin(flag, VEHICLE_FLAG_OFFSET);
+               flag.scale = VEHICLE_FLAG_SCALE;
+       }
+       else
+       {
+               setattachment(flag, player, "");
+               setorigin(flag, FLAG_CARRY_OFFSET);
+       }
 
        // flag setup
        flag.movetype = MOVETYPE_NONE;
@@ -500,6 +522,7 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype)
 
        // scoring
        PlayerScore_Add(player, SP_CTF_PICKUPS, 1);
+       nades_GiveBonus(player, autocvar_g_nades_bonus_score_minor);
        switch(pickuptype)
        {
                case PICKUP_BASE:
@@ -791,7 +814,8 @@ void ctf_FlagTouch()
        }
 
        // special touch behaviors
-       if(toucher.vehicle_flags & VHF_ISVEHICLE)
+       if(toucher.frozen) { return; }
+       else if(toucher.vehicle_flags & VHF_ISVEHICLE)
        {
                if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner)
                        toucher = toucher.owner; // the player is actually the vehicle owner, not other
@@ -878,6 +902,9 @@ void ctf_RespawnFlag(entity flag)
                        ctf_FakeTimeLimit(flag.owner, -1);
        }
 
+       if((flag.owner) && (flag.owner.vehicle))
+               flag.scale = FLAG_SCALE;
+
        if((flag.ctf_status == FLAG_DROPPED) && (flag.wps_flagdropped))
                { WaypointSprite_Kill(flag.wps_flagdropped); }
 
@@ -2182,7 +2209,7 @@ MUTATOR_DEFINITION(gamemode_ctf)
        MUTATOR_HOOK(VehicleEnter, ctf_VehicleEnter, CBC_ORDER_ANY);
        MUTATOR_HOOK(VehicleExit, ctf_VehicleExit, CBC_ORDER_ANY);
        MUTATOR_HOOK(AbortSpeedrun, ctf_AbortSpeedrun, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, ctf_BotRoles, CBC_ORDER_ANY);
+       MUTATOR_HOOK(HavocBot_ChooseRole, ctf_BotRoles, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {