From 1f5d103082694778f5a4c42fee2128c8f04e38a0 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 18 Dec 2014 21:23:00 +1100 Subject: [PATCH] Fix some bugs with nades, allow lasering a nade around --- effectinfo.txt | 14 +++++++------- qcsrc/client/weapons/projectile.qc | 12 +++++++----- qcsrc/server/miscfunctions.qc | 6 ++++-- qcsrc/server/mutators/mutator_nades.qc | 25 ++++++++++++++++++++----- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/effectinfo.txt b/effectinfo.txt index c79e2d6d0..ea5b3f731 100644 --- a/effectinfo.txt +++ b/effectinfo.txt @@ -8110,7 +8110,7 @@ bounce 1.5 liquidfriction 4 velocityjitter 16 16 16 -effect nade +effect nade_neutral trailspacing 1 type smoke color 0xFFFFFF 0xFFFFFF @@ -8120,7 +8120,7 @@ sizeincrease -1 alpha 100 100 250 //gravity -0.11 // fire -effect nade +effect nade_neutral notunderwater trailspacing 8 type smoke @@ -8130,7 +8130,7 @@ size 15 25 sizeincrease -10 alpha 30 30 150 // bubbles -effect nade +effect nade_neutral underwater trailspacing 16 type bubble @@ -8307,7 +8307,7 @@ tex 33 33 size 25 25 sizeincrease -30 -effect nade_burn +effect nade_neutral_burn trailspacing 1 type smoke color 0xFFFFFF 0xFFFFFF @@ -8317,7 +8317,7 @@ sizeincrease -1 alpha 100 100 250 //gravity -0.11 // fire -effect nade_burn +effect nade_neutral_burn notunderwater trailspacing 64 type smoke @@ -8327,7 +8327,7 @@ size 45 25 sizeincrease -30 alpha 200 200 1000 // bubbles -effect nade_burn +effect nade_neutral_burn underwater trailspacing 16 type bubble @@ -8339,7 +8339,7 @@ gravity -0.125 bounce 1.5 liquidfriction 4 velocityjitter 16 16 16 -effect nade_burn +effect nade_neutral_burn trailspacing 16 type smoke color 0xFFFFFF 0xFFFFFF diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index fe047e390..e019b6755 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -444,17 +444,19 @@ void Ent_Projectile() if(Nade_IDFromProjectile(self.cnt) != 0) { + float nade_type = Nade_IDFromProjectile(self.cnt); self.mins = '-16 -16 -16'; self.maxs = '16 16 16'; - self.colormod = Nade_Color(Nade_IDFromProjectile(self.cnt)); - self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; + self.colormod = Nade_Color(nade_type); self.move_movetype = MOVETYPE_BOUNCE; self.move_touch = func_null; self.scale = 1.5; self.avelocity = randomvec() * 720; - - if(Nade_IDFromProjectile(self.cnt) == NADE_TYPE_TRANSLOCATE) - self.solid = SOLID_TRIGGER; + + if(nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN) + self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; + else + self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; } setsize(self, self.mins, self.maxs); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 5f6b6a9dd..9090f6922 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1762,14 +1762,16 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback() return TRUE; if(SUB_NoImpactCheck()) { - if(self.classname == "grapplinghook") + if(self.classname == "nade") + return FALSE; // no checks here + else if(self.classname == "grapplinghook") RemoveGrapplingHook(self.realowner); else if(self.classname == "spike") { W_Crylink_Dequeue(self); remove(self); } - else if(self.classname != "nade") // nade handles itself manually + else remove(self); return TRUE; } diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 47eb24875..b5e155998 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -526,6 +526,8 @@ void nade_boom() sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + self.event_damage = func_null; // prevent somehow calling damage in the next call + if(nade_blast) { RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, @@ -533,7 +535,7 @@ void nade_boom() Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self); } - if(self.health != -1337) + if(self.takedamage) switch ( self.nade_type ) { case NADE_TYPE_NAPALM: nade_napalm_boom(); break; @@ -549,7 +551,12 @@ void nade_boom() void nade_touch() { - if(ITEM_TOUCH_NEEDKILL()) + float is_weapclip = 0; + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) + if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) + if (!(trace_dphitcontents & DPCONTENTS_OPAQUE)) + is_weapclip = 1; + if(ITEM_TOUCH_NEEDKILL() || is_weapclip) { remove(self); return; @@ -580,7 +587,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp { if(ITEM_DAMAGE_NEEDKILL(deathtype)) { - self.health = -1337; // hack + self.takedamage = DAMAGE_NO; nade_boom(); return; } @@ -589,7 +596,10 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp return; if(DEATH_ISWEAPON(deathtype, WEP_BLASTER) || (DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) && (deathtype & HITTYPE_SECONDARY))) - return; + { + force *= 1.5; + damage = 0; + } if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) { @@ -610,6 +620,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp damage = self.max_health * 1.15; self.velocity += force; + UpdateCSQCProjectile(self); if(damage <= 0 || ((self.flags & FL_ONGROUND) && IS_PLAYER(attacker))) return; @@ -676,7 +687,6 @@ void toss_nade(entity e, vector _velocity, float _time) _nade.event_damage = nade_damage; _nade.customizeentityforclient = func_null; _nade.exteriormodeltoclient = world; - _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; _nade.traileffectnum = 0; _nade.teleportable = TRUE; _nade.pushable = TRUE; @@ -689,6 +699,11 @@ void toss_nade(entity e, vector _velocity, float _time) _nade.toss_time = time; _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX); + if(_nade.nade_type == NADE_TYPE_TRANSLOCATE || _nade.nade_type == NADE_TYPE_SPAWN) + _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; + else + _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; + nade_spawn(_nade); if(_time) -- 2.39.2