Merge branch 'master' into terencehill/vehicles_fixes
authorterencehill <piuntn@gmail.com>
Sat, 4 Jan 2014 18:48:00 +0000 (19:48 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 4 Jan 2014 18:48:00 +0000 (19:48 +0100)
Conflicts:
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc

qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/vehicles/vehicles_def.qh
vehicle_raptor.cfg
vehicle_spiderbot.cfg

index 2810c8b64121fbb9cc4fcf64df99b6fe22667c1f..93ee2a6a7edd2b99dd1911bd355f850bd251ec84 100644 (file)
@@ -400,6 +400,9 @@ void PutClientInServer (void)
 
                RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
+               if(self.vehicle)
+                       vehicles_exit(VHEF_RELESE);
+
                self.classname = "player";
                self.wasplayer = TRUE;
                self.iscreature = TRUE;
index a4376bd418a101096d5fdf7d2e68c76070796578..28d794c6dfcbbeb52a9a628feff097b44ec0a742 100644 (file)
@@ -55,8 +55,8 @@ void ImpulseCommands (void)
 
     if(self.vehicle)
         if(self.vehicle.deadflag == DEAD_NO)
-            if(self.vehicle.vehicles_impusle)
-                if(self.vehicle.vehicles_impusle(imp))
+            if(self.vehicle.vehicles_impulse)
+                if(self.vehicle.vehicles_impulse(imp))
                     return;
 
        if(CheatImpulse(imp))
index 0325067f28fb396d795c693ba8608524ba473dc1..60df95a006eab4ce0941dc2176d43216e0cda9a7 100644 (file)
@@ -212,31 +212,8 @@ void assault_wall_think()
 
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
-void vehicles_clearrturn();
-void vehicles_spawn();
 void assault_new_round()
 {
-    entity oldself;
-       //bprint("ASSAULT: new round\n");
-
-       oldself = self;
-       // Eject players from vehicles
-    FOR_EACH_PLAYER(self)
-    {
-        if(self.vehicle)
-            vehicles_exit(VHEF_RELESE);
-    }
-
-    self = findchainflags(vehicle_flags, VHF_ISVEHICLE);
-    while(self)
-    {
-        vehicles_clearrturn();
-        vehicles_spawn();
-        self = self.chain;
-    }
-
-    self = oldself;
-
        // up round counter
        self.winning = self.winning + 1;
 
index bc5f03d8ae52f53d01bcdf33f51f6243974b98bd..657d227051e45cbe4da2d2e8df4295f3db36aba0 100644 (file)
@@ -792,10 +792,8 @@ void bumb_die()
 
 void bumb_impact()
 {
-    if(autocvar_g_vehicle_bumblebee_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_bumblebee_bouncepain_x,
-                                               autocvar_g_vehicle_bumblebee_bouncepain_y,
-                                               autocvar_g_vehicle_bumblebee_bouncepain_z);
+       if(autocvar_g_vehicle_bumblebee_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
 }
 
 void bumb_spawn(float _f)
index ff54539027eaa8cebb27d1f45caa6101a11e6046..f009723b7f223103b3848b8ad05fc8bc84ae4ae1 100644 (file)
@@ -74,7 +74,6 @@ float autocvar_g_vehicle_racer_bouncestop;
 vector autocvar_g_vehicle_racer_bouncepain;
 
 var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
-void racer_spawn_default();
 
 void racer_align4point(float _delta)
 {
@@ -529,8 +528,8 @@ void racer_exit(float eject)
 
 void racer_impact()
 {
-    if(autocvar_g_vehicle_racer_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+       if(autocvar_g_vehicle_racer_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
 }
 
 void racer_blowup()
@@ -544,16 +543,16 @@ void racer_blowup()
                                        autocvar_g_vehicle_racer_blowup_forceintensity,
                                        DEATH_VH_WAKI_DEATH, world);
 
-    self.nextthink  = time + autocvar_g_vehicle_racer_respawntime;
-    self.think      = racer_spawn_default;
+       self.alpha      = -1;
     self.movetype   = MOVETYPE_NONE;
     self.effects    = EF_NODRAW;
-
     self.colormod  = '0 0 0';
     self.avelocity = '0 0 0';
     self.velocity  = '0 0 0';
 
     setorigin(self, self.pos1);
+       self.touch = func_null;
+       self.nextthink = 0;
 }
 
 void racer_deadtouch()
@@ -624,12 +623,6 @@ void racer_spawn(float _spawnflag)
     self.damageforcescale = 0.5;
     //self.destvec = autocvar_g_vehicle_racer_bouncepain;
 }
-void racer_spawn_default()
-{
-       racer_spawn(0);
-}
-
-
 
 void spawnfunc_vehicle_racer()
 {
index 58a640e9cf8672afe3d0861b7c572f4ad4617bd9..a6ef526499528839ee09194e3b0fbd73bc5cee1c 100644 (file)
@@ -70,6 +70,11 @@ float autocvar_g_vehicle_raptor_shield;
 float autocvar_g_vehicle_raptor_shield_regen;
 float autocvar_g_vehicle_raptor_shield_regen_pause;
 
+float autocvar_g_vehicle_raptor_blowup_radius;
+float autocvar_g_vehicle_raptor_blowup_coredamage;
+float autocvar_g_vehicle_raptor_blowup_edgedamage;
+float autocvar_g_vehicle_raptor_blowup_forceintensity;
+
 float autocvar_g_vehicle_raptor_bouncefactor;
 float autocvar_g_vehicle_raptor_bouncestop;
 vector autocvar_g_vehicle_raptor_bouncepain;
@@ -690,7 +695,10 @@ void raptor_blowup()
 {
     self.deadflag    = DEAD_DEAD;
     self.vehicle_exit(VHEF_NORMAL);
-    RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_RAPT_DEATH, world);
+       RadiusDamage(self, self.enemy, autocvar_g_vehicle_raptor_blowup_coredamage,
+                               autocvar_g_vehicle_raptor_blowup_edgedamage,
+                               autocvar_g_vehicle_raptor_blowup_radius, world,
+                               autocvar_g_vehicle_raptor_blowup_forceintensity, DEATH_VH_RAPT_DEATH, world);
 
     self.alpha          = -1;
     self.movetype       = MOVETYPE_NONE;
@@ -742,8 +750,8 @@ void raptor_die()
 
 void raptor_impact()
 {
-    if(autocvar_g_vehicle_raptor_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+       if(autocvar_g_vehicle_raptor_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
 }
 
 // If we dont do this ever now and then, the raptors rotors
@@ -798,7 +806,7 @@ void raptor_spawn(float _f)
         //FIXME: Camera is in a bad place in HUD model.
         //setorigin(self.vehicle_viewport, '25 0 5');
 
-        self.vehicles_impusle   = raptor_impulse;
+        self.vehicles_impulse   = raptor_impulse;
 
         self.frame = 0;
 
index a73997fda5be350ca8469496fcd56033691ae9f7..1085a904e2143f7e1abec373b6f4d80aa496cad7 100644 (file)
@@ -58,6 +58,11 @@ float autocvar_g_vehicle_spiderbot_rocket_noise;
 float autocvar_g_vehicle_spiderbot_rocket_turnrate;
 float autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
+float autocvar_g_vehicle_spiderbot_blowup_radius;
+float autocvar_g_vehicle_spiderbot_blowup_coredamage;
+float autocvar_g_vehicle_spiderbot_blowup_edgedamage;
+float autocvar_g_vehicle_spiderbot_blowup_forceintensity;
+
 vector autocvar_g_vehicle_spiderbot_bouncepain;
 
 
@@ -634,8 +639,8 @@ void spiderbot_exit(float eject)
 
 void spider_impact()
 {
-    if(autocvar_g_vehicle_spiderbot_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+       if(autocvar_g_vehicle_spiderbot_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
 }
 
 void spiderbot_headfade()
@@ -718,14 +723,18 @@ void spiderbot_blowup()
     SUB_SetFade(g1, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
     SUB_SetFade(g2, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
 
-    RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_SPID_DEATH, world);
+       RadiusDamage(self, self.enemy, autocvar_g_vehicle_spiderbot_blowup_coredamage,
+                               autocvar_g_vehicle_spiderbot_blowup_edgedamage,
+                               autocvar_g_vehicle_spiderbot_blowup_radius, world,
+                               autocvar_g_vehicle_spiderbot_blowup_forceintensity, DEATH_VH_SPID_DEATH, world);
 
     self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
     self.movetype   = MOVETYPE_NONE;
     self.deadflag   = DEAD_DEAD;
     self.solid      = SOLID_NOT;
     self.tur_head.effects  &=  ~EF_FLAME;
-    self.vehicle_hudmodel.viewmodelforclient = self;
+       self.vehicle_hudmodel.viewmodelforclient = self;
+       setorigin(self, self.pos1);
 }
 
 void spiderbot_die()
@@ -784,7 +793,7 @@ void spiderbot_spawn(float _f)
 {
     if(!self.gun1)
     {
-        self.vehicles_impusle   = spiderbot_impulse;
+        self.vehicles_impulse   = spiderbot_impulse;
         self.gun1               = spawn();
         self.gun2               = spawn();
         setmodel(self.gun1, "models/vehicles/spiderbot_barrels.dpm");
index 1e5537a259934cd2faab7750716d1b9d57ea22de..b9740b5d88bfa5bee49fc6589962ef61298ed672 100644 (file)
@@ -16,7 +16,7 @@ void vehicles_return();
 void vehicles_enter();
 void vehicles_touch();
 void vehicles_reset_colors();
-void vehicles_clearrturn();
+void vehicles_clearreturn();
 void vehicles_setreturn();
 
 
@@ -456,6 +456,30 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
 }
 // End generic vehile projectile system
 
+void vehicles_reset()
+{
+       if(self.owner)
+       {
+               entity oldself = self;
+               self = self.owner;
+               vehicles_exit(VHEF_RELESE);
+               self = oldself;
+       }
+       self.alpha      = -1;
+       self.movetype   = MOVETYPE_NONE;
+       self.effects    = EF_NODRAW;
+       self.colormod  = '0 0 0';
+       self.avelocity = '0 0 0';
+       self.velocity  = '0 0 0';
+       self.event_damage = func_null;
+       self.solid = SOLID_NOT;
+       self.deadflag = DEAD_NO;
+
+       self.touch = func_null;
+       self.nextthink = 0;
+       vehicles_setreturn();
+}
+
 /** vehicles_spawn
     Exetuted for all vehicles on (re)spawn.
     Sets defaults for newly spawned units.
@@ -470,6 +494,7 @@ void vehicles_spawn()
     self.owner              = world;
     self.touch              = vehicles_touch;
     self.event_damage       = vehicles_damage;
+    self.reset              = vehicles_reset;
     self.iscreature         = TRUE;
     self.teleportable       = FALSE; // no teleporting for vehicles, too buggy
     self.damagedbycontents     = TRUE;
@@ -512,7 +537,7 @@ float vehicles_crushable(entity e)
     return FALSE;
 }
 
-void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
+void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
 {
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
         return;
@@ -658,7 +683,7 @@ void vehicles_enter()
         }
     }
 
-    vehicles_clearrturn();
+    vehicles_clearreturn();
 
     CSQCVehicleSetup(self.owner, self.hud);
 
@@ -964,7 +989,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
     }
 }
 
-void vehicles_clearrturn()
+void vehicles_clearreturn()
 {
     entity ret;
     // Remove "return helper", if any.
@@ -1055,7 +1080,7 @@ void vehicles_setreturn()
 {
     entity ret;
 
-    vehicles_clearrturn();
+    vehicles_clearreturn();
 
     ret = spawn();
     ret.classname   = "vehicle_return";
@@ -1063,19 +1088,16 @@ void vehicles_setreturn()
     ret.team        = self.team;
     ret.think       = vehicles_showwp;
 
-    if(self.deadflag != DEAD_NO)
-    {
-        ret.cnt         = time + self.vehicle_respawntime;
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);
-    }
-    else
-    {
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);
-    }
+       if(self.deadflag != DEAD_NO)
+       {
+               ret.cnt = max(game_starttime, time) + self.vehicle_respawntime;
+               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 5);
+       }
+       else
+               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 1);
 
     setmodel(ret, "null");
     setorigin(ret, self.pos1 + '0 0 96');
-
 }
 
 void vehicles_reset_colors()
@@ -1273,15 +1295,14 @@ float vehicle_initialize(string  net_name,
     self.event_damage        = func_null;
     self.touch               = vehicles_touch;
     self.think               = vehicles_spawn;
-    self.nextthink           = time;
-    self.vehicle_respawntime = _respawntime;
     self.vehicle_spawn       = spawnproc;
+       self.vehicle_respawntime = max(0, _respawntime);
     self.effects             = EF_NODRAW;
        self.dphitcontentsmask   = DPCONTENTS_BODY | DPCONTENTS_SOLID;
-    if(!autocvar_g_vehicles_delayspawn)
-        self.nextthink = time + game_starttime;
-    else
-        self.nextthink = time + _respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+       if(!autocvar_g_vehicles_delayspawn || !self.vehicle_respawntime)
+               self.nextthink = time;
+       else
+               self.nextthink = max(time, game_starttime) + max(0, self.vehicle_respawntime + ((random() * 2 - 1) * autocvar_g_vehicles_delayspawn_jitter));
 
        if(autocvar_g_playerclip_collisions)
                self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
index 393563f18b51a0aced50c1734498493273d027f8..56fc9ea009e542fd219dcf1f42cc922c4ce86e5d 100644 (file)
@@ -62,11 +62,9 @@ const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
 #define VHSF_NORMAL 0
 #define VHSF_FACTORY 2
 .void(float _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-.float(float _imp) vehicles_impusle;
+.float(float _imp) vehicles_impulse;
 .float vehicle_weapon2mode = volly_counter;
 
-//ยง .void() vehicle_factory()
-
 #ifdef VEHICLES_USE_ODE
 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
 void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force
index d91b79b6ceebdd6858051c24c837b21208378732..86864eef19698694e7c571e7e71b845f3e95b65d 100644 (file)
@@ -65,6 +65,11 @@ set g_vehicle_raptor_shield             75
 set g_vehicle_raptor_shield_regen       25
 set g_vehicle_raptor_shield_regen_pause 1.5
 
+set g_vehicle_raptor_blowup_radius           250
+set g_vehicle_raptor_blowup_coredamage       250
+set g_vehicle_raptor_blowup_edgedamage       15
+set g_vehicle_raptor_blowup_forceintensity   250
+
 set g_vehicle_raptor_bouncefactor 0.2
 set g_vehicle_raptor_bouncestop 0
 set g_vehicle_raptor_bouncepain "1 4 1000"
index 253ed31662c94c71e101955e66bab079547ac470..4258095f7c3b71c633f33f16813c4957262c24b6 100644 (file)
@@ -54,6 +54,11 @@ set g_vehicle_spiderbot_rocket_noise      0.2
 set g_vehicle_spiderbot_rocket_lifetime   20
 set g_vehicle_spiderbot_rocket_spread     0.05
 
+set g_vehicle_spiderbot_blowup_radius           250
+set g_vehicle_spiderbot_blowup_coredamage       250
+set g_vehicle_spiderbot_blowup_edgedamage       15
+set g_vehicle_spiderbot_blowup_forceintensity   250
+
 set g_vehicle_spiderbot_bouncefactor 0   // Factor of old velocity to keep after colission
 set g_vehicle_spiderbot_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
 set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"