X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=46e46c24059660e8fd3b30b7ffe37da13d704d9d;hp=b5ee5305d05c1d55e473e76fb5972f1865bfa79f;hb=64f2b309aa5be8aafb9ad2137174bb6d99aeb876;hpb=931d24d4337e58557fa82a68aa8a740e523c2f22 diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index b5ee5305d..46e46c240 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -332,6 +332,7 @@ void W_Electro_Orb_Stick(entity this, entity to) newproj.event_damage = this.event_damage; newproj.spawnshieldtime = this.spawnshieldtime; newproj.damagedbycontents = true; + IL_PUSH(g_damagedbycontents, newproj); set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place newproj.projectiledeathtype = this.projectiledeathtype; @@ -453,6 +454,8 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) IL_PUSH(g_projectiles, proj); IL_PUSH(g_bot_dodge, proj); proj.damagedbycontents = (WEP_CVAR_SEC(electro, damagedbycontents)); + if(proj.damagedbycontents) + IL_PUSH(g_damagedbycontents, proj); proj.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor); proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop); @@ -473,12 +476,12 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - if(actor.electro_count > 1) + if(actor.(weaponentity).electro_count > 1) if(PHYS_INPUT_BUTTON_ATCK2(actor)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { W_Electro_Attack_Orb(WEP_ELECTRO, actor, weaponentity); - actor.electro_count -= 1; + actor.(weaponentity).electro_count -= 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); return; } @@ -488,7 +491,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i .float bot_secondary_electromooth; -METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) +METHOD(Electro, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { PHYS_INPUT_BUTTON_ATCK(actor) = PHYS_INPUT_BUTTON_ATCK2(actor) = false; if(vdist(actor.origin - actor.enemy.origin, >, 1000)) { actor.bot_secondary_electromooth = 0; } @@ -497,9 +500,9 @@ METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) float shoot; if(WEP_CVAR_PRI(electro, speed)) - shoot = bot_aim(actor, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); + shoot = bot_aim(actor, weaponentity, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); else - shoot = bot_aim(actor, 1000000, 0, 0.001, false); + shoot = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false); if(shoot) { @@ -509,7 +512,7 @@ METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) } else { - if(bot_aim(actor, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) + if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) { PHYS_INPUT_BUTTON_ATCK2(actor) = true; if(random() < 0.03) actor.bot_secondary_electromooth = 0; @@ -521,9 +524,9 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO { float ammo_amount = 0; - if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo)) + if(actor.(weaponentity).clip_load >= WEP_CVAR_PRI(electro, ammo)) ammo_amount = 1; - if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo)) + if(actor.(weaponentity).clip_load >= WEP_CVAR_SEC(electro, ammo)) ammo_amount += 1; if(!ammo_amount) @@ -543,40 +546,44 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit } else if(fire & 2) { - if(time >= actor.electro_secondarytime) + if(time >= actor.(weaponentity).electro_secondarytime) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire))) { W_Electro_Attack_Orb(thiswep, actor, weaponentity); - actor.electro_count = WEP_CVAR_SEC(electro, count); + actor.(weaponentity).electro_count = WEP_CVAR_SEC(electro, count); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); - actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor); + actor.(weaponentity).electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor); } } } -METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor)) +METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo); - ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo); return ammo_amount; } -METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor)) +METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false. { ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); - ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); } else { ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo); - ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo); } return ammo_amount; } METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor)) { - actor.electro_secondarytime = time; + 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)) {