From f56b94b56397ba6b4a470089bb748498f3a77e6a Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 19 Aug 2015 14:44:42 +0200 Subject: [PATCH] Fix Large Armor and Mega Health detection in Quake / Quake 3 maps. Fixes issues in itemstime, superspec, instagib and lms. --- qcsrc/server/mutators/gamemode_lms.qc | 2 +- qcsrc/server/mutators/mutator_instagib.qc | 2 +- qcsrc/server/mutators/mutator_superspec.qc | 8 ++++---- qcsrc/server/t_items.qc | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index 61e51451f..9c97c7cd2 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -158,7 +158,7 @@ MUTATOR_HOOKFUNCTION(lms_KeepScore) MUTATOR_HOOKFUNCTION(lms_FilterItem) { if(autocvar_g_lms_extra_lives) - if(self.classname == "item_health_mega") + if(self.itemdef == ITEM_HealthMega) { self.max_health = 1; return false; diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 9e4727d8d..b71a8c9c7 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -405,7 +405,7 @@ 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")) + if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.itemdef == ITEM_HealthMega)) return false; entity e = spawn(); diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index 3570e2204..267a0f71d 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -122,10 +122,10 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch) } if((self.autospec_flags & ASF_SHIELD && _item.invincible_finished) || - (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) || - (self.autospec_flags & ASF_MEGA_AR && _item.classname == "item_armor_large") || - (self.autospec_flags & ASF_MEGA_HP && _item.classname == "item_health_mega") || - (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team")) + (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) || + (self.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorLarge) || + (self.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) || + (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team")) { if((self.enemy != other) || IS_OBSERVER(self)) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 873f7a53c..b41cc107f 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -501,11 +501,11 @@ void Item_ItemsTime_SetTime(entity e, float t) switch(e.items) { case IT_HEALTH: - // if(e.classname == "item_health_mega") // IT_HEALTH unequivocally identifies it + // if(e.itemdef == ITEM_MegaHealth) // e.items == IT_HEALTH unequivocally identifies it it_health_mega_time = t; break; case IT_ARMOR: - if(e.classname == "item_armor_large") // IT_ARMOR doesn't unequivocally identifies it + if(e.itemdef == ITEM_ArmorLarge) // e.items == IT_ARMOR doesn't unequivocally identifies it it_armor_large_time = t; break; case IT_STRENGTH://"item-strength" @@ -598,7 +598,7 @@ void Item_Respawn (void) sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound setorigin (self, self.origin); - if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS)) + if(self.flags & FL_POWERUP || self.itemdef == ITEM_ArmorLarge || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS)) { float t = Item_ItemsTime_UpdateTime(self, 0); Item_ItemsTime_SetTime(self, t); @@ -636,11 +636,11 @@ void Item_RespawnCountdown (void) case IT_STRENGTH: name = "item-strength"; rgb = '0 0 1'; break; case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break; case IT_HEALTH: - //if (self.classname == "item_health_mega") + // if(self.itemdef == ITEM_HealthMega) {name = "item_health_mega"; rgb = '1 0 0';} break; case IT_ARMOR: - if (self.classname == "item_armor_large") + if(self.itemdef == ITEM_ArmorLarge) {name = "item_armor_large"; rgb = '0 1 0';} break; } @@ -711,7 +711,7 @@ void Item_RespawnThink() void Item_ScheduleRespawnIn(entity e, float t) { - if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.classname == "item_armor_large" || e.items == IT_HEALTH) + if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.itemdef == ITEM_ArmorLarge || e.items == IT_HEALTH) { e.think = Item_RespawnCountdown; e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS); -- 2.39.2