]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/vehicles/vehicles.qc
Merge remote branch 'origin/master' into samual/hud_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / vehicles / vehicles.qc
index 820c2ecbd61b8ea7ed21a984ae44edd25efc5891..c4e2875380486575ed766684f7def98d1053ff28 100644 (file)
@@ -42,7 +42,7 @@ void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
     entity axh;
 
     axh_id = bound(0, axh_id, MAX_AXH);
-    axh = own.AuxiliaryXhair[axh_id];
+    axh = own.(AuxiliaryXhair[axh_id]);
 
     if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
     {
@@ -56,7 +56,7 @@ void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
     setorigin(axh, loc);
     axh.colormod            = clr;
     axh.SendFlags           = 0x01;
-    own.AuxiliaryXhair[axh_id] = axh;
+    own.(AuxiliaryXhair[axh_id]) = axh;
 }
 
 /*
@@ -310,7 +310,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
         proj.flags           = FL_PROJECTILE | FL_NOTARGET;
 
     if(_mzlsound)
-        sound (self, CHAN_WEAPON, _mzlsound, VOL_BASE, ATTN_NORM);
+        sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTN_NORM);
 
     if(_mzlfx)
         pointparticles(particleeffectnum(_mzlfx), proj.origin, proj.velocity, 1);
@@ -339,6 +339,7 @@ void vehicles_spawn()
     self.touch              = vehicles_touch;
     self.event_damage       = vehicles_damage;
     self.iscreature         = TRUE;
+    self.damagedbycontents     = TRUE;
     self.movetype           = MOVETYPE_WALK;
     self.solid              = SOLID_SLIDEBOX;
     self.takedamage         = DAMAGE_AIM;
@@ -428,6 +429,8 @@ void vehicles_enter()
     if(self.team)
     if(self.team != other.team)
         return;
+        
+    RemoveGrapplingHook(other);
 
     self.vehicle_ammo1   = 0;
     self.vehicle_ammo2   = 0;
@@ -488,7 +491,6 @@ void vehicles_enter()
     }
     else
     {
-        WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
         WriteAngle(MSG_ONE,  self.angles_x * -1); // tilt
         WriteAngle(MSG_ONE,  self.angles_y);      // yaw
         WriteAngle(MSG_ONE,  0);                  // roll
@@ -619,7 +621,9 @@ void vehicles_exit(float eject)
 
     if(!teamplay)
         self.team = 0;
-
+    else
+        self.team = self.tur_head.team;
+    
     if(self.owner.flagcarried)
     {
         self.owner.flagcarried.scale = 0.6;
@@ -627,9 +631,10 @@ void vehicles_exit(float eject)
         setorigin(self.owner.flagcarried, FLAG_CARRY_POS);
     }
     
-    sound (self, CHAN_TRIGGER, "misc/null.wav", 1, ATTN_NORM);
+    sound (self, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
     self.vehicle_exit(eject);
     self.owner = world;
+    vehicles_reset_colors();
     
     if(oldself)
         self = oldself;
@@ -704,7 +709,6 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
             self.vehicle_shieldent.think       = shieldhit_think;
         }
 
-
         self.vehicle_shieldent.colormod    = '1 1 1';
         self.vehicle_shieldent.alpha       = 0.45;
         self.vehicle_shieldent.angles      = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles;
@@ -714,15 +718,27 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
 
         if(self.vehicle_shield < 0)
         {
+            self.vehicle_health            -= fabs(self.vehicle_shield);
             self.vehicle_shieldent.colormod = '2 0 0';
             self.vehicle_shield             = 0;
             self.vehicle_shieldent.alpha    = 0.75;
-            self.vehicle_health            -= fabs(self.vehicle_shield);
+            
+               if(sound_allowed(MSG_BROADCAST, attacker))
+                spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);   // FIXME: PLACEHOLDER
         }
+        else
+               if(sound_allowed(MSG_BROADCAST, attacker))
+                spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTN_NORM);  // FIXME: PLACEHOLDER
+
     }
     else
+    {
         self.vehicle_health -= damage;
 
+        if(sound_allowed(MSG_BROADCAST, attacker))
+            spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);  // FIXME: PLACEHOLDER
+    }
+
     self.velocity += force; // * (vlen(force) / self.mass);
 
     if(self.vehicle_health <= 0)
@@ -785,6 +801,7 @@ void vehicles_showwp_goaway()
 void vehicles_showwp()
 {
     entity oldself;
+    vector rgb;
     
     if(self.cnt)
     {        
@@ -807,18 +824,16 @@ void vehicles_showwp()
         self.think = vehicles_showwp_goaway;
     }
     
-    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE);
+    if(teamplay && self.team)
+           rgb = TeamColor(self.team);
+    else
+           rgb = '1 1 1';
+    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
     if(self.waypointsprite_attached)
     {        
-        if(teamplay && self.team)
-            WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, TeamColor(self.team));
-        else
-            WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, '1 1 1');
-        
         WaypointSprite_UpdateRule(self.waypointsprite_attached, self.enemy.team, SPRITERULE_DEFAULT);        
         if(oldself == world)
             WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);        
-            
         WaypointSprite_Ping(self.waypointsprite_attached);
     }    
     
@@ -836,7 +851,7 @@ void vehicles_setreturn()
     ret.classname   = "vehicle_return";
     ret.enemy       = self;    
     ret.team        = self.team;
-    ret.think       = vehicles_showwp;        
+    ret.think       = vehicles_showwp;
     
     if(self.deadflag != DEAD_NO)
     {
@@ -847,8 +862,6 @@ void vehicles_setreturn()
     {
         ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);        
     }
-        
-    
     
     setmodel(ret, "null");
     setorigin(ret, self.pos1 + '0 0 96');
@@ -950,7 +963,7 @@ float vehicle_initialize(string  net_name,
 
     if(self.team && !teamplay)
         self.team = 0;
-
+        
     self.vehicle_flags |= VHF_ISVEHICLE;
     
     setmodel(self, bodymodel);
@@ -962,6 +975,7 @@ float vehicle_initialize(string  net_name,
     self.takedamage         = DAMAGE_AIM;
     self.bot_attack         = TRUE;
     self.iscreature         = TRUE;
+    self.damagedbycontents     = TRUE;
     self.hud                = vhud;
 
     self.vehicle_die         = dieproc;
@@ -1009,7 +1023,8 @@ float vehicle_initialize(string  net_name,
 
     self.pos1 = self.origin;
     self.pos2 = self.angles;
-
+    self.tur_head.team = self.team;
+    
     return TRUE;
 }