X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator_instagib.qc;h=a59bd0fe0cafbc2e2d5c2acb1910f456ac62ff24;hb=95c7f3405f82d9975617acc0ca4d4bcf5c4acba2;hp=cd0ebdd0f052f7bb6cbdeea5e277094d0e02a257;hpb=90c787a8242a7876e34940fe6d76d1395ea54389;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index cd0ebdd0f..a59bd0fe0 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -1,20 +1,25 @@ +#include "../_all.qh" + +#include "mutator.qh" + +#include "../cl_client.qh" +#include "../../common/buffs.qh" + +#include "../../common/items/all.qc" + void spawnfunc_item_minst_cells (void) { if (!g_instagib) { remove(self); return; } if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop; - StartItem ("models/items/a_cells.md3", - "misc/itempickup.wav", 45, 0, - "Vaporizer Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100); + StartItemA (ITEM_VaporizerCells); } void instagib_health_mega() { 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); + StartItemA (ITEM_ExtraLife); } .float instagib_nextthink; @@ -24,7 +29,7 @@ void instagib_stop_countdown(entity e) if (!e.instagib_needammo) return; Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_INSTAGIB_FINDAMMO); - e.instagib_needammo = FALSE; + e.instagib_needammo = false; } void instagib_ammocheck() { @@ -39,7 +44,7 @@ void instagib_ammocheck() instagib_stop_countdown(self); else { - self.instagib_needammo = TRUE; + self.instagib_needammo = true; if (self.health <= 5) { Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); @@ -106,55 +111,55 @@ MUTATOR_HOOKFUNCTION(instagib_MatchEnd) FOR_EACH_PLAYER(head) instagib_stop_countdown(head); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_MonsterLoot) { other.monster_loot = spawnfunc_item_minst_cells; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn) { // always refill ammo - if(self.monsterid == MON_MAGE) + if(self.monsterid == MON_MAGE.monsterid) self.skin = 1; - - return FALSE; + + return false; } MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack) { - if(checkentity.items & IT_STRENGTH) - return TRUE; + if(checkentity.items & ITEM_Strength.m_itemid) + return true; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_MakePlayerObserver) { instagib_stop_countdown(self); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_PlayerSpawn) { self.effects |= EF_FULLBRIGHT; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_PlayerPreThink) { instagib_ammocheck(); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_PlayerRegen) { // no regeneration in instagib - return TRUE; + return true; } MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) @@ -162,14 +167,14 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) if (!(self.effects & EF_FULLBRIGHT)) self.effects |= EF_FULLBRIGHT; - if (self.items & IT_STRENGTH) + if (self.items & ITEM_Strength.m_itemid) { 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; + self.items &= ~ITEM_Strength.m_itemid; Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY); } } @@ -179,18 +184,18 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) { self.alpha = autocvar_g_instagib_invis_alpha; self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha; - self.items |= IT_STRENGTH; + self.items |= ITEM_Strength.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } } - if (self.items & IT_INVINCIBLE) + if (self.items & ITEM_Shield.m_itemid) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); if (time > self.invincible_finished) { - self.items &= ~IT_INVINCIBLE; + self.items &= ~ITEM_Shield.m_itemid; Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED); } } @@ -198,20 +203,20 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) { if (time < self.invincible_finished) { - self.items |= IT_INVINCIBLE; + self.items |= ITEM_Shield.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED); } } - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics) { - if(self.items & IT_INVINCIBLE) + if(self.items & ITEM_Shield.m_itemid) self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_SplitHealthArmor) @@ -219,14 +224,14 @@ MUTATOR_HOOKFUNCTION(instagib_SplitHealthArmor) damage_save = 0; damage_take = frag_damage; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_ForbidThrowing) { // weapon dropping on death handled by FilterItem - return TRUE; + return true; } MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) @@ -245,26 +250,30 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) } if(IS_PLAYER(frag_attacker)) - if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id)) + { + if(frag_target.armorvalue) + { + frag_target.armorvalue -= 1; + frag_damage = 0; + frag_target.damage_dealt += 1; + frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit + Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue); + } + } + + if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id)) { if(frag_deathtype & HITTYPE_SECONDARY) { frag_damage = frag_mirrordamage = 0; - + if(frag_target != frag_attacker) { - if(frag_target.health > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_SECONDARY); } + if(frag_target.health > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); } frag_force = '0 0 0'; } } - else if(frag_target.armorvalue) - { - frag_target.armorvalue -= 1; - frag_damage = 0; - frag_target.damage_dealt += 1; - frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit - Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue); - } } } @@ -281,10 +290,10 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) frag_mirrordamage = 0; } - if(frag_target.items & IT_STRENGTH) + if((frag_target.buffs & BUFF_INVISIBLE.m_itemid) || (frag_target.items & ITEM_Strength.m_itemid)) yoda = 1; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_SetStartItems) @@ -302,21 +311,21 @@ MUTATOR_HOOKFUNCTION(instagib_SetStartItems) start_weapons = warmup_start_weapons = WEPSET_VAPORIZER; start_items |= IT_UNLIMITED_SUPERWEAPONS; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_FilterItem) { if(self.classname == "item_cells") - return TRUE; // no normal cells? + return true; // no normal cells? - if(self.weapon == WEP_VAPORIZER && self.classname == "droppedweapon") + if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon") { self.ammo_cells = autocvar_g_instagib_ammo_drop; - return FALSE; + return false; } - if(self.weapon == WEP_DEVASTATOR || self.weapon == WEP_VORTEX) + if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id) { entity e = spawn(); setorigin(e, self.origin); @@ -325,19 +334,19 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem) self = e; spawnfunc_item_minst_cells(); self = oldself; - return TRUE; + return true; } if(self.flags & FL_POWERUP) - return FALSE; + return false; if(self.ammo_cells > autocvar_g_instagib_ammo_drop && self.classname != "item_minst_cells") self.ammo_cells = autocvar_g_instagib_ammo_drop; if(self.ammo_cells && !self.weapon) - return FALSE; + return false; - return TRUE; + return true; } MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) @@ -346,22 +355,22 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) // if you have the invisibility powerup, sprites ALWAYS are restricted to your team // but only apply this to real players, not to spectators - if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other)) + if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Strength.m_itemid) && (e == other)) if(DIFF_TEAM(self.owner, e)) - return TRUE; + return true; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_ItemCountdown) { - switch(self.items) + 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; + case ITEM_Strength.m_itemid: item_name = "item-invis"; item_color = '0 0 1'; break; + case ITEM_ExtraLife.m_itemid: item_name = "item-extralife"; item_color = '1 0 0'; break; + case ITEM_Shield.m_itemid: item_name = "item-speed"; item_color = '1 0 1'; break; } - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_ItemTouch) @@ -395,9 +404,9 @@ MUTATOR_HOOKFUNCTION(instagib_ItemTouch) MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn) { - if (!autocvar_g_powerups) { return FALSE; } - if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega")) - return FALSE; + if (!autocvar_g_powerups) { return false; } + if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.itemdef == ITEM_HealthMega)) + return false; entity e = spawn(); @@ -413,25 +422,25 @@ MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn) e.noalign = self.noalign; setorigin(e, self.origin); - return TRUE; + return true; } MUTATOR_HOOKFUNCTION(instagib_BuildMutatorsString) { ret_string = strcat(ret_string, ":instagib"); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_BuildMutatorsPrettyString) { ret_string = strcat(ret_string, ", instagib"); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(instagib_SetModname) { modname = "instagib"; - return TRUE; + return true; } MUTATOR_DEFINITION(mutator_instagib) @@ -459,5 +468,5 @@ MUTATOR_DEFINITION(mutator_instagib) MUTATOR_HOOK(BuildMutatorsPrettyString, instagib_BuildMutatorsPrettyString, CBC_ORDER_ANY); MUTATOR_HOOK(SetModname, instagib_SetModname, CBC_ORDER_ANY); - return FALSE; + return false; }