]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixes for some vehicle related issues
authorMario <mario.mario@y7mail.com>
Fri, 17 May 2013 01:26:44 +0000 (11:26 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 17 May 2013 01:26:44 +0000 (11:26 +1000)
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/vehicles/vehicles.qc

index a6c6f3a7e58a232bac1e04ddc2e15dc25faf9606..ee0da7e0cd9eb1ae4d67217bed3841521b53a95b 100644 (file)
@@ -276,6 +276,13 @@ MUTATOR_HOOKABLE(VehicleEnter);
        entity vh_player; // player
        entity vh_vehicle; // vehicle
        
+MUTATOR_HOOKABLE(VehicleTouch);
+       // called when a player touches a vehicle
+       // return TRUE to stop player from entering the vehicle
+       // INPUT
+       entity self; // vehicle
+       entity other; // player
+       
 MUTATOR_HOOKABLE(VehicleExit);
        // called when a player exits a vehicle
        // allows mutators to set special settings in this event
index d1f123a8946291287e938779eff2cf1a2b78ee17..82147826ee56345cad3162601515a20c05e631db 100644 (file)
@@ -583,6 +583,14 @@ MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
        return 0;
 }
 
+MUTATOR_HOOKFUNCTION(freezetag_VehicleTouch)
+{
+       if(other.freezetag_frozen)
+               return TRUE;
+               
+       return FALSE;
+}
+
 void freezetag_Initialize()
 {
        precache_model("models/ice/ice.md3");
@@ -616,6 +624,7 @@ MUTATOR_DEFINITION(gamemode_freezetag)
        MUTATOR_HOOK(HavocBot_ChooseRule, freezetag_BotRoles, CBC_ORDER_ANY);
        MUTATOR_HOOK(SpectateCopy, freezetag_SpectateCopy, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetTeamCount, freezetag_GetTeamCount, CBC_ORDER_EXCLUSIVE);
+       MUTATOR_HOOK(VehicleTouch, freezetag_VehicleTouch, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 40c90943e7d4d0b65d128aee672b8f12f1b66d20..dc78b054553c67f9893e4bc2db791a55a323664e 100644 (file)
@@ -507,7 +507,7 @@ float vehicles_crushable(entity e)
         return TRUE;
 
     if(e.flags & FL_MONSTER)
-        return TRUE; // more bitflags for everyone!
+        return TRUE;
 
     return FALSE;
 }
@@ -585,6 +585,9 @@ void vehicles_enter()
     if(self.team)
     if(self.team != other.team)
         return;
+               
+       if(MUTATOR_CALLHOOK(VehicleTouch))
+               return;
 
     RemoveGrapplingHook(other);
 
@@ -798,7 +801,6 @@ void vehicles_exit(float eject)
     
     if(!teamplay)
         _vehicle.team = 0;
-    else
 
     vh_player = _player;
     vh_vehicle = _vehicle;
@@ -1275,11 +1277,14 @@ float vehicle_initialize(string  net_name,
     self.vehicle_respawntime = _respawntime;
     self.vehicle_spawn       = spawnproc;
     self.effects             = EF_NODRAW;
+       self.dphitcontentsmask   = DPCONTENTS_BODY | DPCONTENTS_SOLID;
     if(!autocvar_g_vehicles_delayspawn)
-        self.nextthink = time + 0.5;
+        self.nextthink = time + game_starttime;
     else
         self.nextthink = time + _respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
 
+       if(autocvar_g_playerclip_collisions)
+               self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
 
     if(autocvar_g_nodepthtestplayers)
         self.effects = self.effects | EF_NODEPTHTEST;