]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Correctly show particle fx and decal when a grenade stuck on the ceiling explodes...
authorterencehill <piuntn@gmail.com>
Fri, 2 Dec 2022 15:34:14 +0000 (16:34 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 2 Dec 2022 15:34:14 +0000 (16:34 +0100)
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/server/main.qh

index e122077b36d68c5d8f91ed12c449f931679ba2bb..97929c7dd3736ba0cf68514562ae32fc995954e0 100644 (file)
@@ -56,7 +56,7 @@ void W_Electro_ExplodeCombo(entity this)
        W_Electro_TriggerCombo(this.origin, WEP_CVAR(electro, combo_comboradius), this.realowner);
 
        this.event_damage = func_null;
-       this.velocity = this.movedir; // particle fx and decals need .velocity
+       this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
        RadiusDamage(
                this,
@@ -86,7 +86,7 @@ void W_Electro_Explode(entity this, entity directhitentity)
 
        this.event_damage = func_null;
        this.takedamage = DAMAGE_NO;
-       this.velocity = this.movedir; // particle fx and decals need .velocity
+       this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
        if(this.move_movetype == MOVETYPE_BOUNCE || this.classname == "electro_orb") // TODO: classname is more reliable anyway?
        {
index 9ab5533f1c0e4ea9e33ea06b4acaa416ea8feb6d..b1ccb1b05bfd9656c4ce4438aeded71397b7463f 100644 (file)
@@ -92,7 +92,7 @@ void W_MineLayer_DoRemoteExplode(entity this)
        this.takedamage = DAMAGE_NO;
 
        if(this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FOLLOW)
-               this.velocity = this.movedir; // particle fx and decals need .velocity
+               this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
        RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius),
                                                NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL);
index a1264748f3204cf4a90ce357d967b539dbea94ee..52b8a571a51eb34e0265bf7fb52a3d0676e57a57 100644 (file)
@@ -15,7 +15,7 @@ void W_Mortar_Grenade_Explode(entity this, entity directhitentity)
        this.takedamage = DAMAGE_NO;
 
        if(this.move_movetype == MOVETYPE_NONE)
-               this.velocity = this.oldvelocity;
+               this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
        RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
 
@@ -40,7 +40,7 @@ void W_Mortar_Grenade_Explode2(entity this, entity directhitentity)
        this.takedamage = DAMAGE_NO;
 
        if(this.move_movetype == MOVETYPE_NONE)
-               this.velocity = this.oldvelocity;
+               this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
        RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
 
@@ -98,7 +98,7 @@ void W_Mortar_Grenade_Touch1(entity this, entity toucher)
                spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM);
 
                // let it stick whereever it is
-               this.oldvelocity = this.velocity;
+               this.movedir = this.velocity; // save to this temporary field, will be restored on explosion
                this.velocity = '0 0 0';
                set_movetype(this, MOVETYPE_NONE); // also disables gravity
                this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO
@@ -134,7 +134,7 @@ void W_Mortar_Grenade_Touch2(entity this, entity toucher)
                spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM);
 
                // let it stick whereever it is
-               this.oldvelocity = this.velocity;
+               this.movedir = this.velocity; // save to this temporary field, will be restored on explosion
                this.velocity = '0 0 0';
                set_movetype(this, MOVETYPE_NONE); // also disables gravity
                this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO
index 40e708e86304b616a8422978689f5c29ace32d41..ed095ba485ec56a78b603a59b9919d2e12875adf 100644 (file)
@@ -35,7 +35,8 @@ float client_cefc_accumulatortime;
 
 float servertime, serverprevtime, serverframetime;
 
-.vector oldvelocity; // for fall damage
+// set in CreatureFrame_All for entities that can be damaged by fall (players) and contents (projectiles)
+.vector oldvelocity;
 
 .float watersound_finished;