]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/racer.qc
Remove .move_* fields and MOVETYPE_PUSH logic (doesn't work)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / racer.qc
index e212d312467498fe275df03e27a57a808a4389c8..cee5a6a0e55bc96b0b63d248cfd2f1e8a27f4c08 100644 (file)
@@ -186,7 +186,7 @@ bool racer_frame(entity this)
 
        traceline(vehic.origin, vehic.origin + '0 0 1', MOVE_NOMONSTERS, this);
        int cont = trace_dpstartcontents;
-       if(cont & DPCONTENTS_WATER)
+       if(!(cont & DPCONTENTS_WATER))
                vehic.air_finished = time + autocvar_g_vehicle_racer_water_time;
 
        if(IS_DEAD(vehic))
@@ -199,12 +199,6 @@ bool racer_frame(entity this)
 
        PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 
-       if(time >= vehic.vehicle_last_trace)
-       {
-               crosshair_trace(this);
-               vehic.vehicle_last_trace = time + autocvar_g_vehicle_racer_thinkrate;
-       }
-
        vehic.angles_x *= -1;
 
        // Yaw
@@ -332,15 +326,21 @@ bool racer_frame(entity this)
                crosshair_trace(this);
                w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
                .entity weaponentity = weaponentities[0];
-               WITHSELF(vehic, wep1.wr_think(wep1, vehic, weaponentity, 1));
+               wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
        if(autocvar_g_vehicle_racer_rocket_locktarget)
        {
-               if(vehic.vehicle_last_trace == time + autocvar_g_vehicle_racer_thinkrate)
-               vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
-                                                (1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
-                                                autocvar_g_vehicle_racer_rocket_locked_time);
+               if(time >= vehic.vehicle_last_trace)
+               {
+                       crosshair_trace(this);
+
+                       vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
+                                                        (1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
+                                                        autocvar_g_vehicle_racer_rocket_locked_time);
+
+                       vehic.vehicle_last_trace = time + autocvar_g_vehicle_racer_thinkrate;
+               }
 
                if(vehic.lock_target)
                {
@@ -362,14 +362,14 @@ bool racer_frame(entity this)
 
                if(vehic.misc_bulletcounter == 1)
                {
-                       racer_fire_rocket_aim(this, "tag_rocket_r", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+                       racer_fire_rocket_aim(this, "tag_rocket_r", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : NULL);
                        this.vehicle_ammo2 = 50;
                }
                else if(vehic.misc_bulletcounter == 2)
                {
-                       racer_fire_rocket_aim(this, "tag_rocket_l", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+                       racer_fire_rocket_aim(this, "tag_rocket_l", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : NULL);
                        vehic.lock_strength  = 0;
-                       vehic.lock_target       = world;
+                       vehic.lock_target       = NULL;
                        vehic.misc_bulletcounter = 0;
                        vehic.delay = time + autocvar_g_vehicle_racer_rocket_refire;
                        vehic.lip = time;
@@ -474,7 +474,7 @@ void racer_exit(entity this, int eject)
                setorigin(this.owner , spot);
        }
        antilag_clear(this.owner, CS(this.owner));
-       this.owner = world;
+       this.owner = NULL;
 }
 
 void racer_blowup(entity this)
@@ -484,9 +484,9 @@ void racer_blowup(entity this)
 
        RadiusDamage (this, this.enemy, autocvar_g_vehicle_racer_blowup_coredamage,
                                        autocvar_g_vehicle_racer_blowup_edgedamage,
-                                       autocvar_g_vehicle_racer_blowup_radius, world, world,
+                                       autocvar_g_vehicle_racer_blowup_radius, NULL, NULL,
                                        autocvar_g_vehicle_racer_blowup_forceintensity,
-                                       DEATH_VH_WAKI_DEATH.m_id, world);
+                                       DEATH_VH_WAKI_DEATH.m_id, NULL);
 
        this.nextthink  = time + autocvar_g_vehicle_racer_respawntime;
        setthink(this, vehicles_spawn);
@@ -511,7 +511,7 @@ void racer_blowup_think(entity this)
        CSQCMODEL_AUTOUPDATE(this);
 }
 
-void racer_deadtouch(entity this)
+void racer_deadtouch(entity this, entity toucher)
 {
        this.avelocity_x *= 0.7;
        this.cnt -= 1;
@@ -527,41 +527,6 @@ spawnfunc(vehicle_racer)
 
 #endif // SVQC
 
-#ifdef CSQC
-#if 0
-void racer_draw(entity this)
-{
-       float pushdeltatime = time - this.lastpushtime;
-       if (pushdeltatime > 0.15) pushdeltatime = 0;
-       this.lastpushtime = time;
-       if(!pushdeltatime) return;
-
-       tracebox(this.move_origin, this.mins, this.maxs, this.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, this);
-
-       vector df = this.move_velocity * -STAT(VEH_RACER_FRICTION);
-       df_z += (1 - trace_fraction) * STAT(VEH_RACER_HOVERPOWER) + sin(time * 2) * (STAT(VEH_RACER_SPRINGLENGTH) * 2);
-
-       float forced = STAT(VEH_RACER_UPFORCEDAMPER);
-
-       int cont = pointcontents(this.move_origin - '0 0 64');
-       if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
-       {
-               forced = STAT(VEH_RACER_WATER_UPFORCEDAMPER);
-               this.move_velocity_z += 200;
-       }
-
-       this.move_velocity += df * pushdeltatime;
-       if(this.move_velocity_z > 0)
-               this.move_velocity_z *= 1 - forced * pushdeltatime;
-
-       this.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
-       this.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
-
-       Movetype_Physics_MatchServer(this, false);
-}
-#endif
-#endif
-
 METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
@@ -625,7 +590,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
 METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
-    instance.SendEntity                = func_null; // stop networking this racer (for now)
+    setSendEntity(instance, func_null); // stop networking this racer (for now)
     instance.health                    = 0;
     instance.event_damage      = func_null;
     instance.solid                     = SOLID_CORPSE;