X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=d80703175983b87eb0c046ffa68e42276aad0d4e;hb=911002fa7534117d5f02813a905e2736475b3eee;hp=4a6ee87d5cc16ac5bb008897ba88007994da9813;hpb=a62d4caad165c63856096d8d4eb0f41b0d1552a4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 4a6ee87d5..d80703175 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -312,7 +312,11 @@ void W_Electro_Orb_Stick(entity this, entity to) newproj.weaponentity_fld = this.weaponentity_fld; settouch(newproj, func_null); - newproj.death_time = this.death_time; + if(WEP_CVAR_SEC(electro, stick_lifetime) > 0){ + newproj.death_time = time + WEP_CVAR_SEC(electro, stick_lifetime); + }else{ + newproj.death_time = this.death_time; + } newproj.use = this.use; newproj.flags = this.flags; IL_PUSH(g_projectiles, newproj); @@ -351,8 +355,13 @@ void W_Electro_Orb_Touch(entity this, entity toucher) spamsound(this, CH_SHOTS, SND_ELECTRO_BOUNCE, VOL_BASE, ATTEN_NORM); this.projectiledeathtype |= HITTYPE_BOUNCE; - if(WEP_CVAR_SEC(electro, stick)) - W_Electro_Orb_Stick(this, toucher); + if(WEP_CVAR_SEC(electro, stick)){ + if(WEP_CVAR_SEC(electro, stick_lifetime) == 0){ + W_Electro_Explode(this, toucher); + } else { + W_Electro_Orb_Stick(this, toucher); + } + } } } @@ -468,10 +477,10 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i { W_Electro_Attack_Orb(thiswep, actor, weaponentity); actor.(weaponentity).electro_count -= 1; + actor.(weaponentity).electro_secondarytime = time; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); return; } - // WEAPONTODO: when the player releases the button, cut down the length of refire2? w_ready(thiswep, actor, weaponentity, fire); } @@ -524,21 +533,22 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(fire & 1) { + if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor)) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { - W_Electro_Attack_Bolt(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + W_Electro_Attack_Bolt(thiswep, actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } } else if(fire & 2) { - if(time >= actor.(weaponentity).electro_secondarytime) - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire))) + if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(electro, refire) * W_WeaponRateFactor(actor)) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { W_Electro_Attack_Orb(thiswep, actor, weaponentity); actor.(weaponentity).electro_count = WEP_CVAR_SEC(electro, count); + actor.(weaponentity).electro_secondarytime = time; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); - actor.(weaponentity).electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor); } } } @@ -563,14 +573,6 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon } return ammo_amount; } -METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor)) -{ - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - actor.(weaponentity).electro_secondarytime = time; - } -} METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);