X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_seeker.qc;h=b74f60e00e28437bb33ab7f016443640bfb134dc;hp=5307a3c68936e0b4d10df0668d222cd4c9a0514c;hb=4fc59bbd7e2d4f25ba21952ed50ae754295a7faa;hpb=477b7b3e324bdb74aee19bfee925d708c7cf9758 diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index 5307a3c68..b74f60e00 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -1,6 +1,7 @@ #ifdef REGISTER_WEAPON REGISTER_WEAPON(SEEKER, w_seeker, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "seeker", "seeker", "T.A.G. Seeker"); #else +#ifdef SVQC //.float speed; = switchweapon //.float proxytime; = autoswitch //.float tl; = wait @@ -28,7 +29,10 @@ void Seeker_Missile_Think() float dist; if (time > self.cnt) + { + self.projectiledeathtype |= HITTYPE_SPLASH; Seeker_Missile_Explode(); + } if (!self.switchweapon) self.switchweapon = cvar("g_balance_seeker_missile_speed"); @@ -47,9 +51,9 @@ void Seeker_Missile_Think() { e = self.enemy; eorg = 0.5 * (e.absmin + e.absmax); - turnrate = cvar("g_balance_seeker_missile_turnrate"); // how fast to turn + turnrate = cvar("g_balance_seeker_missile_turnrate"); // how fast to turn desireddir = normalize(eorg - self.origin); - olddir = normalize(self.velocity); // get my current direction + olddir = normalize(self.velocity); // get my current direction dist = vlen(eorg - self.origin); // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P ) @@ -62,18 +66,14 @@ void Seeker_Missile_Think() traceline(self.origin, eorg, FALSE, self); // Setup adaptive tracelength - self.wait = vlen(self.origin - trace_endpos); - if (self.wait < cvar("g_balance_seeker_missile_smart_trace_min")) self.wait = cvar("g_balance_seeker_missile_smart_trace_min"); - if (self.wait > cvar("g_balance_seeker_missile_smart_trace_max")) self.wait = cvar("g_balance_seeker_missile_smart_trace_max"); + self.wait = bound(cvar("g_balance_seeker_missile_smart_trace_min"), vlen(self.origin - trace_endpos), self.wait = cvar("g_balance_seeker_missile_smart_trace_max")); // Calc how important it is that we turn and add this to the desierd (enemy) dir. desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5); } - - //newdir = normalize((olddir + desireddir * turnrate) * 0.5);// take the average of the 2 directions; not the best method but simple & easy - newdir = normalize(olddir + desireddir * turnrate);// take the average of the 2 directions; not the best method but simple & easy - - self.velocity = newdir * self.switchweapon; // make me fly in the new direction at my flight speed + + newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy + self.velocity = newdir * self.switchweapon; // make me fly in the new direction at my flight speed } // Proxy @@ -110,9 +110,8 @@ void Seeker_Missile_Think() return; } - self.angles = vectoangles(self.velocity); // turn model in the new flight direction - self.nextthink = time + 0.05; - + //self.angles = vectoangles(self.velocity); // turn model in the new flight direction + self.nextthink = time;// + 0.05; // csqc projectiles UpdateCSQCProjectile(self); } @@ -120,21 +119,19 @@ void Seeker_Missile_Think() void Seeker_Missile_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { - float d; - d = damage; - if (self.health <= 0) return; if (self.owner == attacker) - d = d * 0.25; - - self.health = self.health - d; - + self.health = self.health - (damage * 0.25); + else + self.health = self.health - damage; + if (self.health <= 0) W_PrepareExplosionByDamage(attacker, Seeker_Missile_Explode); } +/* void Seeker_Missile_Animate() { self.frame = self.frame +1; @@ -157,6 +154,7 @@ void Seeker_Missile_Animate() UpdateCSQCProjectile(self); } +*/ void Seeker_Fire_Missile(vector f_diff) { @@ -178,36 +176,33 @@ void Seeker_Fire_Missile(vector f_diff) missile.bot_dodge = TRUE; missile.bot_dodgerating = cvar("g_balance_seeker_missile_damage"); - missile.think = Seeker_Missile_Animate; - - //if (!cvar("g_balance_seeker_missile_proxy")) + missile.think = Seeker_Missile_Think; missile.touch = Seeker_Missile_Touch; - missile.event_damage = Seeker_Missile_Damage; missile.nextthink = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay"); missile.cnt = time + cvar("g_balance_seeker_missile_lifetime"); missile.enemy = self.enemy; missile.solid = SOLID_BBOX; missile.scale = 2; - missile.takedamage = DAMAGE_YES; + missile.takedamage = DAMAGE_YES; missile.health = cvar("g_balance_seeker_missile_health"); missile.damageforcescale = cvar("g_balance_seeker_missile_damageforcescale"); missile.projectiledeathtype = WEP_SEEKER; + //missile.think = Seeker_Missile_Animate; // csqc projectiles. + setorigin (missile, w_shotorg); setsize (missile, '-4 -4 -4', '4 4 4'); - - - missile.movetype = MOVETYPE_FLYMISSILE;// MOVETYPE_TOSS; - + missile.movetype = MOVETYPE_FLYMISSILE; missile.flags = FL_PROJECTILE; - W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_missile); missile.switchweapon = vlen(missile.velocity); missile.angles = vectoangles (missile.velocity); CSQCProjectile(missile, FALSE, PROJECTILE_SEEKER, TRUE); + + other = missile; MUTATOR_CALLHOOK(EditProjectile); } void Seeker_Vollycontroler_Think() @@ -270,17 +265,13 @@ void Seeker_Tag_Damage (entity inflictor, entity attacker, float damage, float d Seeker_Tag_Explode(); } -void Seeker_Tag_Think() -{ - remove(self); - return; -} void Seeker_Tag_Touch() { vector dir; vector org2; - + entity e; + dir = normalize (self.owner.origin - self.origin); org2 = findbetterlocation (self.origin, 8); @@ -290,28 +281,19 @@ void Seeker_Tag_Touch() Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER | HITTYPE_HEADSHOT, self); if (other.takedamage == DAMAGE_AIM && other.deadflag == DEAD_NO) - { - entity e; + { e = spawn(); e.cnt = cvar("g_balance_seeker_missile_count"); e.owner = self.owner; e.enemy = other; e.think = Seeker_Vollycontroler_Think; e.nextthink = time; - - //sprint(self.owner, "^1Target lock ^3[^7 ",other.netname, " ^3]^1 acquired - autofire activated.\n"); - //sprint(other,"^1You are targeted!\n"); - - // stuffcmd(other,"play2 weapons/zany-alarm4.ogg\n"); - // stuffcmd(self.owner, "play2 weapons/zany-lock4.ogg\n"); } remove(self); return; } - - void Seeker_Fire_Tag() { local entity missile; @@ -326,7 +308,7 @@ void Seeker_Fire_Tag() missile.bot_dodge = TRUE; missile.bot_dodgerating = 50; missile.touch = Seeker_Tag_Touch; - missile.think = Seeker_Tag_Think; + missile.think = SUB_Remove; missile.nextthink = time + cvar("g_balance_seeker_tag_lifetime"); missile.movetype = MOVETYPE_FLY; missile.solid = SOLID_BBOX; @@ -347,6 +329,8 @@ void Seeker_Fire_Tag() missile.angles = vectoangles (missile.velocity); CSQCProjectile(missile, TRUE, PROJECTILE_TAG, FALSE); // has sound + + other = missile; MUTATOR_CALLHOOK(EditProjectile); } @@ -397,29 +381,32 @@ void Seeker_Fire_Flac() pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); - missile = spawn (); - missile.owner = missile.realowner = self; - missile.classname = "missile"; - missile.bot_dodge = TRUE; + missile = spawn (); + missile.owner = missile.realowner = self; + missile.classname = "missile"; + missile.bot_dodge = TRUE; missile.bot_dodgerating = cvar("g_balance_seeker_flac_damage"); - missile.touch = Seeker_Flac_Explode; - missile.use = Seeker_Flac_Explode; - missile.think = Seeker_Flac_Explode; - missile.nextthink = time + cvar("g_balance_seeker_flac_lifetime") + cvar("g_balance_seeker_flac_lifetime_rand"); - missile.solid = SOLID_BBOX; - missile.scale = 0.4; // BUG: the model is too big + missile.touch = Seeker_Flac_Explode; + missile.use = Seeker_Flac_Explode; + missile.think = adaptor_think2use_hittype_splash; + missile.nextthink = time + cvar("g_balance_seeker_flac_lifetime") + cvar("g_balance_seeker_flac_lifetime_rand"); + missile.solid = SOLID_BBOX; + missile.movetype = MOVETYPE_FLY; missile.projectiledeathtype = WEP_SEEKER; + missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY; + missile.flags = FL_PROJECTILE; + + // csqc projectiles + //missile.angles = vectoangles (missile.velocity); + //missile.scale = 0.4; // BUG: the model is too big + setorigin (missile, w_shotorg); setsize (missile, '-2 -2 -2', '2 2 2'); - missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY; - - missile.movetype = MOVETYPE_FLY; + W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_flac); - - missile.angles = vectoangles (missile.velocity); - missile.flags = FL_PROJECTILE; - CSQCProjectile(missile, TRUE, PROJECTILE_FLAC, TRUE); + + other = missile; MUTATOR_CALLHOOK(EditProjectile); } void spawnfunc_weapon_seeker (void) @@ -453,7 +440,7 @@ float w_seeker(float req) { precache_model ("models/weapons/g_seeker.md3"); precache_model ("models/weapons/v_seeker.md3"); - precache_model ("models/weapons/h_seeker.dpm"); + precache_model ("models/weapons/h_seeker.iqm"); precache_sound ("weapons/tag_fire.wav"); precache_sound ("weapons/flac_fire.wav"); precache_sound ("weapons/seeker_fire.wav"); @@ -464,15 +451,87 @@ float w_seeker(float req) return self.ammo_rockets >= cvar("g_balance_seeker_tag_ammo") + cvar("g_balance_seeker_missile_ammo"); else if (req == WR_CHECKAMMO2) return self.ammo_rockets >= cvar("g_balance_seeker_flac_ammo"); + return TRUE; +}; +#endif +#ifdef CSQC +float w_seeker(float req) +{ + if(req == WR_IMPACTEFFECT) + { + vector org2; + org2 = w_org + w_backoff * 6; + if(w_deathtype & HITTYPE_SECONDARY) + { + pointparticles(particleeffectnum("flac_explode"), org2, '0 0 0', 1); + if(!w_issilent) + { + if (w_random<0.15) + sound(self, CHAN_PROJECTILE, "weapons/flacexp1.wav", 1, ATTN_NORM); + else if (w_random<0.7) + sound(self, CHAN_PROJECTILE, "weapons/flacexp2.wav", 1, ATTN_NORM); + else + sound(self, CHAN_PROJECTILE, "weapons/flacexp3.wav", 1, ATTN_NORM); + } + } + else + { + if(w_deathtype & HITTYPE_BOUNCE) + { + pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); + if(!w_issilent) + { + if (w_random<0.15) + sound(self, CHAN_PROJECTILE, "weapons/tagexp1.wav", 1, ATTN_NORM); + else if (w_random<0.7) + sound(self, CHAN_PROJECTILE, "weapons/tagexp2.wav", 1, ATTN_NORM); + else + sound(self, CHAN_PROJECTILE, "weapons/tagexp3.wav", 1, ATTN_NORM); + } + } + else if(w_deathtype & HITTYPE_HEADSHOT) + { + if(!w_issilent) + sound(self, CHAN_PROJECTILE, "weapons/tag_impact.wav", 1, ATTN_NORM); + } + else + { + pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); + if(!w_issilent) + { + if (w_random<0.15) + sound(self, CHAN_PROJECTILE, "weapons/seekerexp1.wav", 1, ATTN_NORM); + else if (w_random<0.7) + sound(self, CHAN_PROJECTILE, "weapons/seekerexp2.wav", 1, ATTN_NORM); + else + sound(self, CHAN_PROJECTILE, "weapons/seekerexp3.wav", 1, ATTN_NORM); + } + } + } + } + else if(req == WR_PRECACHE) + { + precache_sound("weapons/flacexp1.wav"); + precache_sound("weapons/flacexp2.wav"); + precache_sound("weapons/flacexp3.wav"); + precache_sound("weapons/seekerexp1.wav"); + precache_sound("weapons/seekerexp2.wav"); + precache_sound("weapons/seekerexp3.wav"); + precache_sound("weapons/tagexp1.wav"); + precache_sound("weapons/tagexp2.wav"); + precache_sound("weapons/tagexp3.wav"); + precache_sound("weapons/tag_impact.wav"); + } else if (req == WR_SUICIDEMESSAGE) - w_deathtypestring = "played with tiny rockets"; + w_deathtypestring = "%s played with tiny rockets"; else if (req == WR_KILLMESSAGE) { if(w_deathtype & HITTYPE_SECONDARY) - w_deathtypestring = "ran into #'s flac"; + w_deathtypestring = "%s ran into %s's flac"; else - w_deathtypestring = "was tagged by"; + w_deathtypestring = "%s was tagged by %s"; } return TRUE; -}; +} +#endif #endif