From a79c1b2b643db8bbcc9e8fd55daf60ff298001fa Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 7 Oct 2020 20:33:12 +1000 Subject: [PATCH] Implement a new design for the Arc secondary: electric orbs that can bounce (balance for bouncing is in the testing configuration) --- bal-wep-mario.cfg | 3 +++ bal-wep-nexuiz25.cfg | 3 +++ bal-wep-samual.cfg | 3 +++ bal-wep-xdf.cfg | 3 +++ bal-wep-xonotic.cfg | 3 +++ qcsrc/client/weapons/projectile.qc | 6 +++++- qcsrc/common/effects/all.inc | 3 +-- qcsrc/common/models/all.inc | 2 +- qcsrc/common/weapons/weapon/arc.qc | 27 +++++++++++++++++++++------ qcsrc/common/weapons/weapon/arc.qh | 3 +++ testing.cfg | 6 ++++-- 11 files changed, 50 insertions(+), 12 deletions(-) diff --git a/bal-wep-mario.cfg b/bal-wep-mario.cfg index 52dfc5f12..e4f2f84f9 100644 --- a/bal-wep-mario.cfg +++ b/bal-wep-mario.cfg @@ -763,6 +763,9 @@ set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.6 set g_balance_arc_bolt 1 set g_balance_arc_bolt_ammo 1 +set g_balance_arc_bolt_bounce_count 0 +set g_balance_arc_bolt_bounce_damage 0 +set g_balance_arc_bolt_bounce_lifetime 0 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 diff --git a/bal-wep-nexuiz25.cfg b/bal-wep-nexuiz25.cfg index 7bc8de485..779104e14 100644 --- a/bal-wep-nexuiz25.cfg +++ b/bal-wep-nexuiz25.cfg @@ -763,6 +763,9 @@ set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.5 set g_balance_arc_bolt 0 set g_balance_arc_bolt_ammo 1 +set g_balance_arc_bolt_bounce_count 0 +set g_balance_arc_bolt_bounce_damage 0 +set g_balance_arc_bolt_bounce_lifetime 0 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 diff --git a/bal-wep-samual.cfg b/bal-wep-samual.cfg index a89f48021..9df95a055 100644 --- a/bal-wep-samual.cfg +++ b/bal-wep-samual.cfg @@ -763,6 +763,9 @@ set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.5 set g_balance_arc_bolt 0 set g_balance_arc_bolt_ammo 1 +set g_balance_arc_bolt_bounce_count 0 +set g_balance_arc_bolt_bounce_damage 0 +set g_balance_arc_bolt_bounce_lifetime 0 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 diff --git a/bal-wep-xdf.cfg b/bal-wep-xdf.cfg index 007a36cf5..8b9155abc 100644 --- a/bal-wep-xdf.cfg +++ b/bal-wep-xdf.cfg @@ -763,6 +763,9 @@ set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.5 set g_balance_arc_bolt 1 set g_balance_arc_bolt_ammo 1 +set g_balance_arc_bolt_bounce_count 0 +set g_balance_arc_bolt_bounce_damage 0 +set g_balance_arc_bolt_bounce_lifetime 0 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index 2f7b598b7..12f108958 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -763,6 +763,9 @@ set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.6 set g_balance_arc_bolt 1 set g_balance_arc_bolt_ammo 1 +set g_balance_arc_bolt_bounce_count 0 +set g_balance_arc_bolt_bounce_damage 0 +set g_balance_arc_bolt_bounce_lifetime 0 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index cb5b4240c..9ed53e309 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -308,7 +308,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) HANDLE(GRENADE_BOUNCING) this.traileffect = EFFECT_TR_GRENADE.m_id; break; HANDLE(MINE) this.traileffect = EFFECT_TR_GRENADE.m_id; break; HANDLE(BLASTER) this.traileffect = EFFECT_Null.m_id; break; - HANDLE(ARC_BOLT) this.traileffect = EFFECT_Null.m_id; break; + HANDLE(ARC_BOLT) this.traileffect = EFFECT_TR_WIZSPIKE.m_id; break; HANDLE(HLAC) this.traileffect = EFFECT_Null.m_id; break; HANDLE(PORTO_RED) this.traileffect = EFFECT_TR_WIZSPIKE.m_id; this.scale = 4; break; HANDLE(PORTO_BLUE) this.traileffect = EFFECT_TR_WIZSPIKE.m_id; this.scale = 4; break; @@ -439,6 +439,10 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.mins = '-4 -4 -4'; this.maxs = '4 4 4'; break; + case PROJECTILE_ARC_BOLT: + set_movetype(this, MOVETYPE_BOUNCE); + settouch(this, func_null); + break; case PROJECTILE_RAPTORBOMB: this.mins = '-3 -3 -3'; this.maxs = '3 3 3'; diff --git a/qcsrc/common/effects/all.inc b/qcsrc/common/effects/all.inc index 019ae6139..e4a33c0d4 100644 --- a/qcsrc/common/effects/all.inc +++ b/qcsrc/common/effects/all.inc @@ -13,7 +13,7 @@ EFFECT(0, SMOKE_SMALL, "smoke_small") EFFECT(0, SMOKE_LARGE, "smoke_large") -EFFECT(0, ARC_MUZZLEFLASH, "arc_muzzleflash") +EFFECT(0, ARC_MUZZLEFLASH, "electro_muzzleflash") EFFECT(0, BLASTER_IMPACT, "laser_impact") EFFECT(0, BLASTER_MUZZLEFLASH, "laser_muzzleflash") @@ -25,7 +25,6 @@ EFFECT(0, ARC_BEAM, "arc_beam") EFFECT(0, ARC_BEAM_HEAL, "arc_beam_heal") EFFECT(0, ARC_BEAM_HEAL_IMPACT, "arc_beam_healimpact") EFFECT(0, ARC_BEAM_HEAL_IMPACT2, "healray_impact") -EFFECT(0, ARC_BOLT_EXPLODE, "arc_bolt_explode") EFFECT(0, ARC_OVERHEAT, "arc_overheat") EFFECT(0, ARC_OVERHEAT_FIRE, "arc_overheat_fire") EFFECT(0, ARC_SMOKE, "arc_smoke") diff --git a/qcsrc/common/models/all.inc b/qcsrc/common/models/all.inc index fe5c7b93d..c03de3091 100644 --- a/qcsrc/common/models/all.inc +++ b/qcsrc/common/models/all.inc @@ -88,7 +88,7 @@ MODEL(PROJECTILE_HOOKBOMB, "models/grenademodel.md3"); MODEL(PROJECTILE_HAGAR, "models/hagarmissile.mdl"); MODEL(PROJECTILE_HAGAR_BOUNCING, "models/hagarmissile.mdl"); -MODEL(PROJECTILE_ARC_BOLT, "models/arctrail.mdl"); +MODEL(PROJECTILE_ARC_BOLT, "models/ebomb.mdl"); // napalm grenade MODEL(PROJECTILE_NAPALM_FOUNTAIN, "null"); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 3af9a18da..f8bad1f2b 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -118,7 +118,20 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam void W_Arc_Bolt_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - this.use(this, NULL, toucher); + if(this.cnt > WEP_CVAR(arc, bolt_bounce_count) || !WEP_CVAR(arc, bolt_bounce_count) || toucher.takedamage == DAMAGE_AIM) { + this.use(this, NULL, toucher); + } else { + if(!this.cnt && WEP_CVAR(arc, bolt_bounce_lifetime)) + this.nextthink = min(this.nextthink, time + WEP_CVAR(arc, bolt_bounce_lifetime)); + this.cnt++; + Send_Effect(EFFECT_BALL_SPARKS, this.origin, this.velocity, 1); + this.angles = vectoangles(this.velocity); + this.owner = NULL; + // initial blast doesn't count as bounce damage! + if(WEP_CVAR(arc, bolt_bounce_damage)) + RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, this.weaponentity_fld, toucher); + this.projectiledeathtype |= HITTYPE_BOUNCE; + } } void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) @@ -127,7 +140,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) W_DecreaseAmmo(thiswep, actor, WEP_CVAR(arc, bolt_ammo), weaponentity); - W_SetupShot(actor, weaponentity, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), WEP_ARC.m_id | HITTYPE_SECONDARY); + W_SetupShot(actor, weaponentity, false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), thiswep.m_id | HITTYPE_SECONDARY); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -145,20 +158,22 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) IL_PUSH(g_damagedbycontents, missile); settouch(missile, W_Arc_Bolt_Touch); + missile.cnt = 0; missile.use = W_Arc_Bolt_Explode_use; setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime); PROJECTILE_MAKETRIGGER(missile); - missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY; + missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - set_movetype(missile, MOVETYPE_FLY); + set_movetype(missile, MOVETYPE_BOUNCEMISSILE); W_SetupProjVelocity_PRE(missile, arc, bolt_); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, missile); missile.missile_flags = MIF_SPLASH; CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true); @@ -761,8 +776,8 @@ METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor)) { vector org2; org2 = w_org + w_backoff * 6; - pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } + pointparticles(EFFECT_ELECTRO_IMPACT, org2, w_backoff * 1000, 1); + if(!w_issilent) { sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTN_NORM); } } } diff --git a/qcsrc/common/weapons/weapon/arc.qh b/qcsrc/common/weapons/weapon/arc.qh index 3c79dc335..8e56c10df 100644 --- a/qcsrc/common/weapons/weapon/arc.qh +++ b/qcsrc/common/weapons/weapon/arc.qh @@ -23,6 +23,9 @@ CLASS(Arc, Weapon) BEGIN(class) \ P(class, prefix, bolt, float, NONE) \ P(class, prefix, bolt_ammo, float, NONE) \ + P(class, prefix, bolt_bounce_count, float, NONE) \ + P(class, prefix, bolt_bounce_damage, float, NONE) \ + P(class, prefix, bolt_bounce_lifetime, float, NONE) \ P(class, prefix, bolt_damageforcescale, float, NONE) \ P(class, prefix, bolt_damage, float, NONE) \ P(class, prefix, bolt_edgedamage, float, NONE) \ diff --git a/testing.cfg b/testing.cfg index f000a084a..2eee874eb 100644 --- a/testing.cfg +++ b/testing.cfg @@ -6,10 +6,12 @@ alias test_crylink_sec_horizontal "settemp g_balance_crylink_secondary_linkexplo alias test_rocket_flying "settemp g_balance_devastator_remote_jump 1" +alias test_arc_bounce "settemp g_balance_arc_bolt_bounce_count 3 ; settemp g_balance_arc_bolt_bounce_lifetime 0.5 ; settemp g_balance_arc_bolt_bounce_damage 1 ; settemp g_balance_arc_bolt_ammo 2" + // https://forums.xonotic.org/showthread.php?tid=8192 // https://gitlab.com/xonotic/xonotic-data.pk3dir/merge_requests/736 alias test_ctf_stalemate90 "settemp g_ctf_stalemate_time 90" alias test_ctf_stalemate120 "settemp g_ctf_stalemate_time 120" -alias testing_enable "addvote test_blaster_switch ; addvote test_crylink_sec_horizontal ; addvote test_rocket_flying ; addvote test_ctf_stalemate90 ; addvote test_ctf_stalemate120" -alias testing_disable "delvote test_blaster_switch ; delvote test_crylink_sec_horizontal ; delvote test_rocket_flying ; delvote test_ctf_stalemate90 ; delvote test_ctf_stalemate120" +alias testing_enable "addvote test_blaster_switch ; addvote test_crylink_sec_horizontal ; addvote test_rocket_flying ; addvote test_ctf_stalemate90 ; addvote test_ctf_stalemate120 ; addvote test_arc_bounce" +alias testing_disable "delvote test_blaster_switch ; delvote test_crylink_sec_horizontal ; delvote test_rocket_flying ; delvote test_ctf_stalemate90 ; delvote test_ctf_stalemate120 ; delvote test_arc_bounce" -- 2.39.2