]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/vehicles/vehicles.qc
Manual riddance of remaining "if not".
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / vehicles / vehicles.qc
index 40c90943e7d4d0b65d128aee672b8f12f1b66d20..f1fca41eb138fd892ac471073c3356aadbac2bdc 100644 (file)
@@ -23,7 +23,7 @@ void vehicles_setreturn();
 /** AuxiliaryXhair*
     Send additional points of interest to be drawn, to vehicle owner
 **/
-float MAX_AXH = 4;
+const float MAX_AXH = 4;
 .entity AuxiliaryXhair[MAX_AXH];
 
 float SendAuxiliaryXhair(entity to, float sf)
@@ -46,7 +46,7 @@ float SendAuxiliaryXhair(entity to, float sf)
 
 void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
 {
-    if not(IS_REAL_CLIENT(own))
+    if (!IS_REAL_CLIENT(own))
         return;
 
     entity axh;
@@ -101,7 +101,7 @@ void SendAuxiliaryXhair2(entity own, vector loc, vector clr, float axh_id)
 **/
 void CSQCVehicleSetup(entity own, float vehicle_id)
 {
-    if not(IS_REAL_CLIENT(own))
+    if (!IS_REAL_CLIENT(own))
         return;
        
        msg_entity = own;
@@ -131,7 +131,7 @@ void CSQCVehicleSetup(entity own, float vehicle_id)
 .float  lock_strength;
 .float  lock_time;
 .float  lock_soundtime;
-float  DAMAGE_TARGETDRONE = 10;
+const float    DAMAGE_TARGETDRONE = 10;
 
 vector targetdrone_getnewspot()
 {
@@ -275,7 +275,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time)
         if(trace_ent.deadflag != DEAD_NO)
             trace_ent = world;
 
-        if not (trace_ent.vehicle_flags & VHF_ISVEHICLE ||
+        if(!trace_ent.vehicle_flags & VHF_ISVEHICLE ||
                                trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET ||
                                trace_ent.takedamage == DAMAGE_TARGETDRONE)
             trace_ent = world;
@@ -442,7 +442,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
         proj.flags           = FL_PROJECTILE | FL_NOTARGET;
 
     if(_mzlsound)
-        sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTN_NORM);
+        sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
 
     if(_mzlfx)
         pointparticles(particleeffectnum(_mzlfx), proj.origin, proj.velocity, 1);
@@ -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;
 }
@@ -537,6 +537,9 @@ void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
 .void() vehicle_impact;
 void vehicles_touch()
 {
+       if(MUTATOR_CALLHOOK(VehicleTouch))
+               return;
+       
     // Vehicle currently in use
     if(self.owner)
     {
@@ -556,7 +559,7 @@ void vehicles_touch()
         return;
     }
 
-    if not(IS_PLAYER(other))
+    if (!IS_PLAYER(other))
         return;
 
     if(other.deadflag != DEAD_NO)
@@ -628,8 +631,8 @@ void vehicles_enter()
     //self.exteriormodeltoclient = self.owner;
     //self.tur_head.exteriormodeltoclient = self.owner;
 
-    other.flags &~= FL_ONGROUND;
-    self.flags  &~= FL_ONGROUND;
+    other.flags &= ~FL_ONGROUND;
+    self.flags  &= ~FL_ONGROUND;
 
     self.team                 = self.owner.team;
     self.flags               -= FL_NOTARGET;
@@ -778,7 +781,7 @@ void vehicles_exit(float eject)
         _player.takedamage     = DAMAGE_AIM;
         _player.solid          = SOLID_SLIDEBOX;
         _player.movetype       = MOVETYPE_WALK;
-        _player.effects        &~= EF_NODRAW;
+        _player.effects        &= ~EF_NODRAW;
         _player.alpha          = 1;
         _player.PlayerPhysplug = func_null;
         _player.vehicle        = world;
@@ -798,7 +801,6 @@ void vehicles_exit(float eject)
     
     if(!teamplay)
         _vehicle.team = 0;
-    else
 
     vh_player = _player;
     vh_vehicle = _vehicle;
@@ -808,7 +810,7 @@ void vehicles_exit(float eject)
 
     _vehicle.team = _vehicle.tur_head.team;
         
-    sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
+    sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM);
     _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;   
     _vehicle.phase = time + 1;
     
@@ -914,7 +916,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
         self.vehicle_shieldent.alpha       = 0.45;
         self.vehicle_shieldent.angles      = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles;
         self.vehicle_shieldent.nextthink   = time;
-        self.vehicle_shieldent.effects &~= EF_NODRAW;
+        self.vehicle_shieldent.effects &= ~EF_NODRAW;
 
         self.vehicle_shield -= damage;
 
@@ -926,11 +928,11 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
             self.vehicle_shieldent.alpha    = 0.75;
 
                if(sound_allowed(MSG_BROADCAST, attacker))
-                spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);   // FIXME: PLACEHOLDER
+                spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);   // FIXME: PLACEHOLDER
         }
         else
                if(sound_allowed(MSG_BROADCAST, attacker))
-                spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTN_NORM);  // FIXME: PLACEHOLDER
+                spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
 
     }
     else
@@ -938,7 +940,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
         self.vehicle_health -= damage;
 
         if(sound_allowed(MSG_BROADCAST, attacker))
-            spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);  // FIXME: PLACEHOLDER
+            spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
     }
     
        if(self.damageforcescale < 1 && self.damageforcescale > 0)
@@ -1151,7 +1153,7 @@ float vehicle_addplayerslot(    entity _owner,
                                 float() _framefunc, 
                                 void(float) _exitfunc)
 {
-    if not (_owner.vehicle_flags & VHF_MULTISLOT)
+    if (!(_owner.vehicle_flags & VHF_MULTISLOT))
         _owner.vehicle_flags |= VHF_MULTISLOT;
 
     _slot.PlayerPhysplug = _framefunc;
@@ -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;
@@ -1305,7 +1310,7 @@ float vehicle_initialize(string  net_name,
     }
 
     setsize(self, min_s, max_s);
-    if not (nodrop)
+    if (!nodrop)
     {
         setorigin(self, self.origin);
         tracebox(self.origin + '0 0 100', min_s, max_s, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
@@ -1342,7 +1347,7 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string
 
 void vehicles_gib_explode()
 {
-       sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+       sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
        pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
        remove(self);
 }