]> 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 66c7b8715f900707381039f7913cf10faddcbc08..cf4fc29de22f0dc4420efab5c2541f327fc48bed 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;
@@ -471,8 +480,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;
@@ -793,7 +811,7 @@ void ctf_FlagTouch()
        // special touch behaviors
        if(toucher.vehicle_flags & VHF_ISVEHICLE)
        {
-               if(autocvar_g_ctf_allow_vehicle_touch)
+               if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner)
                        toucher = toucher.owner; // the player is actually the vehicle owner, not other
                else
                        return; // do nothing
@@ -878,6 +896,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); }