]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Racer rockets new slightly predicts target, and have a cvar for ontroling accelerated...
authorJakob MG <jakob_mg@hotmail.com>
Sun, 20 May 2012 16:56:53 +0000 (18:56 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Sun, 20 May 2012 16:56:53 +0000 (18:56 +0200)
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/vehicles.qc
vehicle_racer.cfg

index 6c256416a487f4b978a8e0047b28b7b6fcd2c91f..c6523e4b83dcd671668bc6afa50db571afb804e7 100644 (file)
@@ -58,6 +58,7 @@ float autocvar_g_vehicle_racer_rocket_locking_time;
 float autocvar_g_vehicle_racer_rocket_locking_releasetime;
 float autocvar_g_vehicle_racer_rocket_locked_time;
 float autocvar_g_vehicle_racer_rocket_locked_maxangle;
+float autocvar_g_vehicle_racer_rocket_climbspeed;
 
 float autocvar_g_vehicle_racer_respawntime;
 
@@ -205,11 +206,14 @@ void racer_rocket_tracker()
     newvel = oldvel + self.lip;
     makevectors(vectoangles(olddir));
 
+       float time_to_impact = min(vlen(self.enemy.origin - self.origin) / vlen(self.velocity), 1);
+       vector predicted_origin = self.enemy.origin + self.enemy.velocity * time_to_impact;
+
     traceline(self.origin, self.origin + v_forward * 64 - '0 0 32', MOVE_NORMAL, self);
-    newdir = normalize(self.enemy.origin - self.origin);
+    newdir = normalize(predicted_origin - self.origin);
 
     //vector
-       float height_diff = self.enemy.origin_z - self.origin_z;
+       float height_diff = predicted_origin_z - self.origin_z;
 
     if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle)
     {
@@ -223,8 +227,8 @@ void racer_rocket_tracker()
         newdir_z += 16 * sys_frametime;
 
     self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel;
-    self.velocity_z -= 800 * sys_frametime ;
-    self.velocity_z += max(height_diff, cvar("bajs")) * sys_frametime ;
+    self.velocity_z -= 800 * sys_frametime;
+    self.velocity_z += max(height_diff, autocvar_g_vehicle_racer_rocket_climbspeed) * sys_frametime ;
 
     UpdateCSQCProjectile(self);
     return;
@@ -472,6 +476,8 @@ void racer_enter()
 
     if(self.owner.flagcarried)
        setorigin(self.owner.flagcarried, '-190 0 96');
+
+       //targetdrone_spawn(self.origin + '0 0 512' + randomvec() * 256, 1);
 }
 
 void racer_exit(float eject)
index 7bbf7fe26ea3f47ea4be7c923a3ec797800b2c3f..b25177fdf165917f40d524d249248ce23f227219 100644 (file)
@@ -115,6 +115,118 @@ void CSQCVehicleSetup(entity own, float vehicle_id)
 .float  lock_strength;
 .float  lock_time;
 .float  lock_soundtime;
