X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=2276b6042ac1f45893aa0d2451c6d3b43f1f9ee5;hp=0e8d272e070e9a03b3a5225202d3cc135da8038a;hb=9e8ea75b9aacffc5cfa18c8852c4dd9ffdbd3192;hpb=d492869ab1f18e05121529b7bcffcb637d13994c diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 0e8d272e07..2276b6042a 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -1,81 +1,6 @@ #include "electro.qh" -#ifndef IMPLEMENTATION -CLASS(Electro, Weapon) -/* ammotype */ ATTRIB(Electro, ammo_field, .int, ammo_cells); -/* impulse */ ATTRIB(Electro, impulse, int, 5); -/* flags */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH); -/* rating */ ATTRIB(Electro, bot_pickupbasevalue, float, 5000); -/* color */ ATTRIB(Electro, wpcolor, vector, '0 0.5 1'); -/* modelname */ ATTRIB(Electro, mdl, string, "electro"); -#ifdef GAMEQC -/* model */ ATTRIB(Electro, m_model, Model, MDL_ELECTRO_ITEM); -#endif -/* crosshair */ ATTRIB(Electro, w_crosshair, string, "gfx/crosshairelectro"); -/* crosshair */ ATTRIB(Electro, w_crosshair_size, float, 0.6); -/* wepimg */ ATTRIB(Electro, model2, string, "weaponelectro"); -/* refname */ ATTRIB(Electro, netname, string, "electro"); -/* wepname */ ATTRIB(Electro, m_name, string, _("Electro")); - -#define X(BEGIN, P, END, class, prefix) \ - BEGIN(class) \ - P(class, prefix, ammo, float, BOTH) \ - P(class, prefix, animtime, float, BOTH) \ - P(class, prefix, bouncefactor, float, SEC) \ - P(class, prefix, bouncestop, float, SEC) \ - P(class, prefix, comboradius, float, PRI) \ - P(class, prefix, combo_comboradius, float, NONE) \ - P(class, prefix, combo_comboradius_thruwall, float, NONE) \ - P(class, prefix, combo_damage, float, NONE) \ - P(class, prefix, combo_edgedamage, float, NONE) \ - P(class, prefix, combo_force, float, NONE) \ - P(class, prefix, combo_radius, float, NONE) \ - P(class, prefix, combo_safeammocheck, float, NONE) \ - P(class, prefix, combo_speed, float, NONE) \ - P(class, prefix, count, float, SEC) \ - P(class, prefix, damagedbycontents, float, SEC) \ - P(class, prefix, damageforcescale, float, SEC) \ - P(class, prefix, damage, float, BOTH) \ - P(class, prefix, edgedamage, float, BOTH) \ - P(class, prefix, force, float, BOTH) \ - P(class, prefix, health, float, SEC) \ - P(class, prefix, lifetime, float, BOTH) \ - P(class, prefix, midaircombo_explode, float, PRI) \ - P(class, prefix, midaircombo_interval, float, PRI) \ - P(class, prefix, midaircombo_radius, float, PRI) \ - P(class, prefix, radius, float, BOTH) \ - P(class, prefix, refire2, float, SEC) \ - P(class, prefix, refire, float, BOTH) \ - P(class, prefix, reload_ammo, float, NONE) \ - P(class, prefix, reload_time, float, NONE) \ - P(class, prefix, speed, float, BOTH) \ - P(class, prefix, speed_up, float, SEC) \ - P(class, prefix, speed_z, float, SEC) \ - P(class, prefix, spread, float, BOTH) \ - P(class, prefix, stick, float, SEC) \ - P(class, prefix, switchdelay_drop, float, NONE) \ - P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, touchexplode, float, SEC) \ - P(class, prefix, weaponreplace, string,NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ - END() - W_PROPS(X, Electro, electro) -#undef X - -ENDCLASS(Electro) -REGISTER_WEAPON(ELECTRO, electro, NEW(Electro)); - #ifdef SVQC -.float electro_count; -.float electro_secondarytime; -void W_Electro_ExplodeCombo(entity this); -#endif -#endif -#ifdef IMPLEMENTATION -#ifdef SVQC -spawnfunc(weapon_electro) { weapon_defaultspawnfunc(this, WEP_ELECTRO); } void W_Electro_TriggerCombo(vector org, float rad, entity own) { @@ -140,6 +65,7 @@ void W_Electro_ExplodeCombo(entity this) NULL, WEP_CVAR(electro, combo_force), WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce + this.weaponentity_fld, NULL ); @@ -170,6 +96,7 @@ void W_Electro_Explode(entity this, entity directhitentity) NULL, WEP_CVAR_SEC(electro, force), this.projectiledeathtype, + this.weaponentity_fld, directhitentity ); } @@ -186,6 +113,7 @@ void W_Electro_Explode(entity this, entity directhitentity) NULL, WEP_CVAR_PRI(electro, force), this.projectiledeathtype, + this.weaponentity_fld, directhitentity ); } @@ -276,7 +204,8 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) 2, SND_ELECTRO_FIRE, CH_WEAPON_A, - WEP_CVAR_PRI(electro, damage) + WEP_CVAR_PRI(electro, damage), + WEP_ELECTRO.m_id ); Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -291,6 +220,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) proj.ltime = time + WEP_CVAR_PRI(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); // if (IS_CSQC) @@ -336,6 +266,7 @@ void W_Electro_Orb_Stick(entity this, entity to) set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place newproj.projectiledeathtype = this.projectiledeathtype; + newproj.weaponentity_fld = this.weaponentity_fld; settouch(newproj, func_null); setthink(newproj, getthink(this)); @@ -356,10 +287,10 @@ void W_Electro_Orb_Touch(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); if(toucher.takedamage == DAMAGE_AIM) { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this, toucher); } } - else + else if(toucher.owner != this.owner && toucher.classname != this.classname) // don't stick to player's other projectiles! { //UpdateCSQCProjectile(this); - spamsound(this, CH_SHOTS, SND(ELECTRO_BOUNCE), VOL_BASE, ATTEN_NORM); + spamsound(this, CH_SHOTS, SND_ELECTRO_BOUNCE, VOL_BASE, ATTEN_NORM); this.projectiledeathtype |= HITTYPE_BOUNCE; if(WEP_CVAR_SEC(electro, stick)) @@ -367,7 +298,7 @@ void W_Electro_Orb_Touch(entity this, entity toucher) } } -void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -422,7 +353,8 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, - WEP_CVAR_SEC(electro, damage) + WEP_CVAR_SEC(electro, damage), + WEP_ELECTRO.m_id | HITTYPE_SECONDARY ); w_shotdir = v_forward; // no TrueAim for grenades please @@ -438,6 +370,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_SECONDARY; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); //proj.glow_size = 50; @@ -558,7 +491,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit } METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo); + float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo); ammo_amount += actor.(weaponentity).(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo); return ammo_amount; } @@ -567,12 +500,12 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon 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 = GetResourceAmount(actor, thiswep.ammo_type) >= 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 = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo); ammo_amount += actor.(weaponentity).(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo); } return ammo_amount; @@ -643,4 +576,3 @@ METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) } #endif -#endif