From 0dc02e00f42cd1f806689442b09ad2ff048ff7ca Mon Sep 17 00:00:00 2001 From: div0 Date: Sat, 12 Jan 2008 08:30:52 +0000 Subject: [PATCH] - make Yoda harder to get - direct hit with electro with enemy in air = electrobitch git-svn-id: svn://svn.icculus.org/nexuiz/trunk@3129 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/cl_client.qc | 2 +- data/qcsrc/server/g_damage.qc | 60 ++++++++++++++++++++++++++-------- data/qcsrc/server/t_items.qc | 4 +-- data/qcsrc/server/w_electro.qc | 13 ++++++++ data/qcsrc/server/w_nex.qc | 28 +++++++++------- 5 files changed, 80 insertions(+), 27 deletions(-) diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 151df65a5..ce3bad178 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -1237,7 +1237,7 @@ void ShowRespawnCountdown() { self.respawn_countdown = number - 1; if(ceil(self.death_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds - play2(self, strcat("announcer/robotic/", ftos(number), ".ogg")); + play2(self, strcat("announcer/robotic/", ftos(number), "announcer/.ogg")); } } } diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index bfb1b9879..819918a82 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -1,6 +1,37 @@ float checkrules_firstblood; +.float announcetime; +float yoda; +void announce(entity player, string msg) +{ + if(time > player.announcetime) + { + player.announcetime = time + 0.3; + play2(player, msg); + } +} + +float IsDifferentTeam(entity a, entity b) +{ + if(teams_matter) + if(a.team == b.team) + return 0; + return 1; +} + +float IsFlying(entity a) +{ + if(a.flags & FL_ONGROUND) + return 0; + if(a.waterlevel >= 2) + return 0; + traceline(a.origin, a.origin - '0 0 48', MOVE_NORMAL, a); + if(trace_fraction < 1) + return 0; + return 1; +} + void(entity player, float f) UpdateFrags = { player.frags += f; @@ -237,37 +268,37 @@ void Obituary (entity attacker, entity targ, float deathtype) if (attacker.killcount == 3) { bprint (a,"^7 made a ^1TRIPLE FRAG\n"); - play2(attacker, "announcer/male/03kills.ogg"); + announce(attacker, "announcer/male/03kills.ogg"); } else if (attacker.killcount == 5) { bprint (a,"^7 made a ^1FIVE FRAG COMBO\n"); - play2(attacker, "announcer/male/05kills.ogg"); + announce(attacker, "announcer/male/05kills.ogg"); } else if (attacker.killcount == 10) { bprint (a,"^7 is on a ^1RAGE\n"); - play2(attacker, "announcer/male/10kills.ogg"); + announce(attacker, "announcer/male/10kills.ogg"); } else if (attacker.killcount == 15) { bprint (a,"^7 has done a ^1MASSACRE!\n"); - play2(attacker, "announcer/male/15kills.ogg"); + announce(attacker, "announcer/male/15kills.ogg"); } else if (attacker.killcount == 20) { bprint (a,"^7 is ^1UNHUMAN!\n"); - play2(attacker, "announcer/male/20kills.ogg"); + announce(attacker, "announcer/male/20kills.ogg"); } else if (attacker.killcount == 25) { bprint (a,"^7 is a ^1DEATH INCARNATION!\n"); - play2(attacker, "announcer/male/25kills.ogg"); + announce(attacker, "announcer/male/25kills.ogg"); } else if (attacker.killcount == 30) { bprint (a,"^7 is maybe a ^1AIMBOTTER?!\n"); - play2(attacker, "announcer/male/30kills.ogg"); + announce(attacker, "announcer/male/30kills.ogg"); } } } @@ -292,7 +323,7 @@ void Obituary (entity attacker, entity targ, float deathtype) bprint ("^1",s, "^1 died\n"); GiveFrags(targ, targ, -1); if(targ.frags == -5) { - play2(targ, "announcer/male/botlike.ogg"); + announce(targ, "announcer/male/botlike.ogg"); } if (targ.killcount > 2) @@ -416,7 +447,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } else if (deathtype == IT_NEX && targ.items & IT_STRENGTH) { - if(clienttype(attacker) == CLIENTTYPE_REAL) play2(attacker, "announcer/male/yoda.ogg"); + if(clienttype(attacker) == CLIENTTYPE_REAL) + { + announce(attacker, "announcer/male/yoda.ogg"); + } } if (deathtype == IT_LASER) { @@ -433,10 +467,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } } } else { - if (deathtype == IT_NEX && !targ.deadflag && !(attacker.flags & FL_ONGROUND) && !(targ.flags & FL_ONGROUND) && attacker.waterlevel < 2 && targ.waterlevel < 2 && attacker.killcount != 3 && attacker.killcount != 5 && attacker.killcount != 10 && attacker.killcount != 15 && attacker.killcount != 20 && attacker.killcount != 25 && attacker.killcount != 30) - { - if(clienttype(attacker) == CLIENTTYPE_REAL) play2(attacker, "announcer/male/yoda.ogg"); - } + if (!targ.deadflag) + if(IsFlying(targ)) + if(IsDifferentTeam(self, targ)) + yoda = 1; } // apply strength multiplier diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 1e9a2f3b4..515271ee2 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -54,9 +54,9 @@ void Item_Touch (void) // play some cool sounds ;) centerprint(other, "\n"); if(other.health <= 5) - play2(other, "announcer/robotic/lastsecond.ogg"); + announce(other, "announcer/robotic/lastsecond.ogg"); else if(other.health < 50) - play2(other, "announcer/robotic/narrowly.ogg"); + announce(other, "announcer/robotic/narrowly.ogg"); // sound not available // else if(self.items == IT_CELLS) // play2(other, "announce/robotic/ammo.ogg"); diff --git a/data/qcsrc/server/w_electro.qc b/data/qcsrc/server/w_electro.qc index adb2849bc..728b0f9f9 100644 --- a/data/qcsrc/server/w_electro.qc +++ b/data/qcsrc/server/w_electro.qc @@ -39,6 +39,7 @@ void W_Plasma_Explode_Combo (void) { void W_Plasma_Touch (void) { + entity o; if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { sound (self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM); @@ -46,7 +47,12 @@ void W_Plasma_Touch (void) return; } if (other.takedamage == DAMAGE_AIM) { + o = self.owner; W_Plasma_Explode (); + if(!other.deadflag) + if(IsDifferentTeam(o, other)) + if(IsFlying(other)) + announce(o, "announcer/male/electrobitch.ogg"); } else { sound (self, CHAN_IMPACT, "weapons/electro_bounce.wav", 1, ATTN_NORM); } @@ -54,13 +60,20 @@ void W_Plasma_Touch (void) void W_Plasma_TouchExplode (void) { + entity o; if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { sound (self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM); remove(self); return; } + o = self.owner; W_Plasma_Explode (); + if(other.takedamage == DAMAGE_AIM) + if(!other.deadflag) + if(IsDifferentTeam(o, other)) + if(IsFlying(other)) + announce(o, "announcer/male/electrobitch.ogg"); } void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) diff --git a/data/qcsrc/server/w_nex.qc b/data/qcsrc/server/w_nex.qc index 7a076303a..6715bf493 100644 --- a/data/qcsrc/server/w_nex.qc +++ b/data/qcsrc/server/w_nex.qc @@ -8,7 +8,13 @@ void W_Nex_Attack (void) if (g_minstagib) FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 1000, 800, IT_NEX); else + { + yoda = 0; FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), IT_NEX); + if(yoda) + if(IsFlying(self)) + announce(self, "announcer/male/yoda.ogg"); + } pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg + v_forward * 32, v_forward * 1000, 1); @@ -61,67 +67,67 @@ void minstagib_ammocheck (void) { centerprint(self, "you're dead now...\n"); Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/terminated.ogg"); + announce(self, "announcer/robotic/terminated.ogg"); } if (self.health == 10) { centerprint(self, "^11^7 second left to find some ammo\n"); Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/1.ogg"); + announce(self, "announcer/robotic/1.ogg"); } if (self.health == 20) { centerprint(self, "^12^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/2.ogg"); + announce(self, "announcer/robotic/2.ogg"); } if (self.health == 30) { centerprint(self, "^13^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/3.ogg"); + announce(self, "announcer/robotic/3.ogg"); } if (self.health == 40) { centerprint(self, "^14^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/4.ogg"); + announce(self, "announcer/robotic/4.ogg"); } if (self.health == 50) { centerprint(self, "^15^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/5.ogg"); + announce(self, "announcer/robotic/5.ogg"); } if (self.health == 60) { centerprint(self, "^36^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/6.ogg"); + announce(self, "announcer/robotic/6.ogg"); } if (self.health == 70) { centerprint(self, "^37^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/7.ogg"); + announce(self, "announcer/robotic/7.ogg"); } if (self.health == 80) { centerprint(self, "^38^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/8.ogg"); + announce(self, "announcer/robotic/8.ogg"); } if (self.health == 90) { centerprint(self, "^39^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/9.ogg"); + announce(self, "announcer/robotic/9.ogg"); } if (self.health == 100) { centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds..."); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - play2(self, "announcer/robotic/10.ogg"); + announce(self, "announcer/robotic/10.ogg"); } } self.minstagib_nextthink = time + 1; -- 2.39.2