+float  DAMAGE_TARGETDRONE = 10;
+
+vector targetdrone_getnewspot()
+{
+
+       vector spot;
+       float i;
+       for(i = 0; i < 100; ++i)
+       {
+               spot = self.origin + randomvec() * 1024;
+               tracebox(spot, self.mins, self.maxs, spot, MOVE_NORMAL, self);
+               if(trace_fraction == 1.0 && trace_startsolid == 0 && trace_allsolid == 0)
+                       return spot;
+       }
+       return self.origin;
+}
+void targetdrone_think();
+void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+void targetdrone_renwe()
+{
+       self.think = targetdrone_think;
+       self.nextthink = time + 0.1;
+       setorigin(self, targetdrone_getnewspot());
+       self.health = 200;
+       self.takedamage = DAMAGE_TARGETDRONE;
+       self.event_damage = targetdrone_damage;
+       self.solid = SOLID_BBOX;
+       setmodel(self, "models/runematch/rune.mdl");
+       self.effects = EF_LOWPRECISION;
+       self.scale = 10;
+       self.movetype = MOVETYPE_BOUNCEMISSILE;
+       setsize(self, '-100 -100 -100', '100 100 100');
+
+}
+void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+       self.health -= damage;
+       if(self.health <= 0)
+       {
+               pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
+
+               if(!self.cnt)
+                       remove(self);
+               else
+               {
+                       self.think = targetdrone_renwe;
+                       self.nextthink = time + 1 + random() * 2;
+                       self.solid = SOLID_NOT;
+                       setmodel(self, "");
+               }
+       }
+}
+entity targetdrone_getfear()
+{
+       entity fear;
+       float i;
+
+       for(i = 64; i <= 1024; i += 64)
+       {
+               fear = findradius(self.origin, i);
+               while(fear)
+               {
+                       if(fear.bot_dodge)
+                               return fear;
+
+                       fear = fear.chain;
+               }
+       }
+
+       return world;
+}
+void targetdrone_think()
+{
+       self.nextthink = time + 0.1;
+
+       if(self.enemy)
+       if(self.enemy.deadflag != DEAD_NO)
+               self.enemy = targetdrone_getfear();
+
+       if(!self.enemy)
+               self.enemy = targetdrone_getfear();
+
+       vector newdir;
+
+       if(self.enemy)
+               newdir = steerlib_push(self.enemy.origin) + randomvec() * 0.75;
+       else
+               newdir = randomvec() * 0.75;
+
+       newdir = newdir * 0.5 + normalize(self.velocity) * 0.5;
+
+       if(self.enemy)
+               self.velocity = normalize(newdir) * (500 + (1024 / min(vlen(self.enemy.origin - self.origin), 1024)) * 700);
+       else
+               self.velocity = normalize(newdir) * 750;
+
+       tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 2, MOVE_NORMAL, self);
+       if(!trace_fraction == 1.0)
+               self.velocity = self.velocity * -1;
+
+       //normalize((normalize(self.velocity) * 0.5 + newdir * 0.5)) * 750;
+}
+
+void targetdrone_spawn(vector _where, float _autorenew)
+{
+       entity drone = spawn();
+       setorigin(drone, _where);
+       drone.think = targetdrone_renwe;
+       drone.nextthink = time + 0.1;
+       drone.cnt = _autorenew;
+}
+
 void vehicles_locktarget(float incr, float decr, float _lock_time)
 {
     if(self.lock_target && self.lock_target.deadflag != DEAD_NO)
@@ -144,7 +256,9 @@ 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 || trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+        if not (trace_ent.vehicle_flags & VHF_ISVEHICLE ||
+                               trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET ||
+                               trace_ent.takedamage == DAMAGE_TARGETDRONE)
             trace_ent = world;
     }
 
index 1c06048ce85db47d4b5cd7b3198b85cba681f89d..a3aa34de800b1f7bd599b6f3c88629687f6df3e7 100644 (file)
@@ -30,8 +30,8 @@ set g_vehicle_racer_anglestabilizer      1.75
 
 set g_vehicle_racer_turnspeed          200
 set g_vehicle_racer_pitchspeed         100
-set g_vehicle_racer_maxpitch           25
-set g_vehicle_racer_turnroll           32
+set g_vehicle_racer_maxpitch           20
+set g_vehicle_racer_turnroll           16
 
 set g_vehicle_racer_cannon_speed        9000
 set g_vehicle_racer_cannon_damage       25
@@ -43,18 +43,19 @@ set g_vehicle_racer_cannon_force        50
 
 set g_vehicle_racer_rocket_speed       1000
 set g_vehicle_racer_rocket_accel       1400
-set g_vehicle_racer_rocket_turnrate    0.2
+set g_vehicle_racer_rocket_turnrate    0.1
 set g_vehicle_racer_rocket_damage      165
 set g_vehicle_racer_rocket_force       350
 set g_vehicle_racer_rocket_radius      125
 set g_vehicle_racer_rocket_refire      6
 set g_vehicle_racer_rocket_cost        0
+set g_vehicle_racer_rocket_climbspeed  1750
 
 set g_vehicle_racer_rocket_locktarget           1
-set g_vehicle_racer_rocket_locking_time         0.5
-set g_vehicle_racer_rocket_locking_releasetime  1.6
+set g_vehicle_racer_rocket_locking_time         0.4
+set g_vehicle_racer_rocket_locking_releasetime  1.5
 set g_vehicle_racer_rocket_locked_time          5
-set g_vehicle_racer_rocket_locked_maxangle      1.46
+set g_vehicle_racer_rocket_locked_maxangle      1.75
 
 set g_vehicle_racer_blowup_radius           250
 set g_vehicle_racer_blowup_coredamage       250