From: Mario Date: Thu, 13 Dec 2012 22:07:40 +0000 (+1100) Subject: Initial commit X-Git-Tag: xonotic-v0.7.0~55^2~3^2~30 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=2edeb8354bb93aae319d75077a44c0fd0b4f6ca2 Initial commit --- diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 3bff21ecf..a2b6e1857 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -136,11 +136,13 @@ float bot_shouldattack(entity e) return FALSE; if (e.BUTTON_CHAT) return FALSE; - if(g_minstagib) - if(e.items & IT_STRENGTH) - return FALSE; if(e.flags & FL_NOTARGET) return FALSE; + + checkentity = e; + if(MUTATOR_CALLHOOK(BotShouldAttack)) + return FALSE; + return TRUE; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 101e35cae..e6bf1eec8 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -404,8 +404,6 @@ void PutObserverInServer (void) DropAllRunes(self); MUTATOR_CALLHOOK(MakePlayerObserver); - minstagib_stop_countdown(self); - Portal_ClearAll(self); if(self.alivetime) @@ -711,10 +709,7 @@ void PutClientInServer (void) if(autocvar__notarget) self.flags |= FL_NOTARGET; self.takedamage = DAMAGE_AIM; - if(g_minstagib) - self.effects = EF_FULLBRIGHT; - else - self.effects = 0; + self.effects = 0; self.effects |= EF_TELEPORT_BIT | EF_RESTARTANIM_BIT; self.air_finished = time + 12; self.dmg = 2; @@ -1800,51 +1795,7 @@ void player_powerups (void) Fire_ApplyDamage(self); Fire_ApplyEffect(self); - if (g_minstagib) - { - self.effects |= EF_FULLBRIGHT; - - if (self.items & IT_STRENGTH) - { - play_countdown(self.strength_finished, "misc/poweroff.wav"); - if (time > self.strength_finished) - { - self.alpha = default_player_alpha; - self.exteriorweaponentity.alpha = default_weapon_alpha; - self.items &~= IT_STRENGTH; - sprint(self, "^3Invisibility has worn off\n"); - } - } - else - { - if (time < self.strength_finished) - { - self.alpha = g_minstagib_invis_alpha; - self.exteriorweaponentity.alpha = g_minstagib_invis_alpha; - self.items |= IT_STRENGTH; - sprint(self, "^3You are invisible\n"); - } - } - - if (self.items & IT_INVINCIBLE) - { - play_countdown(self.invincible_finished, "misc/poweroff.wav"); - if (time > self.invincible_finished) - { - self.items = self.items - (self.items & IT_INVINCIBLE); - sprint(self, "^3Speed has worn off\n"); - } - } - else - { - if (time < self.invincible_finished) - { - self.items = self.items | IT_INVINCIBLE; - sprint(self, "^3You are on speed\n"); - } - } - } - else // if we're not in minstagib, continue. I added this else to replace the "return" which was here that broke the callhook for this function -- This code is nasty. + if not(g_minstagib) { if (self.items & IT_STRENGTH) { @@ -2688,9 +2639,6 @@ void PlayerPreThink (void) player_powerups(); } - if (g_minstagib) - minstagib_ammocheck(); - if (self.deadflag != DEAD_NO) { float button_pressed, force_respawn; diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 529567a3b..b6a71c311 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -94,8 +94,7 @@ void ImpulseCommands (void) W_PreviousWeapon (2); break; case 17: - if (!g_minstagib) - W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE); + W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE); break; case 18: W_NextWeapon (1); diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 3e2268d89..ae1647305 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -707,8 +707,6 @@ void SV_PlayerPhysics() WarpZone_PlayerPhysics_FixVAngle(); maxspd_mod = 1; - if(g_minstagib && (self.items & IT_INVINCIBLE)) - maxspd_mod *= autocvar_g_minstagib_speed_highspeed; if(self.ballcarried) if(g_nexball) maxspd_mod *= autocvar_g_nexball_basketball_carrier_highspeed; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index dcf1ab768..951d99d2e 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -355,10 +355,6 @@ void player_anim (void) void SpawnThrownWeapon (vector org, float w) { - if(g_minstagib) - if(self.ammo_cells <= 0) - return; - if(g_pinata) { float j; @@ -484,17 +480,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); - if (!g_minstagib) - { - v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage); - take = v_x; - save = v_y; - } - else - { - save = 0; - take = damage; - } + + v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage); + take = v_x; + save = v_y; if(attacker == self) { diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 402b692af..acd2278c6 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -132,8 +132,10 @@ vector w_shotend; .float prevstrengthsoundattempt; void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound { - if((!g_minstagib) - && (player.items & IT_STRENGTH) + if(MUTATOR_CALLHOOK(PlayStrengthSound)) + return; + + if((player.items & IT_STRENGTH) && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold))) { diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 1e7d2815d..b391c091b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -623,12 +623,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(attacker.dmg_team > teamdamage0 && !g_ca) mirrordamage = autocvar_g_mirrordamage * (attacker.dmg_team - teamdamage0); mirrorforce = autocvar_g_mirrordamage * vlen(force); - if(g_minstagib) - { - if(autocvar_g_friendlyfire == 0) - damage = 0; - } - else if(g_ca) + if(g_ca) damage = 0; else damage = autocvar_g_friendlyfire * damage; @@ -670,43 +665,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float attacker.lms_traveled_distance = autocvar_g_lms_campcheck_distance; } - if(targ.classname == "player") - if (g_minstagib) - { - if ((deathtype == DEATH_FALL) || - (deathtype == DEATH_DROWN) || - (deathtype == DEATH_SLIME) || - (deathtype == DEATH_LAVA) || - (!DEATH_ISWEAPON(deathtype, WEP_LASER) && damage > 0 && damage < 100)) - { - self = oldself; - return; - } - if(damage > 0) - damage = 10000; - if (targ.armorvalue && (deathtype == WEP_MINSTANEX) && damage) - { - targ.armorvalue -= 1; - centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue))); - damage = 0; - targ.hitsound += 1; - attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit - } - if (DEATH_ISWEAPON(deathtype, WEP_LASER)) - { - damage = 0; - mirrordamage = 0; - if (targ != attacker) - { - if ((targ.health >= 1) && (targ.classname == "player")) - centerprint(attacker, "Secondary fire inflicts no damage!"); - force = '0 0 0'; - // keep mirrorforce - attacker = targ; - } - } - } - if not(DEATH_ISSPECIAL(deathtype)) { damage *= g_weapondamagefactor; @@ -721,12 +679,14 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float frag_damage = damage; frag_force = force; frag_deathtype = deathtype; + frag_mirrordamage = mirrordamage; MUTATOR_CALLHOOK(PlayerDamage_Calculate); damage = frag_damage; + mirrordamage = frag_mirrordamage; force = frag_force; // apply strength multiplier - if ((attacker.items & IT_STRENGTH) && !g_minstagib) + if (attacker.items & IT_STRENGTH) { if(targ == attacker) { @@ -741,7 +701,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } // apply invincibility multiplier - if (targ.items & IT_INVINCIBLE && !g_minstagib) + if (targ.items & IT_INVINCIBLE) damage = damage * autocvar_g_balance_powerup_invincible_takedamage; if (targ == attacker) @@ -843,14 +803,9 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if not(DEATH_ISSPECIAL(deathtype)) { if(targ.classname == "player") // don't do this for vehicles - if(!g_minstagib) if(IsFlying(victim)) yoda = 1; - if(g_minstagib) - if(victim.items & IT_STRENGTH) - yoda = 1; - if(deathtype & HITTYPE_HEADSHOT) headshot = 1; } @@ -945,18 +900,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(mirrordamage > 0 || mirrorforce > 0) { attacker = attacker_save; - if(g_minstagib) - if(mirrordamage > 0) - { - // just lose extra LIVES, don't kill the player for mirror damage - if(attacker.armorvalue > 0) - { - attacker.armorvalue = attacker.armorvalue - 1; - centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue))); - attacker.hitsound += 1; - } - mirrordamage = 0; - } force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 69bf57d51..a71dbba11 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -431,12 +431,9 @@ void cvar_changes_init() BADCVAR("g_minstagib"); BADCVAR("g_new_toys"); BADCVAR("g_nix"); - - if(autocvar_g_minstagib) - { - BADCVAR("g_grappling_hook"); - BADCVAR("g_jetpack"); - } + BADCVAR("g_grappling_hook"); + BADCVAR("g_jetpack"); + #undef BADPREFIX #undef BADCVAR @@ -715,10 +712,6 @@ void spawnfunc_worldspawn (void) if(autocvar_g_midair) s = strcat(s, ":midair"); - // TODO to mutator system - if(autocvar_g_minstagib) - s = strcat(s, ":minstagib"); - // TODO to mutator system if(autocvar_g_powerups == 0) s = strcat(s, ":no_powerups"); @@ -937,9 +930,6 @@ void spawnfunc_worldspawn (void) modname = cvar_string("g_mod_balance"); if(cvar_string("g_mod_config") != cvar_defstring("g_mod_config")) modname = cvar_string("g_mod_config"); - // weird mutators that deserve to count as mod - if(autocvar_g_minstagib) - modname = "MinstaGib"; // extra mutators that deserve to count as mod MUTATOR_CALLHOOK(SetModname); // weird game types that deserve to count as mod diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 20828800d..9d542b587 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -936,20 +936,6 @@ void readplayerstartcvars() if(!(g_lms || g_ca)) start_items |= IT_UNLIMITED_AMMO; } - else if (g_minstagib) - { - g_pinata = 0; // incompatible - g_weapon_stay = 0; // incompatible - g_bloodloss = 0; // incompatible - start_health = 100; - start_armorvalue = 0; - WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX); - g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha"); - start_items |= IT_UNLIMITED_SUPERWEAPONS; - - if (g_minstagib_invis_alpha <= 0) - g_minstagib_invis_alpha = -1; - } else { for (i = WEP_FIRST; i <= WEP_LAST; ++i) @@ -971,12 +957,7 @@ void readplayerstartcvars() if(cvar("g_nexball")) start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT - if(g_minstagib) - { - start_ammo_cells = cvar("g_minstagib_ammo_start"); - start_ammo_fuel = cvar("g_start_ammo_fuel"); - } - else if(start_items & IT_UNLIMITED_WEAPON_AMMO) + if(start_items & IT_UNLIMITED_WEAPON_AMMO) { start_ammo_rockets = 999; start_ammo_shells = 999; @@ -1121,6 +1102,9 @@ void readlevelcvars(void) MUTATOR_ADD(mutator_dodging); if(cvar("g_spawn_near_teammate")) MUTATOR_ADD(mutator_spawn_near_teammate); + if(cvar("g_minstagib")) + MUTATOR_ADD(mutator_minstagib); + if(!g_minstagib) { if(cvar("g_invincible_projectiles")) diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index 29a8e4e0b..882590811 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -121,6 +121,9 @@ MUTATOR_HOOKABLE(GetCvars); // INPUT: float get_cvars_f; string get_cvars_s; + +MUTATOR_HOOKABLE(PlayStrengthSound); + // called when a player fires a weapon with the strength powerup MUTATOR_HOOKABLE(EditProjectile); // can edit any "just fired" projectile @@ -148,6 +151,7 @@ MUTATOR_HOOKABLE(PlayerDamage_Calculate); float frag_deathtype; // INPUT, OUTPUT: float frag_damage; + float frag_mirrordamage; vector frag_force; MUTATOR_HOOKABLE(PlayerPowerups); @@ -212,6 +216,24 @@ MUTATOR_HOOKABLE(SetWeaponreplace); entity other; // weapon info // IN+OUT string ret_string; + +MUTATOR_HOOKABLE(Item_RespawnCountdown); + // called when an item is about to respawn + // INPUT+OUTPUT: + string item_name; + vector item_color; + +MUTATOR_HOOKABLE(Item_GiveTo); + // called when an item is given to a player + entity giveplayer; + entity giveitem; + float player_wswitch; + float player_pickedup; + +MUTATOR_HOOKABLE(BotShouldAttack); + // called when a bot checks a target to attack + // INPUT + entity checkentity; MUTATOR_HOOKABLE(PortalTeleport); // called whenever a player goes through a portal gun teleport diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc new file mode 100644 index 000000000..bf4e6a2d3 --- /dev/null +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -0,0 +1,436 @@ +void spawnfunc_item_minst_cells (void) +{ + if not(g_minstagib) + { + remove(self); + return; + } +} + +.float minstagib_nextthink; +.float minstagib_needammo; +void minstagib_stop_countdown(entity e) +{ + if (!e.minstagib_needammo) + return; + Send_CSQC_Centerprint_Generic_Expire(e, CPID_MINSTA_FINDAMMO); + e.minstagib_needammo = FALSE; +} +void minstagib_ammocheck(void) +{ + if (time < self.minstagib_nextthink) + return; + + if (self.deadflag || gameover) + minstagib_stop_countdown(self); + else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO)) + { + minstagib_stop_countdown(self); + if(self.health < 100) + self.health = 100; + } + else + { + self.minstagib_needammo = TRUE; + if (self.health == 5) + { + Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "terminated"); + } + else if (self.health == 10) + { + Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "1"); + } + else if (self.health == 20) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "2"); + } + else if (self.health == 30) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "3"); + } + else if (self.health == 40) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "4"); + } + else if (self.health == 50) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "5"); + } + else if (self.health == 60) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "6"); + } + else if (self.health == 70) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "7"); + } + else if (self.health == 80) + { + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "8"); + } + else if (self.health == 90) + { + Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 seconds left to find some ammo", 1, 9); + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + AnnounceTo(self, "9"); + } + else if (self.health == 100) + { + Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10); + Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + if not(self.flags & FL_GODMODE) + AnnounceTo(self, "10"); + } + } + self.minstagib_nextthink = time + 1; +} + +MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack) +{ + if(checkentity.items & IT_STRENGTH) + return TRUE; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver) +{ + minstagib_stop_countdown(self); + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn) +{ + self.effects |= EF_FULLBRIGHT; + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink) +{ + minstagib_ammocheck(); + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups) +{ + if not(self.effects & EF_FULLBRIGHT) + self.effects |= EF_FULLBRIGHT; + + if (self.items & IT_STRENGTH) + { + play_countdown(self.strength_finished, "misc/poweroff.wav"); + if (time > self.strength_finished) + { + self.alpha = default_player_alpha; + self.exteriorweaponentity.alpha = default_weapon_alpha; + self.items &~= IT_STRENGTH; + sprint(self, "^3Invisibility has worn off\n"); + } + } + else + { + if (time < self.strength_finished) + { + self.alpha = g_minstagib_invis_alpha; + self.exteriorweaponentity.alpha = g_minstagib_invis_alpha; + self.items |= IT_STRENGTH; + sprint(self, "^3You are invisible\n"); + } + } + + if (self.items & IT_INVINCIBLE) + { + play_countdown(self.invincible_finished, "misc/poweroff.wav"); + if (time > self.invincible_finished) + { + self.items &~= IT_INVINCIBLE; + sprint(self, "^3Speed has worn off\n"); + } + } + else + { + if (time < self.invincible_finished) + { + self.items |= IT_INVINCIBLE; + sprint(self, "^3You are on speed\n"); + } + } + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics) +{ + if(self.items & IT_INVINCIBLE) + self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor) +{ + damage_save = 0; + damage_take = frag_damage; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing) +{ + if (self.health < 1) + return FALSE; + + return TRUE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayStrengthSound) +{ + // You shall not play! + return TRUE; +} + +MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage) +{ + if(autocvar_g_friendlyfire == 0) + frag_damage = 0; + + if(frag_target.classname == "player") + { + if ((frag_deathtype == DEATH_FALL) || + (frag_deathtype == DEATH_DROWN) || + (frag_deathtype == DEATH_SLIME) || + (frag_deathtype == DEATH_LAVA)) + { + frag_damage = 0; + } + + if (frag_target.armorvalue && (frag_deathtype == WEP_MINSTANEX) && frag_damage) + { + frag_target.armorvalue -= 1; + centerprint(frag_target, strcat("^3Remaining extra lives: ",ftos(frag_target.armorvalue))); + frag_damage = 0; + frag_target.hitsound += 1; + frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit + } + if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER)) + { + frag_damage = 0; + frag_mirrordamage = 0; + if (frag_target != frag_attacker) + { + if ((frag_target.health >= 1) && (frag_target.classname == "player")) + centerprint(frag_attacker, "Secondary fire inflicts no damage!"); + frag_force = '0 0 0'; + // keep mirrorfrag_force + frag_attacker = frag_target; + } + } + } + + if(frag_mirrordamage > 0) + { + // just lose extra LIVES, don't kill the player for mirror damage + if(frag_attacker.armorvalue > 0) + { + frag_attacker.armorvalue = frag_attacker.armorvalue - 1; + centerprint(frag_attacker, strcat("^3Remaining extra lives: ", ftos(frag_attacker.armorvalue))); + frag_attacker.hitsound += 1; + } + frag_mirrordamage = 0; + } + + if(frag_target.items & IT_STRENGTH) + yoda = 1; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_SetStartItems) +{ + start_ammo_cells = cvar("g_minstagib_ammo_start"); + + g_pinata = 0; // incompatible + g_weapon_stay = 0; // incompatible + g_bloodloss = 0; // incompatible + start_health = 100; + start_armorvalue = 0; + WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX); + g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha"); + start_items |= IT_UNLIMITED_SUPERWEAPONS; + + if (g_minstagib_invis_alpha <= 0) + g_minstagib_invis_alpha = -1; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_FilterItem) +{ + if(self.weapon == -2) + return FALSE; + + if(self.classname == "item_minst_cells" || self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX) + { + self.ammo_cells = autocvar_g_minstagib_ammo_drop; + StartItem ("models/items/a_cells.md3", + "misc/itempickup.wav", 45, 0, + "MinstaNex Ammo", IT_CELLS, -2, 0, generic_pickupevalfunc, 100); + return FALSE; + } + + if(self.flags & FL_POWERUP) + { + // randomize + float rnd = random() * 3; + if (rnd <= 1) + self.items = IT_STRENGTH; + else if (rnd <= 2) + self.items = IT_NAILS; + else + self.items = IT_INVINCIBLE; + + if (self.items == IT_STRENGTH) + { + if(!self.strength_finished) + self.strength_finished = autocvar_g_balance_powerup_strength_time; + StartItem ("models/items/g_strength.md3", + "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, + "Invisibility", IT_STRENGTH, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID); + } + // replace with extra lives + else if (self.items == IT_NAILS) + { + self.max_health = 1; + StartItem ("models/items/g_h100.md3", + "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, + "Extralife", IT_NAILS, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH); + } + // replace with speed + else if (self.items == IT_INVINCIBLE) + { + if(!self.invincible_finished) + self.invincible_finished = autocvar_g_balance_powerup_invincible_time; + StartItem ("models/items/g_invincible.md3", + "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, + "Speed", IT_INVINCIBLE, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID); + } + return FALSE; + } + + return TRUE; +} + +MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown) +{ + switch(self.items) + { + case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break; + case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break; + case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break; + } + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_GiveItem) +{ + float it; + float prevcells = giveplayer.ammo_cells; + + player_pickedup |= Item_GiveAmmoTo(giveitem, giveplayer, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL); + player_pickedup |= Item_GiveAmmoTo(giveitem, giveplayer, ammo_cells, 999, ITEM_MODE_NONE); + + if(giveplayer.ammo_cells > prevcells) + { + player_wswitch = TRUE; + // play some cool sounds ;) + if (clienttype(giveplayer) == CLIENTTYPE_REAL) + { + if(giveplayer.health <= 5) + AnnounceTo(giveplayer, "lastsecond"); + else if(giveplayer.health < 50) + AnnounceTo(giveplayer, "narrowly"); + } + + if (WEPSET_CONTAINS_EW(giveitem, WEP_MINSTANEX)) + W_GiveWeapon (giveplayer, WEP_MINSTANEX, giveitem.netname); + giveplayer.health = 100; + } + + if((it = (giveitem.items - (giveitem.items & giveplayer.items)) & IT_PICKUPMASK)) + { + player_pickedup = TRUE; + giveplayer.items |= it; + sprint (giveplayer, strcat("You got the ^2", giveitem.netname, "\n")); + } + + // extralife powerup + if (giveitem.max_health) + { + player_pickedup = TRUE; + // sound not available + // AnnounceTo(giveplayer, "_lives"); + giveplayer.armorvalue = bound(giveplayer.armorvalue, 999, giveplayer.armorvalue + autocvar_g_minstagib_extralives); + sprint(giveplayer, "^3You picked up some extra lives\n"); + } + + // invis powerup + if (giveitem.strength_finished) + { + player_pickedup = TRUE; + // sound not available + // AnnounceTo(giveplayer, "invisible"); + giveplayer.strength_finished = max(giveplayer.strength_finished, time) + autocvar_g_balance_powerup_strength_time; + } + + // speed powerup + if (giveitem.invincible_finished) + { + player_pickedup = TRUE; + // sound not available + // AnnounceTo(giveplayer, "speed"); + giveplayer.invincible_finished = max(giveplayer.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time; + } + + return TRUE; +} + +MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString) +{ + ret_string = strcat(ret_string, ":MinstaGib"); + return FALSE; +} + +MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString) +{ + ret_string = strcat(ret_string, ", MinstaGib"); + return FALSE; +} + +MUTATOR_DEFINITION(mutator_minstagib) +{ + MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayStrengthSound, minstagib_PlayStrengthSound, CBC_ORDER_ANY); + MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY); + MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY); + MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY); + MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY); + MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY); + MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY); + MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY); + + return FALSE; +} diff --git a/qcsrc/server/mutators/mutators.qh b/qcsrc/server/mutators/mutators.qh index 2ac6094d3..c306c4d39 100644 --- a/qcsrc/server/mutators/mutators.qh +++ b/qcsrc/server/mutators/mutators.qh @@ -13,5 +13,6 @@ MUTATOR_DECLARATION(mutator_rocketflying); MUTATOR_DECLARATION(mutator_spawn_near_teammate); MUTATOR_DECLARATION(mutator_vampire); MUTATOR_DECLARATION(mutator_superspec); +MUTATOR_DECLARATION(mutator_minstagib); MUTATOR_DECLARATION(sandbox); diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index 028519372..ea05945b9 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -222,6 +222,7 @@ mutators/mutator_vampire.qc mutators/mutator_spawn_near_teammate.qc mutators/sandbox.qc mutators/mutator_superspec.qc +mutators/mutator_minstagib.qc ../warpzonelib/anglestransform.qc ../warpzonelib/mathlib.qc diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 48b4fdd31..e712d5786 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -271,11 +271,6 @@ float ItemSend(entity to, float sf) float have_pickup_item(void) { - // minstagib: only allow filtered items - if(g_minstagib) - if(self.classname != "minstagib") - return FALSE; - if(self.flags & FL_POWERUP) { if(autocvar_g_powerups > 0) @@ -436,9 +431,10 @@ void Item_Show (entity e, float mode) void Item_Respawn (void) { Item_Show(self, 1); - if(!g_minstagib && self.items == IT_STRENGTH) + // this is ugly... + if(self.items == IT_STRENGTH) sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound - else if(!g_minstagib && self.items == IT_INVINCIBLE) + else if(self.items == IT_INVINCIBLE) sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound else sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound @@ -465,28 +461,18 @@ void Item_RespawnCountdown (void) string name; vector rgb = '1 0 1'; name = string_null; - if(g_minstagib) - { - switch(self.items) - { - case IT_STRENGTH: name = "item-invis"; rgb = '0 0 1'; break; - case IT_NAILS: name = "item-extralife"; rgb = '1 0 0'; break; - case IT_INVINCIBLE: name = "item-speed"; rgb = '1 0 1'; break; - } - } - else - { - switch(self.items) - { - case IT_STRENGTH: name = "item-strength"; rgb = '0 0 1'; break; - case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break; - } - } switch(self.items) { - case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break; - case IT_JETPACK: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; + case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break; + case IT_JETPACK: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; + case IT_STRENGTH: name = "item-strength"; rgb = '0 0 1'; break; + case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break; } + item_name = name; + item_color = rgb; + MUTATOR_CALLHOOK(Item_RespawnCountdown); + name = item_name; + rgb = item_color; if(self.flags & FL_WEAPON) { entity wi = get_weaponinfo(self.weapon); @@ -606,72 +592,7 @@ float Item_GiveTo(entity item, entity player) // if nothing happens to player, just return without taking the item pickedup = FALSE; _switchweapon = FALSE; - - if (g_minstagib) - { - float prevcells = player.ammo_cells; - - pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL); - pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, 999, ITEM_MODE_NONE); - - if(player.ammo_cells > prevcells) - { - _switchweapon = TRUE; - - // play some cool sounds ;) - if (clienttype(player) == CLIENTTYPE_REAL) - { - if(player.health <= 5) - AnnounceTo(player, "lastsecond"); - else if(player.health < 50) - AnnounceTo(player, "narrowly"); - } - // sound not available - // else if(item.items == IT_CELLS) - // AnnounceTo(player, "ammo"); - - if (WEPSET_CONTAINS_EW(item, WEP_MINSTANEX)) - W_GiveWeapon (player, WEP_MINSTANEX, item.netname); - player.health = 100; - } - - if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK)) - { - pickedup = TRUE; - player.items |= it; - sprint (player, strcat("You got the ^2", item.netname, "\n")); - } - - // extralife powerup - if (item.max_health) - { - pickedup = TRUE; - // sound not available - // AnnounceTo(player, "_lives"); - player.armorvalue = bound(player.armorvalue, 999, player.armorvalue + autocvar_g_minstagib_extralives); - sprint(player, "^3You picked up some extra lives\n"); - } - - // invis powerup - if (item.strength_finished) - { - pickedup = TRUE; - // sound not available - // AnnounceTo(player, "invisible"); - player.strength_finished = max(player.strength_finished, time) + autocvar_g_balance_powerup_strength_time; - } - - // speed powerup - if (item.invincible_finished) - { - pickedup = TRUE; - // sound not available - // AnnounceTo(player, "speed"); - player.invincible_finished = max(player.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time; - } - } - else - { + // in case the player has autoswitch enabled do the following: // if the player is using their best weapon before items are given, they // probably want to switch to an even better weapon after items are given @@ -727,9 +648,17 @@ float Item_GiveTo(entity item, entity player) pickedup = TRUE; player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished; } - } :skip + + giveplayer = player; + giveitem = item; + player_wswitch = _switchweapon; + player_pickedup = pickedup; + MUTATOR_CALLHOOK(Item_GiveTo); + _switchweapon = player_wswitch; + pickedup = player_pickedup; + // always eat teamed entities if(item.team) pickedup = TRUE; @@ -1144,9 +1073,9 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, precache_sound (self.item_pickupsound); precache_sound ("misc/itemrespawncountdown.wav"); - if(!g_minstagib && itemid == IT_STRENGTH) + if(itemid == IT_STRENGTH) precache_sound ("misc/strength_respawn.wav"); - else if(!g_minstagib && itemid == IT_INVINCIBLE) + else if(itemid == IT_INVINCIBLE) precache_sound ("misc/shield_respawn.wav"); else precache_sound ("misc/itemrespawn.wav"); @@ -1208,69 +1137,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, Net_LinkEntity(self, FALSE, 0, ItemSend); } -/* replace items in minstagib - * IT_STRENGTH = invisibility - * IT_NAILS = extra lives - * IT_INVINCIBLE = speed - */ -void minstagib_items (float itemid) // will be deleted soon. -{ - float rnd; - self.classname = "minstagib"; // ...? - - // replace rocket launchers and nex guns with ammo cells - if (itemid == IT_CELLS) - { - self.ammo_cells = autocvar_g_minstagib_ammo_drop; - StartItem ("models/items/a_cells.md3", - "misc/itempickup.wav", 45, 0, - "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100); - return; - } - - // randomize - rnd = random() * 3; - if (rnd <= 1) - itemid = IT_STRENGTH; - else if (rnd <= 2) - itemid = IT_NAILS; - else - itemid = IT_INVINCIBLE; - - // replace with invis - if (itemid == IT_STRENGTH) - { - if(!self.strength_finished) - self.strength_finished = autocvar_g_balance_powerup_strength_time; - StartItem ("models/items/g_strength.md3", - "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, - "Invisibility", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID); - } - // replace with extra lives - if (itemid == IT_NAILS) - { - self.max_health = 1; - StartItem ("models/items/g_h100.md3", - "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, - "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH); - } - // replace with speed - if (itemid == IT_INVINCIBLE) - { - if(!self.invincible_finished) - self.invincible_finished = autocvar_g_balance_powerup_invincible_time; - StartItem ("models/items/g_invincible.md3", - "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, - "Speed", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID); - } -} - -float minst_no_auto_cells; -void minst_remove_item (void) { - if(minst_no_auto_cells) - remove(self); -} - float weaponswapping; float internalteam; @@ -1409,11 +1275,6 @@ void weapon_defaultspawnfunc(float wpn) if(self.team) f |= FL_NO_WEAPON_STAY; - // stupid minstagib hack, don't ask - if(g_minstagib) - if(self.ammo_cells) - self.ammo_cells = autocvar_g_minstagib_ammo_drop; - StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue); if (self.modelindex) // don't precache if self was removed weapon_action(e.weapon, WR_PRECACHE); @@ -1442,37 +1303,16 @@ void spawnfunc_weapon_shotgun (void) { void spawnfunc_weapon_nex (void) { - if (g_minstagib) - { - minstagib_items(IT_CELLS); - self.think = minst_remove_item; - self.nextthink = time; - return; - } weapon_defaultspawnfunc(WEP_NEX); } void spawnfunc_weapon_minstanex (void) { - if (g_minstagib) - { - minstagib_items(IT_CELLS); - self.think = minst_remove_item; - self.nextthink = time; - return; - } weapon_defaultspawnfunc(WEP_MINSTANEX); } void spawnfunc_weapon_rocketlauncher (void) { - if (g_minstagib) - { - minstagib_items(IT_CELLS); // replace rocketlauncher with cells - self.think = minst_remove_item; - self.nextthink = time; - return; - } weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER); } @@ -1600,9 +1440,6 @@ void spawnfunc_item_health_large (void) { } void spawnfunc_item_health_mega (void) { - if(g_minstagib) { - minstagib_items(IT_NAILS); - } else { if(!self.max_health) self.max_health = g_pickup_healthmega_max; if(!self.health) @@ -1610,7 +1447,6 @@ void spawnfunc_item_health_mega (void) { if(!self.pickup_anyway) self.pickup_anyway = g_pickup_healthmega_anyway; StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH); - } } // support old misnamed entities @@ -1621,34 +1457,16 @@ void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } void spawnfunc_item_strength (void) { - if(g_minstagib) { - minstagib_items(IT_STRENGTH); - } else { precache_sound("weapons/strength_fire.wav"); if(!self.strength_finished) self.strength_finished = autocvar_g_balance_powerup_strength_time; StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000); - } } void spawnfunc_item_invincible (void) { - if(g_minstagib) { - minstagib_items(IT_INVINCIBLE); - } else { if(!self.invincible_finished) self.invincible_finished = autocvar_g_balance_powerup_invincible_time; StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Shield", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000); - } -} - -void spawnfunc_item_minst_cells (void) { - if (g_minstagib) - { - minst_no_auto_cells = TRUE; - minstagib_items(IT_CELLS); - } - else - remove(self); } // compatibility: @@ -2134,12 +1952,6 @@ float GiveItems(entity e, float beginarg, float endarg) if(WEPSET_CONTAINS_ANY_EA(self, WEPBIT_SUPERWEAPONS)) e.superweapons_finished = autocvar_g_balance_superweapons_time; - if (g_minstagib) - { - e.health = bound(0, e.health, 100); - e.armorvalue = bound(0, e.armorvalue, 999); - } - if(e.strength_finished <= 0) e.strength_finished = 0; else diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index b8f2f3ac8..eff5f8031 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -324,9 +324,7 @@ string getwelcomemessage(void) ret_string = ""; MUTATOR_CALLHOOK(BuildMutatorsPrettyString); modifications = ret_string; - - if(g_minstagib) - modifications = strcat(modifications, ", MinstaGib"); + if(g_weaponarena) { if(g_weaponarena_random) diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 3780fc713..d5e2188d6 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -11,7 +11,6 @@ void W_GiveWeapon (entity e, float wep, string name) oldself = self; self = e; - if not(g_minstagib) if (other.classname == "player") { sprint (other, "You got the ^2"); diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 5e2bb075a..4156e42bb 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -34,19 +34,11 @@ void W_Laser_Attack (float issecondary) entity missile; vector s_forward; float a; - float nodamage; - - if(issecondary == 2) // minstanex shot - nodamage = g_minstagib; - else - nodamage = FALSE; a = autocvar_g_balance_laser_primary_shotangle; s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD); - if(nodamage) - W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, 0); - else if(issecondary == 1) + if(issecondary == 1) W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_secondary_damage); else W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_primary_damage); @@ -56,11 +48,8 @@ void W_Laser_Attack (float issecondary) missile.owner = missile.realowner = self; missile.classname = "laserbolt"; missile.dmg = 0; - if(!nodamage) - { - missile.bot_dodge = TRUE; - missile.bot_dodgerating = autocvar_g_balance_laser_primary_damage; - } + missile.bot_dodge = TRUE; + missile.bot_dodgerating = autocvar_g_balance_laser_primary_damage; PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = WEP_LASER; diff --git a/qcsrc/server/w_minstanex.qc b/qcsrc/server/w_minstanex.qc index 1f1137e4b..dd83df6b4 100644 --- a/qcsrc/server/w_minstanex.qc +++ b/qcsrc/server/w_minstanex.qc @@ -19,24 +19,16 @@ void W_MinstaNex_Attack (void) FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX); damage_headshotbonus = 0; - if(g_minstagib) + if(yoda && flying) + AnnounceTo(self, "yoda"); + if(headshot) { - if(yoda) - AnnounceTo(self, "yoda"); + AnnounceTo(self, "headshot"); } - else + if(damage_goodhits && self.minstanex_lasthit) { - if(yoda && flying) - AnnounceTo(self, "yoda"); - if(headshot) - { - AnnounceTo(self, "headshot"); - } - if(damage_goodhits && self.minstanex_lasthit) - { - if(AnnounceTo(self, "impressive")) - damage_goodhits = 0; // only every second time - } + if(AnnounceTo(self, "impressive")) + damage_goodhits = 0; // only every second time } self.minstanex_lasthit = damage_goodhits; @@ -78,98 +70,8 @@ void W_MinstaNex_Attack (void) } else WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v); - - if (g_minstagib) - W_DecreaseAmmo(ammo_cells, 1, autocvar_g_balance_minstanex_reload_ammo); - else - W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_reload_ammo); -} - - -.float minstagib_nextthink; -.float minstagib_needammo; -void minstagib_stop_countdown(entity e) -{ - if (!e.minstagib_needammo) - return; - Send_CSQC_Centerprint_Generic_Expire(e, CPID_MINSTA_FINDAMMO); - e.minstagib_needammo = FALSE; -} -void minstagib_ammocheck(void) -{ - if (time < self.minstagib_nextthink) - return; - - if (self.deadflag || gameover) - minstagib_stop_countdown(self); - else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO)) - { - minstagib_stop_countdown(self); - self.health = 100; - } - else - { - self.minstagib_needammo = TRUE; - if (self.health == 5) - { - Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "terminated"); - } - else if (self.health == 10) - { - Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "1"); - } - else if (self.health == 20) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "2"); - } - else if (self.health == 30) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "3"); - } - else if (self.health == 40) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "4"); - } - else if (self.health == 50) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "5"); - } - else if (self.health == 60) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "6"); - } - else if (self.health == 70) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "7"); - } - else if (self.health == 80) - { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "8"); - } - else if (self.health == 90) - { - Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 seconds left to find some ammo", 1, 9); - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - AnnounceTo(self, "9"); - } - else if (self.health == 100) - { - Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10); - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - if not(self.flags & FL_GODMODE) - AnnounceTo(self, "10"); - } - } - self.minstagib_nextthink = time + 1; + + W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo); } void spawnfunc_weapon_minstanex (void); // defined in t_items.qc @@ -180,10 +82,7 @@ float w_minstanex(float req) float minstanex_ammo; // now multiple WR_s use this - if(g_minstagib) - minstanex_ammo = 1; - else - minstanex_ammo = autocvar_g_balance_minstanex_ammo; + minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo); if (req == WR_AIM) {