]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Enhance some functions for vehicles
authorLegendaryGuard <rootuser999@gmail.com>
Sat, 20 Aug 2022 21:06:26 +0000 (23:06 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Sat, 20 Aug 2022 21:06:26 +0000 (23:06 +0200)
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle/raptor.qc

index 752391030e41d2008b48d29fbcf757c23626d0a6..c96595533a3a5594c07de6b6b962e41df083ff7b 100644 (file)
@@ -374,6 +374,35 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string
        return vtag;
 }
 
+void vehicles_remove(entity this)
+{
+       Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
+       info.vr_death(info, this);
+
+       // to avoid weird entity assignments to other stuff like projectiles
+       this.active = ACTIVE_NOT;
+       vehicles_reset(this);
+       this.classname = "";
+
+       this.tur_head.exteriormodeltoclient = NULL;
+
+       CSQCModel_UnlinkEntity(this);
+
+       delete(this.wp00);
+       delete(this.gun1);
+       delete(this.gun2);
+       delete(this.gun3);
+       delete(this.gunner1);
+       delete(this.gunner2);
+       delete(this.vehicle_viewport);
+       delete(this.vehicle_controller);
+       delete(this.vehicle_shieldent);
+       delete(this.vehicle_hudmodel);
+       delete(this.tur_head);
+       delete(this.vehicle);
+       delete(this);
+}
+
 void vehicles_reset_colors(entity this, entity player)
 {
        int eff = 0, cmap;
@@ -521,12 +550,19 @@ void vehicles_setreturn(entity veh)
        {
                if (veh.cannot_respawn)
                {
+                       RadiusDamage (veh, veh.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_CRUSH.m_id, DMG_NOWEP, NULL);
                        sound (veh, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
                        Send_Effect(EFFECT_EXPLOSION_BIG, veh.origin + '0 0 100', '0 0 0', 1);
 
                        tmp_vehcount--;
 
-                       delete(veh);
+                       vehicles_clearreturn(ret);
+
+                       antilag_clear(veh, veh);
+                       
+                       vehicles_remove(veh);
+                       delete(ret);
+
                        return;
                }
                ret.cnt          = time + veh.respawntime;
@@ -1117,13 +1153,11 @@ void vehicles_think(entity this)
                Send_Effect(EFFECT_TELEPORT, this.origin + '0 0 100', '0 0 0', 1);
 
                tmp_vehcount--;
+               
+               antilag_clear(this, this);
+               
+               vehicles_remove(this);
 
-               // to avoid weird entity assignments to other stuff like projectiles
-               delete(this.vehicle_shieldent);
-               delete(this.vehicle_hudmodel);
-               delete(this.tur_head);
-               delete(this.vehicle);
-               delete(this);
                return;
        }
 
index b59550fa7dc2d1bb8bb18a87811a99e2f1b2a573..1a0d6b5600b12f58e78d4bc89a71fb802c80eb46 100644 (file)
@@ -117,6 +117,8 @@ bool vehicle_initialize(entity this, Vehicle info, float nodrop);
 bool vehicle_impulse(entity this, int imp);
 bool vehicles_crushable(entity e);
 void vehicles_enter(entity pl, entity veh);
+void vehicles_reset(entity this);
+void vehicles_remove(entity this);
 
 IntrusiveList g_vehicle_returners;
 STATIC_INIT(g_vehicle_returners) { g_vehicle_returners = IL_NEW(); }
index da2c1da0be446d6e214f4d867753534dc3fdcc26..35588bcd8e8afbd5bee38aa2ed162ff5e2b57c4e 100644 (file)
@@ -615,6 +615,7 @@ METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
 }
 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
 {
+       CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
        SetResourceExplicit(instance, RES_HEALTH, 0);
     instance.event_damage              = func_null;
     instance.solid                             = SOLID_CORPSE;