X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=2853625f2c343ef0829ab129ab635eeddd6ad6fe;hb=87cbf00c7734cf2910502c217b5c5157511ba5ea;hp=09cb77c8bd9a5b2774d8178f48bccc195bead691;hpb=edf01df130d0d1877461561178b8833a9ab6051c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 09cb77c8b..2853625f2 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -50,6 +50,7 @@ CLASS(Electro, Weapon) 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) \ @@ -144,19 +145,19 @@ void W_Electro_ExplodeCombo(entity this) remove(this); } -void W_Electro_Explode(entity this) +void W_Electro_Explode(entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); this.event_damage = func_null; this.takedamage = DAMAGE_NO; - if(this.movetype == MOVETYPE_BOUNCE) + if(this.move_movetype == MOVETYPE_BOUNCE || this.classname == "electro_orb") // TODO: classname is more reliable anyway? { RadiusDamage( this, @@ -168,7 +169,7 @@ void W_Electro_Explode(entity this) NULL, WEP_CVAR_SEC(electro, force), this.projectiledeathtype, - other + directhitentity ); } else @@ -184,7 +185,7 @@ void W_Electro_Explode(entity this) NULL, WEP_CVAR_PRI(electro, force), this.projectiledeathtype, - other + directhitentity ); } @@ -193,13 +194,13 @@ void W_Electro_Explode(entity this) void W_Electro_Explode_use(entity this, entity actor, entity trigger) { - W_Electro_Explode(this); + W_Electro_Explode(this, trigger); } -void W_Electro_TouchExplode(entity this) +void W_Electro_TouchExplode(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - W_Electro_Explode(this); + PROJECTILE_TOUCH(this, toucher); + W_Electro_Explode(this, toucher); } void W_Electro_Bolt_Think(entity this) @@ -285,7 +286,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) proj.projectiledeathtype = WEP_ELECTRO.m_id; setorigin(proj, w_shotorg); - proj.movetype = MOVETYPE_FLY; + set_movetype(proj, MOVETYPE_FLY); W_SetupProjVelocity_PRI(proj, electro); proj.angles = vectoangles(proj.velocity); settouch(proj, W_Electro_TouchExplode); @@ -298,16 +299,56 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) MUTATOR_CALLHOOK(EditProjectile, actor, proj); } -void W_Electro_Orb_Touch(entity this) +void W_Electro_Orb_Stick(entity this, entity to) { - PROJECTILE_TOUCH(this); - if(other.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this); } } + entity newproj = spawn(); + newproj.classname = this.classname; + + newproj.bot_dodge = this.bot_dodge; + newproj.bot_dodgerating = this.bot_dodgerating; + + newproj.owner = this.owner; + newproj.realowner = this.realowner; + setsize(newproj, this.mins, this.maxs); + setorigin(newproj, this.origin); + setmodel(newproj, MDL_PROJECTILE_ELECTRO); + newproj.angles = vectoangles(-trace_plane_normal); // face against the surface + + newproj.takedamage = this.takedamage; + newproj.damageforcescale = this.damageforcescale; + newproj.health = this.health; + newproj.event_damage = this.event_damage; + newproj.spawnshieldtime = this.spawnshieldtime; + newproj.damagedbycontents = true; + + set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place + newproj.projectiledeathtype = this.projectiledeathtype; + + settouch(newproj, func_null); + setthink(newproj, getthink(this)); + newproj.nextthink = this.nextthink; + newproj.use = this.use; + newproj.flags = this.flags; + + remove(this); + + if(to) + SetMovetypeFollow(this, 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); } } else { //UpdateCSQCProjectile(this); 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); } } @@ -359,8 +400,8 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor) W_SetupShot_ProjectileSize( actor, - '0 0 -4', - '0 0 -4', + '-4 -4 -4', + '4 4 4', false, 2, SND_ELECTRO_FIRE2, @@ -385,10 +426,10 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor) //proj.glow_size = 50; //proj.glow_color = 45; - proj.movetype = MOVETYPE_BOUNCE; + set_movetype(proj, MOVETYPE_BOUNCE); W_SetupProjVelocity_UP_SEC(proj, electro); settouch(proj, W_Electro_Orb_Touch); - setsize(proj, '0 0 -4', '0 0 -4'); + setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_YES; proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale); proj.health = WEP_CVAR_SEC(electro, health);