From c9ac4349ca8700fd165601639962e4ff8041f7eb Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 29 Jan 2022 20:48:41 +0100 Subject: [PATCH] Use only one field instead of 3 to calculate rocketminsta attack damage --- qcsrc/common/weapons/weapon/vaporizer.qc | 22 +++++++++++++--------- qcsrc/common/weapons/weapon/vaporizer.qh | 4 +--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 2a0dd7cef..0059e92ed 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -148,7 +148,15 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) W_DecreaseAmmo(thiswep, actor, ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); } -void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) +void W_RocketMinsta_Laser_Damage(entity this, entity directhitentity) +{ + int laser_count = max(1, this.rm_laser_count); + float laser_force = autocvar_g_rm_laser_force / laser_count; + float laser_damage = autocvar_g_rm_laser_damage / laser_count; + RadiusDamage(this, this.realowner, laser_damage, laser_damage, autocvar_g_rm_laser_radius, NULL, NULL, laser_force, this.projectiledeathtype, this.weaponentity_fld, directhitentity); +} + +void W_RocketMinsta_Laser_Explode(entity this, entity directhitentity) { if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) @@ -159,7 +167,7 @@ void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, this.weaponentity_fld, directhitentity); + W_RocketMinsta_Laser_Damage(this, directhitentity); delete(this); } @@ -172,7 +180,7 @@ void W_RocketMinsta_Laser_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); //W_RocketMinsta_Laser_Explode (); - RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, this.weaponentity_fld, toucher); + W_RocketMinsta_Laser_Damage(this, toucher); delete(this); } @@ -205,9 +213,7 @@ void W_RocketMinsta_Attack2(entity actor, .entity weaponentity) proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); - proj.rm_force = autocvar_g_rm_laser_force / total; - proj.rm_damage = autocvar_g_rm_laser_damage / total; - proj.rm_edmg = proj.rm_damage; + proj.rm_laser_count = total; //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed); @@ -258,9 +264,7 @@ void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity) proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); - proj.rm_force = autocvar_g_rm_laser_force / total; - proj.rm_damage = autocvar_g_rm_laser_damage / total; - proj.rm_edmg = proj.rm_damage; + proj.rm_laser_count = total; //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index c34062a6b..277557e9c 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -63,7 +63,5 @@ SPAWNFUNC_WEAPON(weapon_minstanex, WEP_VAPORIZER) .float jump_interval; .float jump_interval2; .bool held_down; -.float rm_force; -.float rm_damage; -.float rm_edmg; +.int rm_laser_count; #endif -- 2.39.2