]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/arc_bolt_bounce
authorMario <mario.mario@y7mail.com>
Sun, 1 Nov 2020 05:55:56 +0000 (15:55 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 1 Nov 2020 05:55:56 +0000 (15:55 +1000)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/client/weapons/projectile.qc
qcsrc/common/effects/all.inc
qcsrc/common/models/all.inc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/arc.qh
testing.cfg

index 52dfc5f12ca507fcf15c621d2c24514468572dff..640ce27209e6a0ea53af3d7cdf6a3afb2f5dad8b 100644 (file)
@@ -763,6 +763,10 @@ 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_explode 0
+set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -771,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index 7bc8de485d6c5943c0b4c965cd4406909a246f79..1cbfe88e9801504a1c1daa8e1880e2f68408003b 100644 (file)
@@ -763,6 +763,10 @@ 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_explode 0
+set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -771,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2200
 set g_balance_arc_bolt_spread 0.03
 set g_balance_arc_burst_ammo 15
index a89f480215ae56c7d4abf98be80d6a7302dd6b08..055afcc2a38c299a254f8de33b9a619ae2e12423 100644 (file)
@@ -763,6 +763,10 @@ 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_explode 0
+set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -771,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2200
 set g_balance_arc_bolt_spread 0.03
 set g_balance_arc_burst_ammo 0
index 007a36cf56e217c29d8fa749dbcf166f8bcbe29c..a1fea0c38726e2dd3042ecabcdeca6ad491b4b73 100644 (file)
@@ -763,6 +763,10 @@ 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_explode 0
+set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -771,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.033333
+set g_balance_arc_bolt_refire2 0.03333
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index 2f7b598b739e6d4664c284c7468fc23d36f11e8a..647fb2290727424f03e92d624da2c5787724649e 100644 (file)
@@ -763,6 +763,10 @@ 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_explode 0
+set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -771,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index 3fe6deb78fb77c8c98c9bd33bc27eb9e7c2e37d6..4e457dabab9bcf24f2dbe4338b29d9e8c0e5e6bc 100644 (file)
@@ -302,7 +302,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;
@@ -433,6 +433,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';
index 019ae6139cd8ce909ad05c5dd832d776240ca918..60f33f38ec4a5dfbc9e4bb1c500011a8685ae47b 100644 (file)
@@ -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,8 @@ 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")
+// TODO: effect needs updating
+//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")
index fe5c7b93d47ac40803901a18c847c4fa45b3e389..5107a5cc8d2f78f1a7c2d7d46989b411dbfb6825 100644 (file)
@@ -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"); // TODO: remove models/arctrail.mdl right before 0.8.3 release!
 
 // napalm grenade
 MODEL(PROJECTILE_NAPALM_FOUNTAIN,       "null");
index 848825f147dc7b6d4bcd860dd9e5f55f5a4fe33f..4b159019e62acdcad320c8b84262dd6130bd0b34 100644 (file)
@@ -118,20 +118,28 @@ 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 {
+               this.cnt++;
+               Send_Effect(EFFECT_BALL_SPARKS, this.origin, this.velocity, 1);
+               this.angles = vectoangles(this.velocity);
+               this.owner = NULL;
+               this.projectiledeathtype |= HITTYPE_BOUNCE;
+               if(WEP_CVAR(arc, bolt_bounce_explode))
+                       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);
+               if(this.cnt == 1 && WEP_CVAR(arc, bolt_bounce_lifetime))
+                       this.nextthink = time + WEP_CVAR(arc, bolt_bounce_lifetime);
+       }
 }
 
-void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
+void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       entity missile;
-
-       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);
 
-       missile = new(missile);
+       entity missile = new(missile);
        missile.owner = missile.realowner = actor;
        missile.bot_dodge = true;
        IL_PUSH(g_bot_dodge, missile);
@@ -145,25 +153,38 @@ 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);
 
        MUTATOR_CALLHOOK(EditProjectile, actor, missile);
+
+       actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+       if(actor.(weaponentity).misc_bulletcounter == 0)
+       {
+               ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(arc, bolt_refire2) * W_WeaponRateFactor(actor);
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+       }
+       else
+       {
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), W_Arc_Attack_Bolt);
+       }
 }
 
 void W_Arc_Beam_Think(entity this)
@@ -659,10 +680,28 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     }
     else if(fire & 2)
     {
-        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(arc, bolt_refire)))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
-            W_Arc_Attack_Bolt(thiswep, actor, weaponentity);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+               if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
+            if(!(actor.items & IT_UNLIMITED_AMMO))
+            {
+                W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+                w_ready(thiswep, actor, weaponentity, fire);
+                return;
+            }
+            float ammo_available = GetResource(actor, thiswep.ammo_type);
+            // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction.
+            // Also keep the fraction <= 1 otherwise we'd mag dump in one burst.
+            float burst_fraction = min(1, ammo_available / WEP_CVAR(arc, bolt_ammo));
+            int to_shoot = floor(WEP_CVAR(arc, bolt_count) * burst_fraction);
+
+            // We also don't want to use 3 rounds if there's only 2 left.
+            int to_use = min(WEP_CVAR(arc, bolt_ammo), ammo_available);
+            W_DecreaseAmmo(thiswep, actor, to_use, weaponentity);
+
+            // Bursting counts up to 0 from a negative.
+            actor.(weaponentity).misc_bulletcounter = -to_shoot;
+            W_Arc_Attack_Bolt(thiswep, actor, weaponentity, fire);
         }
     }
 
@@ -764,8 +803,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); }
     }
 }
 
index 3c79dc3350454903337952aee4b6c5ed8a8d1b9f..6db349889b80599587eb7a0b0e59333ba2de6668 100644 (file)
@@ -23,6 +23,10 @@ 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_explode, float, NONE) \
+        P(class, prefix, bolt_bounce_lifetime, float, NONE) \
+        P(class, prefix, bolt_count, float, NONE) \
         P(class, prefix, bolt_damageforcescale, float, NONE) \
         P(class, prefix, bolt_damage, float, NONE) \
         P(class, prefix, bolt_edgedamage, float, NONE) \
@@ -31,6 +35,7 @@ CLASS(Arc, Weapon)
         P(class, prefix, bolt_lifetime, float, NONE) \
         P(class, prefix, bolt_radius, float, NONE) \
         P(class, prefix, bolt_refire, float, NONE) \
+        P(class, prefix, bolt_refire2, float, NONE) \
         P(class, prefix, bolt_speed, float, NONE) \
         P(class, prefix, bolt_spread, float, NONE) \
                P(class, prefix, beam_ammo, float, NONE) \
index f000a084aacbe22fa29ceee679c29ee679947323..e52012cedec6f533212fd97a51fc92872d253c67 100644 (file)
@@ -6,10 +6,13 @@ 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 1 ; settemp g_balance_arc_bolt_bounce_lifetime 0.5 ; settemp g_balance_arc_bolt_bounce_explode 1 ; settemp g_balance_arc_bolt_ammo 2"
+alias test_arc_bounce_burst "settemp g_balance_arc_bolt_bounce_count 1 ; settemp g_balance_arc_bolt_bounce_lifetime 0.5 ; settemp g_balance_arc_bolt_bounce_explode 1 ; settemp g_balance_arc_bolt_ammo 3 ; settemp g_balance_arc_bolt_refire2 0.33333 ; settemp g_balance_arc_bolt_count 3"
+
 // 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 ; addvote test_arc_bounce_burst"
+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 ; delvote test_arc_bounce_burst"