X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=2ba6b5da18628bc669f6de77668c32c23738ea11;hb=45d8904a100765555e622598a39967963733df1d;hp=cff7122c0f68decdbff36981ab3880e86a9d6a4e;hpb=b9ed1a38cd897084d0ed8beb6033a761e095d64d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index cff7122c0..2ba6b5da1 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -64,7 +64,7 @@ void W_Electro_ExplodeCombo(entity this) NULL, NULL, WEP_CVAR(electro, combo_force), - this.projectiledeathtype | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce + WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce this.weaponentity_fld, NULL ); @@ -258,7 +258,7 @@ void W_Electro_Orb_Stick(entity this, entity to) newproj.takedamage = this.takedamage; newproj.damageforcescale = this.damageforcescale; - SetResourceAmountExplicit(newproj, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH)); + SetResourceExplicit(newproj, RES_HEALTH, GetResource(this, RES_HEALTH)); newproj.event_damage = this.event_damage; newproj.spawnshieldtime = this.spawnshieldtime; newproj.damagedbycontents = true; @@ -279,14 +279,14 @@ void W_Electro_Orb_Stick(entity this, entity to) delete(this); if(to) - SetMovetypeFollow(this, to); + SetMovetypeFollow(newproj, to); } 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); } } + if(toucher.takedamage == DAMAGE_AIM && WEP_CVAR_SEC(electro, touchexplode)) + { W_Electro_Explode(this, toucher); } else if(toucher.owner != this.owner && toucher.classname != this.classname) // don't stick to player's other projectiles! { //UpdateCSQCProjectile(this); @@ -300,7 +300,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, .entity weaponentity, vector hitloc, vector force) { - if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) + if(GetResource(this, RES_HEALTH) <= 0) return; // note: combos are usually triggered by W_Electro_TriggerCombo, not damage @@ -309,8 +309,8 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1))) return; // g_projectiles_damage says to halt - TakeResource(this, RESOURCE_HEALTH, damage); - if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) + TakeResource(this, RES_HEALTH, damage); + if(GetResource(this, RES_HEALTH) <= 0) { this.takedamage = DAMAGE_NO; this.nextthink = time; @@ -381,7 +381,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_YES; proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale); - SetResourceAmountExplicit(proj, RESOURCE_HEALTH, WEP_CVAR_SEC(electro, health)); + SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_SEC(electro, health)); proj.event_damage = W_Electro_Orb_Damage; proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); @@ -394,14 +394,6 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop); proj.missile_flags = MIF_SPLASH | MIF_ARC; -#if 0 - entity p2; - p2 = spawn(); - copyentity(proj, p2); - setmodel(p2, MDL_PROJECTILE_ELECTRO); - setsize(p2, proj.mins, proj.maxs); -#endif - CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound MUTATOR_CALLHOOK(EditProjectile, actor, proj); @@ -491,7 +483,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 = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(electro, ammo); return ammo_amount; } @@ -500,12 +492,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 = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); } else { - ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo); } return ammo_amount;